jboss7.x - AS 7.1.1 : JNDI Look up for JMS connection factroy is not working -
i trying write sample program jms using jboss. went through following link how use jboss jms
http://docs.jboss.org/jbossmessaging/docs/usermanual-2.0.0.beta1/html/using-jms.html
i getting exception while looking connectionfactory i.e. "inictx.lookup("connectionfactory")"
javax.naming.communicationexception: receive timed out [root exception java.net.sockettimeoutexception: receive timed out] @ org.jnp.interfaces.namingcontext.discoverserver(namingcontext.java:1058) @ org.jnp.interfaces.namingcontext.checkref(namingcontext.java:1127) @ org.jnp.interfaces.namingcontext.lookup(namingcontext.java:478) @ org.jnp.interfaces.namingcontext.lookup(namingcontext.java:471) @ javax.naming.initialcontext.lookup(unknown source) @ messageproducer.main(messageproducer.java:46) caused by: java.net.sockettimeoutexception: receive timed out @ java.net.plaindatagramsocketimpl.receive0(native method) @ java.net.plaindatagramsocketimpl.receive(unknown source) @ java.net.datagramsocket.receive(unknown source) @ org.jnp.interfaces.namingcontext.discoverserver(namingcontext.java:1038)
the reason is, jboss naming service not running(netstat -an doesn't show result port 1099) . didn't configure specific setting naming service. let take default port 1099.
am missing configuration? kindly me in running jboss naming service.
specification :
jboss : 7.1.1 final jre : 1.6 os : windows 7
seems mixed jboss version manual version. as7 not use jnp , jndi port 4447.
so having following setup in standalone-full.xml
<security-enabled>false</security-enabled> ... <jms-destinations> <jms-queue name="testqueue"> <entry name="queue/test"/> <entry name="java:jboss/exported/jms/queue/test"/> </jms-queue> </jms-destinations>
i able connect client, code follows:
connection connection = null; initialcontext initialcontext = null; properties props = new properties(); props.put(context.initial_context_factory, "org.jboss.naming.remote.client.initialcontextfactory"); props.put(context.provider_url, "remote://localhost:4447"); props.put(context.security_principal, "appuser"); props.put(context.security_credentials, "password"); try { // step 1. create initial context perform jndi lookup. initialcontext = new initialcontext(props); // step 2. perfom lookup on queue queue queue = (queue)initialcontext.lookup("jms/queue/test"); // step 3. perform lookup on connection factory connectionfactory cf = (connectionfactory)initialcontext.lookup("jms/remoteconnectionfactory"); // step 4.create jms connection connection = cf.createconnection();
Comments
Post a Comment