You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by aragoubi <ay...@gmail.com> on 2017/06/02 11:17:13 UTC

Getting jboss ejb in ativemq rar deployed within jboss

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.

* This is how I tried to get ejb within jar file:* 

  Context ctx;
  Properties jndiProps = new Properties();
  jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
  jndiProps.put("jboss.naming.client.ejb.context", true);
  ctx = new InitialContext(jndiProps);
  Ctx.lookup("ejb:Hemis/HemisCoreClient//"+ "HardwareDataManagement" + "!" +
"com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement");

*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

*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)
 

*Why activemq is looking to jndi always in jetty jndi localContext? How
could I resolve this?
Could someone help me?*





--
View this message in context: http://activemq.2283324.n4.nabble.com/Getting-jboss-ejb-in-ativemq-rar-deployed-within-jboss-tp4726930.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Getting jboss ejb in ativemq rar deployed within jboss

Posted by Tim Bain <tb...@alumni.duke.edu>.
You wrote code that does a JNDI lookup that fails; there's nothing
ActiveMQ-related about that. If someone here can help, that's great, but
this isn't where the JBoss/JEE experts hang out, so definitely post your
question other places. And if you haven't posted to StackOverflow yet, you
should; there are lots of people who know lots of things (including JBoss
and JEE) there.

Tim

On Jun 4, 2017 9:00 AM, "aragoubi" <ay...@gmail.com> wrote:

I post my question in activemq forum because I have a doupt that activemq is
always looking for JNDI beans within jetty server.
I asked also in jboss forum but unfortunately I didn't get any response.



--
View this message in context: http://activemq.2283324.n4.
nabble.com/Getting-jboss-ejb-in-ativemq-rar-deployed-within-jboss-
tp4726930p4726999.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Getting jboss ejb in ativemq rar deployed within jboss

Posted by aragoubi <ay...@gmail.com>.
I post my question in activemq forum because I have a doupt that activemq is
always looking for JNDI beans within jetty server.
I asked also in jboss forum but unfortunately I didn't get any response.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Getting-jboss-ejb-in-ativemq-rar-deployed-within-jboss-tp4726930p4726999.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Getting jboss ejb in ativemq rar deployed within jboss

Posted by Tim Bain <tb...@alumni.duke.edu>.
The one thing I notice is that the string you're trying to look up doesn't
exactly match any of the names your log says the bean is exposed as. I
don't know enough about EJBs, JNDI, and JBoss to know if that's
significant.

Your question is about JBoss and JNDI not ActiveMQ, so you'll probably have
better luck asking it on the JBoss mailing list.

Tim

On Jun 2, 2017 8:06 AM, "aragoubi" <ay...@gmail.com> wrote:

Hi Tim,
TokenAuthentificationBroker is a class used to intercept the client
connection to get the username(The token for me). It's the same thing as
MyBroker class here  http://activemq.apache.org/interceptors.html
<http://activemq.apache.org/interceptors.html>  .

Within the addConnection function, I get the client userName(the token), and
then I try to get an EJB exposed by an project deployed as an ear into my
jboss. I need the EJB to verify the token.

Yes it's my code, and until now I am trying just to get the EJB from the
addConnection funtion which is in a jar placed into the activemq rar
deployed within my jboss server.





--
View this message in context: http://activemq.2283324.n4.
nabble.com/Getting-jboss-ejb-in-ativemq-rar-deployed-within-jboss-
tp4726930p4726936.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Getting jboss ejb in ativemq rar deployed within jboss

Posted by aragoubi <ay...@gmail.com>.
Hi Tim,
TokenAuthentificationBroker is a class used to intercept the client
connection to get the username(The token for me). It's the same thing as
MyBroker class here  http://activemq.apache.org/interceptors.html
<http://activemq.apache.org/interceptors.html>  .

Within the addConnection function, I get the client userName(the token), and
then I try to get an EJB exposed by an project deployed as an ear into my
jboss. I need the EJB to verify the token.

Yes it's my code, and until now I am trying just to get the EJB from the
addConnection funtion which is in a jar placed into the activemq rar
deployed within my jboss server.

 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Getting-jboss-ejb-in-ativemq-rar-deployed-within-jboss-tp4726930p4726936.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Getting jboss ejb in ativemq rar deployed within jboss

Posted by Tim Bain <tb...@alumni.duke.edu>.
What's TokenAuthentificationBroker, where the exception is occurring? Is
that your code? What's it doing around that line that's causing a JNDI
lookup?

On Jun 2, 2017 5:32 AM, "aragoubi" <ay...@gmail.com> wrote:

> 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.
>
> * This is how I tried to get ejb within jar file:*
>
>   Context ctx;
>   Properties jndiProps = new Properties();
>   jndiProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
>   jndiProps.put("jboss.naming.client.ejb.context", true);
>   ctx = new InitialContext(jndiProps);
>   Ctx.lookup("ejb:Hemis/HemisCoreClient//"+ "HardwareDataManagement" +
> "!" +
> "com.ubiant.hemis.client.ejb.interf.I_HardwareDataManagement");
>
> *Log from jboss when ejb is exposed :*
>
> 11:50:17,538 INFO
> [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitP
> rocessor]
> (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
>
> *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)
>
>
> *Why activemq is looking to jndi always in jetty jndi localContext? How
> could I resolve this?
> Could someone help me?*
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Getting-jboss-ejb-in-ativemq-rar-deployed-
> within-jboss-tp4726930.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>