So I believe your question boils down to the following: When a webapp deployed to JBoss contains jetty-all.jar, the Jetty classes cause the default InitialContext to be created as a Jetty class. How can I get a JBoss InitialContext instead, to allow lookups of EJBs exposed by JBoss?
Can you try setting the following option when creating your InitialContext? props.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory"); If the problem really is just that your code is getting the wrong JNDI context, that line should solve the problem. Tim On Jun 11, 2017 7:03 AM, "aragoubi" <aymen....@gmail.com> wrote: I didn't get response from jboss forum. Actually, I tried differents ways, and I finally get it working only if I remove the jetty-all jar(remove ws connector). Without jetty, it is looking for my jndi in the right place. I am defining the jndi properties like this : Properties jndiProps = new Properties(); jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); ctx = new InitialContext(jndiProps); The jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); is supposed to tell JNDI to create an InitialContext from the classes in the specified package, but it's not working. Those classes have the knowhow to lookup names in the ejb: namespace. But when I add the jetty all jar in order to use websocket, I get this (org.eclipse.jetty.jndi.local.localContextRoot.lookup in stacktrace) which means that henceforth it's looking in jetty jndi. -- View this message in context: http://activemq.2283324.n4. nabble.com/Adding-activemq-jetty-all-jar-for-using-ws- doesn-t-allow-me-anymore-getting-jboss-exposed-ejb-tp4727190p4727304.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.