问题描述:本机配置了jmsServer在 配置如下
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> <property name="environment"> <props> <prop key="java.naming.factory.initial"> weblogic.jndi.WLInitialContextFactory </prop> <prop key="java.naming.provider.url"> t3://localhost:7001 </prop> <prop key="java.naming.factory.url.pkgs"> weblogic.jndi.factories </prop> </props> </property> </bean> <!-- jms sender --> <bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiTemplate" ref="jndiTemplate" /> <property name="jndiName" value="ConnectionFactory" /> </bean> <bean id="jmsQueue" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiTemplate" ref="jndiTemplate"></property> <property name="jndiName" value="Queue"></property> </bean> <!-- jms template --> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="jmsConnectionFactory"></property> <property name="defaultDestination" ref="jmsQueue"></property> </bean>
?启动发布都没有问题。
但是为了让内网的用户也访问我的jms Server 我把配置中的 localhost改成了我的ip,
这时发布遇到了问题
<2009-4-9 上午10时02分18秒 CST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException:
?at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:891)
?at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:333)
?at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
?at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
?at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
?Truncated. see log file for complete stacktrace
java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]
?at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:815)
?at weblogic.security.service.SecurityServiceManager.getSealedSubjectFromWire(SecurityServiceManager.java:504)
?at weblogic.rjvm.MsgAbbrevInputStream.getSubject(MsgAbbrevInputStream.java:316)
?at weblogic.rmi.internal.BasicServerRef.acceptRequest(BasicServerRef.java:809)
?at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:298)
?Truncated. see log file for complete stacktrace
>
解决办法 :
? 配置加入用户名密码
<bean id="jndiTemplate"
class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
weblogic.jndi.WLInitialContextFactory
</prop>
<prop key="java.naming.provider.url">
t3://192.166.68.44:7001
</prop>
<prop key="java.naming.factory.url.pkgs">
weblogic.jndi.factories
</prop>
<prop key="java.naming.security.principal">
weblogic
</prop>
<prop key="java.naming.security.credentials">
weblogic
</prop>
</props>
</property>
</bean>
<!-- jms sender -->
<bean id="jmsConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="jndiName" value="ConnectionFactory" />
</bean>
<bean id="jmsQueue"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"></property>
<property name="jndiName" value="Queue"></property>
</bean>
<!-- jms template -->
<bean id="jmsTemplate"
class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsConnectionFactory"></property>
<property name="defaultDestination" ref="jmsQueue"></property>
</bean>
?
重启就好了。weblogic对于127.0.0.1与localhost的安全 校验似乎较低。
还有注意的一点:该工程我配置 远程的jms服务器时,通过本机发送消息到远程jms服务器,然后再监听远程jms服务器的消息队列,在easyeclipse下面直接发布到weblogic下,启动时总是抛出域信任问题的异常
<2009-5-5 上午11时29分04秒 CST> <Warning> <HTTP> <BEA-101162> <User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'maillistenerContainer' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'maillistenerContainer' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1032) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242) Truncated. see log file for complete stacktrace java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators] at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:211) at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338) at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252) at weblogic.jms.frontend.FEConnectionFactoryImpl_922_WLStub.connectionCreateRequest(Unknown Source) at weblogic.jms.client.JMSConnectionFactory.setupJMSConnection(JMSConnectionFactory.java:238) Truncated. see log file for complete stacktrace java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators] at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:815) at weblogic.security.service.SecurityServiceManager.getSealedSubjectFromWire(SecurityServiceManager.java:504) at weblogic.rjvm.MsgAbbrevInputStream.getSubject(MsgAbbrevInputStream.java:316) at weblogic.rmi.internal.BasicServerRef.acceptRequest(BasicServerRef.java:809) at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:298) Truncated. see log file for complete stacktrace >
?这个异常费了我很多时间,最后证明是easyEclipse的weblogic插件的问题导致的,直接打包放到weblogic域下发布和在myeclipse下发布工程都没有问题。
?
注:在整个调试过程中,linux下经常jms通讯失败的,一个原因是 linux的默认防火墙没有关闭。
?
我的异常网推荐解决方案:org.springframework.beans.factory.BeanCreationException:,http://www.myexception.cn/j2ee/10759.html