4 Replies Latest reply on Jun 21, 2017 8:46 AM by Aymen Ragoubi

    Getting ejb from remote jboss AS7.1 server

    Aymen Ragoubi Newbie

      I am trying to get an exposed ejb from a remote jboss AS7.1 server:

       

      final Properties jndiProperties = new Properties();

      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

      jndiProperties.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447");

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

      jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");

      jndiProperties.put(Context.SECURITY_PRINCIPAL, "ubiant");

      jndiProperties.put(Context.SECURITY_CREDENTIALS, "ubiant2iA");

      ctx = new InitialContext(jndiProperties);

       

      Object b = ctx.lookup("ejb:Hemis/HemisCoreClient//" + "HardwareDataManagement" + "!" + "com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement");

       

      But I am getting this error :

       

      17:44:36,279 INFO  [org.xnio] (qtp1400971178-118) XNIO Version 3.0.3.GA

      17:44:36,279 INFO  [org.xnio.nio] (qtp1400971178-118) XNIO NIO Implementation Version 3.0.3.GA

      17:44:36,279 INFO  [org.jboss.remoting] (qtp1400971178-118) JBoss Remoting version 3.2.3.GA

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Failed to setup EJB remote context]

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at javax.naming.InitialContext.init(InitialContext.java:242)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at javax.naming.InitialContext.<init>(InitialContext.java:216)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at authentification.TokenAuthentificationBroker.addConnection(TokenAuthentificationBroker.java:85)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrokerFilter.java:97)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.broker.TransportConnection.processAddConnection(TransportConnection.java:733)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConnection(ManagedTransportConnection.java:79)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:139)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:292)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:149)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.transport.ws.MQTTSocket.sendToActiveMQ(MQTTSocket.java:112)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.sendToActiveMQ(MQTTProtocolConverter.java:133)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTConnect(MQTTProtocolConverter.java:235)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.transport.mqtt.MQTTProtocolConverter.onMQTTCommand(MQTTProtocolConverter.java:157)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.apache.activemq.transport.ws.MQTTSocket.onMessage(MQTTSocket.java:59)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.eclipse.jetty.websocket.WebSocketConnectionRFC6455$WSFrameHandler.onFrame(WebSocketConnectionRFC6455.java:860)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.eclipse.jetty.websocket.WebSocketParserRFC6455.parseNext(WebSocketParserRFC6455.java:349)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.eclipse.jetty.websocket.WebSocketConnectionRFC6455.handle(WebSocketConnectionRFC6455.java:225)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

      17:44:36,420 ERROR [stderr] (qtp1400971178-118) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at java.lang.Thread.run(Thread.java:745)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) Caused by: java.lang.RuntimeException: Failed to setup EJB remote context

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:438)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:115)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) ... 25 more

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) Caused by: java.lang.reflect.InvocationTargetException

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at java.lang.reflect.Method.invoke(Method.java:606)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:420)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) ... 26 more

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) Caused by: java.lang.SecurityException: EJB client context selector may not be changed

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at org.jboss.ejb.client.EJBClientContext.setSelector(EJBClientContext.java:181)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.setupSelector(RemoteNamingEjbClientContextSelector.java:18)

      17:44:36,435 ERROR [stderr] (qtp1400971178-118) ... 31 more

       

      Could someone help me with this ?