JMS queue not found in JNDI lookup when it's there -


i have created sample setup test jms message queues. setup follows:

wildfly 8.1.0.final server switchyard projects (i'll have switchyard assignment soon). added jms queue server using following code snippet:

if (outcome != success) of /subsystem=messaging/hornetq-server=default/jms-queue=helloqueue:read-resource     jms-queue add --queue-address=helloqueue --entries=java:/jms/queue/helloqueue, java:jboss/exported/jms/queue/helloqueue end-if 

i received following response wildfly:

20:13:36,647 info  [org.jboss.as.messaging] (serverservice thread pool -- 59) jbas011601: bound messaging object jndi name java:/jms/queue/helloqueue 

i created switchyard project bound queue, , prints received through queue standard output. created simple client send messages through queue. client code:

package soi.syhello.jms.client;  import java.util.properties; import java.util.logging.logger;  import javax.jms.connectionfactory; import javax.jms.destination; import javax.jms.jmscontext; import javax.naming.context; import javax.naming.initialcontext; import javax.naming.namingexception;  public class hellojmsclient {      private static final logger log = logger.getlogger(hellojmsclient.class.getname());     private static final string default_message = "alice & bob";     private static final string default_connection_factory = "jms/remoteconnectionfactory";     private static final string default_destination = "java:/jms/queue/helloqueue";     private static final string default_username = "guest";     private static final string default_password = "guest";     private static final string initial_context_factory = "org.jboss.naming.remote.client.initialcontextfactory";     private static final string provider_url = "http-remoting://localhost:18080";      public static void main(string[] args) {         context namingcontext = null;         try {             try {                 string username = system.getproperty("username", default_username);                 string password = system.getproperty("password", default_password);                  final properties env = new properties();                 env.put(context.initial_context_factory, initial_context_factory);                 env.put(context.provider_url, system.getproperty(context.provider_url, provider_url));                 env.put(context.security_principal, username);                 env.put(context.security_credentials, password);                 namingcontext = new initialcontext(env);                  string connectionfactorystring = system.getproperty("connection.factory", default_connection_factory);                 log.info("attempting acquire connection factory \"" + connectionfactorystring + "\"");                 connectionfactory connectionfactory = (connectionfactory) namingcontext.lookup(connectionfactorystring);                 log.info("found connection factory \"" + connectionfactorystring + "\" in jndi");                  string destinationstring = system.getproperty("destination", default_destination);                 log.info("attempting acquire destination \"" + destinationstring + "\"");                 destination destination = (destination) namingcontext.lookup(destinationstring);                 log.info("found destination \"" + destinationstring + "\" in jndi");                  string content = system.getproperty("message.content", default_message);                 jmscontext context = connectionfactory.createcontext(username, password);                 log.info("sending message content: " + content);                 context.createproducer().send(destination, content);                 context.close();             } catch (exception e) {                 e.printstacktrace();                 log.severe(e.getmessage());             }         } {             if (namingcontext != null) {                 try {                     namingcontext.close();                 } catch (namingexception e) {                     log.severe(e.getmessage());                 }             }         }     }  } 

now, when running client, error:

ápr. 09, 2015 8:16:24 du org.xnio.xnio <clinit> info: xnio version 3.2.2.final ápr. 09, 2015 8:16:24 du org.xnio.nio.nioxnio <clinit> info: xnio nio implementation version 3.2.2.final ápr. 09, 2015 8:16:24 du org.jboss.remoting3.endpointimpl <clinit> info: jboss remoting version 4.0.3.final ápr. 09, 2015 8:16:25 du soi.syhello.jms.client.hellojmsclient main info: attempting acquire connection factory "jms/remoteconnectionfactory" ápr. 09, 2015 8:16:26 du soi.syhello.jms.client.hellojmsclient main info: found connection factory "jms/remoteconnectionfactory" in jndi ápr. 09, 2015 8:16:26 du soi.syhello.jms.client.hellojmsclient main info: attempting acquire destination "java:/jms/queue/helloqueue" javax.naming.namenotfoundexception: jms/queue/helloqueue -- service jboss.naming.context.java.jboss.exported.jms.queue.helloqueue     @ org.jboss.as.naming.servicebasednamingstore.lookup(servicebasednamingstore.java:104)     @ org.jboss.as.naming.namingcontext.lookup(namingcontext.java:202)     @ org.jboss.as.naming.namingcontext.lookup(namingcontext.java:179)     @ org.jboss.naming.remote.protocol.v1.protocol$1.handleservermessage(protocol.java:127)     @ org.jboss.naming.remote.protocol.v1.remotenamingserverv1$messagereciever$1.run(remotenamingserverv1.java:73)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617)     @ java.lang.thread.run(thread.java:745) ápr. 09, 2015 8:16:26 du soi.syhello.jms.client.hellojmsclient main severe: jms/queue/helloqueue -- service jboss.naming.context.java.jboss.exported.jms.queue.helloqueue 

although queue visible in admin console:

http://kepfeltoltes.hu/150409/1142213920k_pkiv_g_s_www.kepfeltoltes.hu_.png

the problem whole situation is, created detailed tutorial given me professor. every other part worked far. problem here?

the queue created not bound under java:jboss/exported context. in case of wildfly, entries under java:jboss/exported accessible through remote jndi lookup.

change jndi entry java:/jms/queue/helloqueue queue/helloqueue.

if (outcome != success) of /subsystem=messaging/hornetq-server=default/jms-queue=helloqueue:read-resource     jms-queue add --queue-address=helloqueue --entries=queue/helloqueue,java:jboss/exported/jms/queue/helloqueue end-if 

Popular posts from this blog