-
1. Re: ejb access from one server to multiple servers
vinaykayjay Jan 23, 2013 2:05 AM (in response to zeppelinux)Hi Dmitry,
Were you able to resolve thsi issue? i am facing the same issue.
would be great if you could help me out.
Thanks,
Vinay
-
2. Re: ejb access from one server to multiple servers
jaikiran Jan 23, 2013 2:10 AM (in response to zeppelinux)What about if my Client Server needs to access EJB's deployed on multiple Destination Servers? Is it supported?
Any related info/docs will be greatly appreciated.
You can configure multiple outbound connections, one each for the destination server and use a receiver for that in your jboss-ejb-client.xml.
-
3. Re: ejb access from one server to multiple servers
vinaykayjay Jan 23, 2013 3:39 AM (in response to jaikiran)Thanks jaikiran,
My issue is i have followed the instructions in the below thread and made the ejb invocations from remote server instance work on Client and Destination servers
deployed on the same machine, but the example does not work when the client and destination servers are running in different machines.
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance
The only change i ve made is remote-destination host on the outbound-socket-binding from localhost to the ip of the destination server.
Is thr anything else which i need to look in to?
Thanks,
Vinay
-
4. Re: ejb access from one server to multiple servers
jaikiran Jan 23, 2013 3:41 AM (in response to vinaykayjay)What exact exceptions do you run into? Please post the relevant stacktraces and the configurations and code.
-
5. Re: ejb access from one server to multiple servers
vinaykayjay Jan 23, 2013 4:00 AM (in response to jaikiran)My code is exactly the same as in the below post
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance
This works fine when both client and destination servers are on same machine.
Now, i ve moved the destination server which contains the ejb's in to another system, i get the below stacktraces when i start my client server.
14:10:42,503 DEBUG [org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService] (MSC service thread 1-2) Failed to create a connection for remote-ejb-connection. A r
econnect handler will be added to the client context: java.lang.RuntimeException: Operation failed with status WAITING
at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:93) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService.createRemotingConnections(DescriptorBasedEJBClientContextService.java:140) [jboss-as-ejb3-7.1.1
.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService.start(DescriptorBasedEJBClientContextService.java:101) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Fin
al]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_12]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_12]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_12]
14:10:42,534 DEBUG [org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService] (MSC service thread 1-2) Added 0 remoting EJB receivers to descriptor based EJB clien
t context named service jboss.ejb3.dd-based-ejb-client-context."ejbweb-1.0.war"
When i try to invoke the ejb from my client i get the below exceptions
14:15:16,415 DEBUG [org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService] (ejb-client-remote-connection-reconnect-3-thread-1) Reconnect attempt#1 failed for ou
tbound connection service jboss.remoting.endpoint.subsystem.outbound-connection.remote-ejb-connection: java.lang.RuntimeException: Operation failed with status WAITING
at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:93) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.as.ejb3.remote.DescriptorBasedEJBClientContextService$OutboundConnectionReconnectHandler.reconnect(DescriptorBasedEJBClientContextService.java:187) [
jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.ejb.client.EJBClientContext$ReconnectAttempt.run(EJBClientContext.java:961) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_12]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_12]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_12]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_12]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_12]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_12]
14:15:16,458 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ejbweb].[jsp]] (http--127.0.0.1-8180-1) Servlet.service() for servlet jsp threw ex
ception: java.lang.IllegalStateException: No EJB receiver available for handling [appName:remoteEJB-1.0,modulename:ejbbean-1.0,distinctname:] combination for invocation c
ontext org.jboss.ejb.client.EJBClientInvocationContext@b8dfdf
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at $Proxy13.greet(Unknown Source) at org.myapp.ejb.EJBApplicationClient.invokeOnBean(EJBApplicationClient.java:27) [ejbclient-1.0.jar:]
at org.myapp.ejb.EJBApplicationClient.callme(EJBApplicationClient.java:9) [ejbclient-1.0.jar:]
at org.apache.jsp.test_jsp._jspService(test_jsp.java:57)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_12]
in my client standalone-full.xml the utbound-socket-binding i ve pointed to the destination server ip instead of localhost
<outbound-socket-binding name="remote-ejb">
<remote-destination host="192.168.1.XX" port="4447"/>
</outbound-socket-binding>
Thanks,
Vinay
-
6. Re: ejb access from one server to multiple servers
jaikiran Jan 23, 2013 5:14 AM (in response to vinaykayjay)Is your destination server up when you start the client server?
-
7. Re: ejb access from one server to multiple servers
vinaykayjay Jan 23, 2013 5:31 AM (in response to zeppelinux)Yes its up and running. I can see the JNDI bindings
11:52:28,391 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named GreeterBean in deployment unit subdeployment "ejbbean-1.0.jar" of deployment "remoteEJB-1.0.ear" are as follows:
java:global/remoteEJB-1.0/ejbbean-1.0/GreeterBean!org.myapp.ejb.Greeter
java:app/ejbbean-1.0/GreeterBean!org.myapp.ejb.Greeter
java:module/GreeterBean!org.myapp.ejb.Greeter
java:jboss/exported/remoteEJB-1.0/ejbbean-1.0/GreeterBean!org.myapp.ejb.Greeter
java:global/remoteEJB-1.0/ejbbean-1.0/GreeterBean
java:app/ejbbean-1.0/GreeterBean
java:module/GreeterBean
Thanks,
Vinay
-
8. Re: ejb access from one server to multiple servers
clichybi Jan 23, 2013 5:42 AM (in response to vinaykayjay)Hi,
can you share the standalone.xml of the remote server?
I guess it works on localhost because you're using default ApplicationRealm with <local default-user="$local" allowed-users="*"/>, as this is my favorit trap.
-
9. Re: ejb access from one server to multiple servers
vinaykayjay Jan 23, 2013 6:04 AM (in response to clichybi)Hi Carsten,
Attached both my client and destination standalone-full.xml's.
Thanks,
Vinay
-
standalone-full-destination.xml 19.9 KB
-
standalone-full-client.xml 20.8 KB
-
-
10. Re: ejb access from one server to multiple servers
clichybi Jan 23, 2013 6:26 AM (in response to vinaykayjay)Hi Vinay,
I see two differences to my setup:
- Up to your stacktrace your on AS7.1.1, while I'm using AS7.1.3 - my make difference
- Your security domain also uses the Remoting login module - I don't have configured.
I don't know whether one of these makes the difference.
-
11. Re: ejb access from one server to multiple servers
vinaykayjay Jan 23, 2013 6:46 AM (in response to clichybi)Thanks Carsten, i am still not able to figure out the issue
Also, find the below trace when i start the client server
17:07:23,217 TRACE [org.jboss.remoting.remote] (ejb-client-remote-connection-reconnect-3-thread-1) Attempting to connect to "/192.168.1.XX:4447" with options {org.xnio.O
ptions.SASL_POLICY_NOANONYMOUS=>false,org.xnio.Options.SASL_DISALLOWED_MECHANISMS=>[JBOSS-LOCAL-USER],org.xnio.Options.SSL_STARTTLS=>true,org.xnio.Options.SSL_ENABLED=>tr
ue,org.xnio.Options.SASL_POLICY_NOPLAINTEXT=>false}
I find that SSL_ENABLED=>true, even though i have set the properties as false in the client standalone
<subsystem xmlns="urn:jboss:domain:remoting:1.1">
<connector name="remoting-connector" socket-binding="remoting" security-realm="ejb-security-realm"/>
<outbound-connections>
<remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-ejb" username="ejb" security-realm="ejb-security-realm">
<properties>
<property name="SASL_POLICY_NOANONYMOUS" value="false"/>
<property name="SSL_ENABLED" value="false"/>
</properties>
</remote-outbound-connection>
</outbound-connections>
</subsystem>
Is this a matter of concern?
Thanks,
Vinay
-
12. Re: ejb access from one server to multiple servers
zeppelinux Jan 23, 2013 3:04 PM (in response to jaikiran)You can configure multiple outbound connections, one each for the destination server and use a receiver for that in your jboss-ejb-client.xml.
If there are multiple conections configured, how client will find the 'right' one?
Does it make sense to put 'most often used' connections on the top of the list or it has no effect?
If order can affect the performance, will client process the connections using the order specified in jboss-ejb-client.xml (or somewhere else)?
-
13. Re: ejb access from one server to multiple servers
jaikiran Jan 24, 2013 1:19 AM (in response to zeppelinux)Dmitry Shultz wrote:
If there are multiple conections configured, how client will find the 'right' one?
The "right" EJB receiver is selected using an algorithm in the EJB client library. Each EJB is identified by a combination of app name, module name, distinct name and bean name. When an EJB request is handled by the EJB client library, it looks for EJB receiver(s), within the EJB client context, which can handle that EJB (identified by the criteria that I mentioned). If more than one EJB receiver can handle that same request then the library uses an implementation of org.jboss.ejb.client.DeploymentNodeSelector http://docs.jboss.org/ejbclient/1.0.5.Final/org/jboss/ejb/client/DeploymentNodeSelector.html applicable for that EJB client context. By default (in a standalone client environment), a random node selector is plugged in, into the context, so that a random node is selected. In an AS7 environment, a "local node preferring" node selector is plugged in, which selects "itself" as the receiver which can handle that request.
Now if you want to make sure that the request is handled by a specific node, then you have 2 options (depending on the use case):
1) Use a different distinct name for your EJB deployment on a specific server - This one makes sense if the implementations of the EJBs are different on different nodes.
2) Plugin your own implementation of a deployment node selector and implement the logic that you desire. Here's an example https://github.com/jbossas/jboss-as/blob/master/build/src/main/resources/docs/schema/jboss-ejb-client_1_2.xsd#L84
-
14. Re: ejb access from one server to multiple servers
jaikiran Jan 24, 2013 1:21 AM (in response to vinaykayjay)Vinay, what does the following command return:
telnet 192.168.1.XX 4447
from the client server? Are there any firewalls in place?