在JBoss 5.1.0 GA中通过MDB身份验证连接到weblogic 10.3.6 JMS队列时出现问题
我正在使用sun-jms-adapter.rar。在开始使用身份验证之前,我的所有配置都可以正常工作。我还尝试从独立应用程序和无状态bean(用于向队列发送消息)访问队列,一切正常 我的实际配置是: weblogic-ds.xml在JBoss 5.1.0 GA中通过MDB身份验证连接到weblogic 10.3.6 JMS队列时出现问题,jms,weblogic,ejb-3.0,jboss5.x,jboss-mdb,Jms,Weblogic,Ejb 3.0,Jboss5.x,Jboss Mdb,我正在使用sun-jms-adapter.rar。在开始使用身份验证之前,我的所有配置都可以正常工作。我还尝试从独立应用程序和无状态bean(用于向队列发送消息)访问队列,一切正常 我的实际配置是: weblogic-ds.xml <connection-factories> <!-- SUN JMS JCA Resource adapter, use this to get transacted JMS in beans --> <no-
<connection-factories>
<!-- SUN JMS JCA Resource adapter, use this to get transacted JMS in beans -->
<no-tx-connection-factory>
<jndi-name>CFX/ExternalConnectionFactory</jndi-name>
<xa-transaction />
<rar-name>sun-jms-adapter.rar</rar-name>
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
<config-property name="Destination" type="java.lang.String">javax.jms.Destination</config-property>
<max-pool-size>20</max-pool-size>
<depends>jboss.messaging:service=ServerPeer</depends>
</no-tx-connection-factory>
</connection-factories>
CFX/外部连接工厂
sun-jms-adapter.rar
javax.jms.QueueConnectionFactory
javax.jms.Queue
java:/DefaultJMSProvider
javax.jms.Destination
20
消息传递:service=ServerPeer
ejb-jar.xml配置:
<enterprise-beans>
<message-driven>
<ejb-name>QueueReceiverMDB</ejb-name>
<ejb-class>com.tests.mdb.QueueReceiverMDB</ejb-class>
<transaction-type>Bean</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>${weblogic.jms.queue.in}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>ConnectionURL</activation-config-property-name>
<activation-config-property-value>${weblogic.jms.url}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>UserName</activation-config-property-name>
<activation-config-property-value>${weblogic.jms.username}</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>Password</activation-config-property-name>
<activation-config-property-value>${weblogic.jms.password}</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
队列接收者
com.tests.mdb.QueueReceiverMDB
豆子
目的地
${weblogic.jms.queue.in}
目的型
javax.jms.Queue
连接URL
${weblogic.jms.url}
用户名
${weblogic.jms.username}
密码
${weblogic.jms.password}
最后是我的jboss.xml:
<message-driven>
<ejb-name>QueueReceiverMDB</ejb-name>
<destination-jndi-name>java:/CFX/ExternalConnectionFactory</destination-jndi-name>
<local-jndi-name>local/QueueReceiverMDB</local-jndi-name>
<resource-adapter-name>sun-jms-adapter.rar</resource-adapter-name>
<configuration-name>JMSJCA Message Driven Bean</configuration-name>
</message-driven>
队列接收者
java:/CFX/ExternalConnectionFactory
本地/队列接收方MDB
sun-jms-adapter.rar
JMSJCA消息驱动Bean
我总是会遇到这样的错误:
16:25:07126警告[Activation]JMSJCA-E016:[sync QueueReceiver(jms/TestJMSQueueIn)@[t3://localhost:7001]:消息传递启动失败(尝试1);将在1秒钟后重试。错误是:对资源的访问被拒绝:type=,application=TestJMSModule,destinationType=queue,resource=TestJMSQueueIn,action=receive
weblogic.jms.common.JMSSecurityException:拒绝访问资源:type=,application=TestJMSModule,destinationType=queue,resource=TestJMSQueueIn,action=receive
在weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:110)上
在weblogic.jms.dispatcher.DispatcherAdapter.Dispatchessync(DispatcherAdapter.java:45)
位于weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:2982)
位于weblogic.jms.client.JMSSession.setupConsumer(JMSSession.java:2749)
位于weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:2691)
位于weblogic.jms.client.JMSSession.createReceiver(JMSSession.java:2596)
位于weblogic.jms.client.WLSessionImpl.createReceiver(WLSessionImpl.java:991)
位于com.stc.jmsjca.core.RAJMSObjectFactory.createMessageConsumer(RAJMSObjectFactory.java:620)
位于com.stc.jmsjca.core.SyncDelivery$SyncWorker.init(SyncDelivery.java:502)
位于com.stc.jmsjca.core.SyncDelivery.start(SyncDelivery.java:202)
位于com.stc.jmsjca.core.Activation.asyncStart(Activation.java:557)
位于com.stc.jmsjca.core.Activation.access$000(Activation.java:82)
位于com.stc.jmsjca.core.Activation$1.run(Activation.java:351)
运行(Thread.java:745)
原因:weblogic.jms.common.JMSSecurityException:拒绝访问资源:type=,application=TestJMSModule,destinationType=queue,resource=TestJMSQueueIn,action=receive
在weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:110)上
在weblogic.jms.dispatcher.DispatcherAdapter.Dispatchessync(DispatcherAdapter.java:45)
位于weblogic.jms.frontend.FEConsumer.(FEConsumer.java:296)
位于weblogic.jms.frontend.FESession$2.run(FESession.java:1076)
位于weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
位于weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
位于weblogic.jms.frontend.FESession.consumerCreate(FESession.java:1072)
位于weblogic.jms.frontend.FESession.invoke(FESession.java:3027)
位于weblogic.messaging.dispatcher.Request.wrappedFiniteStateMachine(Request.java:961)
位于weblogic.messaging.dispatcher.DispatcherServerRef.invoke(DispatcherServerRef.java:276)
位于weblogic.messaging.dispatcher.DispatcherServerRef.HandlerRequest(DispatcherServerRef.java:141)
在weblogic.messaging.dispatcher.DispatcherServerRef.access$000(DispatcherServerRef.java:34)
位于weblogic.messaging.dispatcher.DispatcherServerRef$2.run(DispatcherServerRef.java:111)
在weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
在weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
原因:weblogic.jms.common.JMSSecurityException:拒绝访问资源:type=,application=TestJMSModule,destinationType=queue,resource=TestJMSQueueIn,action=receive
位于weblogic.jms.dispatcher.Request.handleThrowable(Request.java:87)
位于weblogic.jms.dispatcher.Request.getResult(Request.java:52)
位于weblogic.messaging.dispatcher.Request.wrappedFiniteStateMachine(Request.java:1124)
位于weblogic.messaging.dispatcher.DispatcherImpl.syncRequest(DispatcherImpl.java:185)
在weblogic.messaging.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.java:220)上
在weblogic.jms.dispatcher.DispatcherAdapter.Dispatchessync(DispatcherAdapter.java:43)
... 还有13个
原因:weblogic.jms.common.JMSSecurityException:拒绝访问资源:type=,application=TestJMSModule,destinationType=queue,resource=TestJMSQueueIn,action=receive
位于weblogic.jms.common.JMSSecurityHelper.checkPermission(JMSSecurityHelper.java:162)
位于weblogic.jms.backend.BEDestinationSecurityImpl.checkReceivePermission(BEDestinationSecurityImpl.java:87)
位于weblogic.jms.backend.BEConsumerImpl.init(BEConsumerImpl.java:312)
位于weblogic.jms.backend.BEConsumerImpl.(BEConsumerImpl.java:268)
位于weblogic.jms.backend.BEQueueImpl.createConsumer(BEQueueImpl.java:188)
在weblogic.jms.backend.BESessionImpl.createBECons
private Object getJndiObject(UrlParser url, String name, String username, String password) throws JMSException {
if (sLog.isDebugEnabled()) {
sLog.debug("Looking up JNDI object " + name);
}
if (name == null || name.length() == 0) {
throw Exc.jmsExc(LOCALE.x("E401: The JNDI name is null"));
}
InitialContext ctx = null;
try {
if (mSpecialISORBMethod != null) {
// Works on IS only
if (mSpecialISORBMethodIsOn != null) {
Boolean isEnabled = (Boolean) mSpecialISORBMethodIsOn.invoke(null, new Object[0]);
if (!isEnabled.booleanValue()) {
throw Exc.rsrcExc(LOCALE.x("E823: CORBA-SE needs to be enabled on"
+ " this server. Please change the value of the <se-orb enabled=\"false\"/>"
+ " to <se-orb enabled=\"true\"/> in the configuration file of "
+ " the Integration Server (logicalhost/is/domains/<domain-name>"
+ "/config/domain.xml) and restart the server."));
}
}
final Properties prop = (Properties) mSpecialISORBMethod.invoke(null, new Object[0]);
prop.put(Context.URL_PKG_PREFIXES, JNDI_WEBLOGIC_PROTOCOL_PACKAGES);
ctx = new InitialContext(prop);
return ctx.lookup("corbaname:iiop:1.2@" + url.getHost() + ":" + url.getPort()
+ '#' + name);
} else {
// Will be executed on other application servers than the IS
//add username/password if not null to context
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
env.put(Context.PROVIDER_URL, "t3://" + url.getHost() + ":" + url.getPort());
if (username != null) {
env.put(Context.SECURITY_PRINCIPAL, username);
env.put(Context.SECURITY_CREDENTIALS, password);
}
ctx = new InitialContext(env);
return ctx.lookup(name);
}
} catch (Exception e) {
throw Exc.jmsExc(LOCALE.x("E821: Could not find JNDI object by name [{0}]: {1}", name, e), e);
}
//leave context open
/*finally {
safeClose(ctx);
}*/
}