JNDI lookup failing when looking up JMS queue in WebLogic 10.3.5

本小妞迷上赌 提交于 2019-12-12 21:39:06

问题


I'm new to JMS programming and am running into NameNotFoundException, even though, in looking at the Admin Console, it shows the JNDI name that is failing.

The exception produced is:

javax.naming.NameNotFoundException: Unable to resolve 'tutorialqueue'. Resolved ''; remaining name 'tutorialqueue' at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139) at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252) at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182) at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206) at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)

In the Admin Console, I see:

Name - TutorialJmsConnectionFactory
Type - Connection Factory
JNDI Name - tutorialconnectionfactory
Subdeployment - Default Targetting
Targets - AdminServer

Name - TutorialJmsQueue
Type - Queue
JNDI Name - tutorialqueue
Subdeployment -
Targets -

The console shows the tutorialqueue JNDI name that the exception says it can't find. Also, the tutorialconnectionfactory name WAS successfully found. Might it have to do with the Subdeployment and/or Targets being blank?

Here is the code where the lookup occurs/fails:

QueueConnectionFactory queueFactory = ( QueueConnectionFactory ) ic.lookup( "tutorialconnectionfactory" );
QueueConnection queueConnection = queueFactory.createQueueConnection();
QueueSession queueSession = queueConnection.createQueueSession( false , Session.AUTO_ACKNOWLEDGE );
Queue queue = ( Queue ) ic.lookup( "tutorialqueue" );
QueueSender sender = queueSession.createSender( queue );

Can anyone point me in the right direction? TIA


回答1:


In weblogic, you should setup your queue to use the same subdeployment and target(s) as the connection factory, both need to be found in a JVM. Update your queue's target and subdeployment to match the connection factory and it should start working.




回答2:


To add Everything is ok... But you need replace

> tutorialconnectionfactory and 
> tutorialqueue

with

> jms/tutorialconnectionfactory and 
> jms/tutorialqueue

then I think it will work fine...



来源:https://stackoverflow.com/questions/9914284/jndi-lookup-failing-when-looking-up-jms-queue-in-weblogic-10-3-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!