0 Replies Latest reply on Jun 2, 2017 5:39 AM by Aymen Ragoubi

    Getting jboss ejb in jar included in ativemq rar deployed within jboss

    Aymen Ragoubi Newbie

      I have an activemq broker deployed within my jboss server.
      activemq is deployed as a rar file placed in jboss standalone/deployment repository.

      An other project is also deployed within my jboss as an ear file.  

      This last is exposing some ejb objects in my jboss.

      I tried to get an ejb from a jar file that I put into my activemq rar file. A class placed within the jar is called when I connect a client to the broker.


      Here more informations about the exposed ejb object in addition to how I am trying to get it:


      Log from jboss when ejb is exposed :

       

      11:50:17,538 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named HardwareDataManagement in deployment unit subdeployment "HemisCoreClient.jar" of deployment "Hemis.ear" are as follows:

       

        java:global/Hemis/HemisCoreClient/HardwareDataManagement!com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement

        java:app/HemisCoreClient/HardwareDataManagement!com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement

        java:module/HardwareDataManagement!com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement

        java:jboss/exported/Hemis/HemisCoreClient/HardwareDataManagement!com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement

        java:global/Hemis/HemisCoreClient/HardwareDataManagement

        java:app/HemisCoreClient/HardwareDataManagement

        java:module/HardwareDataManagement

       

      How I tried to get ejb within jar file:

       

      ContextUtils.getInstance().getCtx().lookup("java:Hemis/HemisCoreClient//"+ "HardwareDataManagement" + "!" + "com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement");

       

      ContextUtils class:

       

      public class ContextUtils

      {

        private Context ctx;

       

       

        private ContextUtils()

        {

        Properties jndiProps = new Properties();

        jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

        jndiProps.put("jboss.naming.client.ejb.context", true);

       

        try

        {

        ctx = new InitialContext(jndiProps);

        }

        catch (Exception ex)

        {

        ex.printStackTrace();

        }

        }

       

        private static class ContextUtilsHolder

        {

        private final static ContextUtils instance = new ContextUtils();

        }

       

        public static ContextUtils getInstance()

        {

        return ContextUtilsHolder.instance;

        }

       

        public Context getCtx()

        {

        return ctx;

        }

      }

       

      The log error when I try to connect client to the broker:

       

      17:26:15,555 ERROR [stderr] (qtp1869699331-251) javax.naming.NameNotFoundException; remaining name 'java:Hemis/HemisCoreClient//HardwareDataManagement!com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement'

      17:26:15,556 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.jndi.local.localContextRoot.lookup(localContextRoot.java:490)

      17:26:15,557 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.jndi.local.localContextRoot.lookup(localContextRoot.java:536)

      17:26:15,557 ERROR [stderr] (qtp1869699331-251) at javax.naming.InitialContext.lookup(InitialContext.java:411)

      17:26:15,558 ERROR [stderr] (qtp1869699331-251) at authentification.TokenAuthentificationBroker.addConnection(TokenAuthentificationBroker.java:46)

      17:26:15,558 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:97)

      17:26:15,558 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:733)

      17:26:15,559 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:79)

      17:26:15,559 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139)

      17:26:15,560 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:292)

      17:26:15,561 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:149)

      17:26:15,562 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)

      17:26:15,562 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.transport.ws.MQTTSocket.sendToActiveMQ(MQTTSocket.java:112)

      17:26:15,563 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.sendToActiveMQ(MQTTProtocolConverter.java:133)

      17:26:15,564 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTConnect(MQTTProtocolConverter.java:235)

      17:26:15,564 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTCommand(MQTTProtocolConverter.java:157)

      17:26:15,566 ERROR [stderr] (qtp1869699331-251) at org.apache.activemq.transport.ws.MQTTSocket.onMessage(MQTTSocket.java:59)

      17:26:15,566 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:860)

      17:26:15,567 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)

      17:26:15,568 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)

      17:26:15,568 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)

      17:26:15,569 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

      17:26:15,571 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)

      17:26:15,571 ERROR [stderr] (qtp1869699331-251) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

      17:26:15,572 ERROR [stderr] (qtp1869699331-251) at java.lang.Thread.run(Thread.java:745)

       

      Am I getting the naming exception because I have error in my code and I am not using the right method, or is it because I try to get jboss ejb from jar placed into deployed rar file?
      Could someone help me with this ?