[jboss-user] [JNDI/Naming/Network] - How to Access EJB over HTTP in remote machine?
ritesh163
do-not-reply at jboss.com
Mon Jun 23 02:42:53 EDT 2008
hello everybody,
I am having problem to access EJB over HTTP in remote machine. I have to access EJB which is running in remote server. In between two EJBs, there is routing IP as these are running in different network connected by radio link. I am given with routing IP to connect with remote EJB by my client, that routing IP will map to remote EJB server.
Remote EJB server is running in [internal IP] and I have to connect remote EJB with [Routing IP or External IP]. Can I access this remote EJB over HTTP?
I am using JBoss-4.0.4.GA and Java version: 1.5.0_15. OS: RHEL 4.
If I access the web page through my server by "http://[routing IP]:[port]" then welcome screen of Jboss is displayed but through application, the connection is not found.
The code of client's remote machine for http-invoker.sar\META-INF\jboss-service.xml is given below:
| <server>
|
| <!-- The HTTP invoker service configration
| -->
| <mbean code="org.jboss.invocation.http.server.HttpInvoker"
| name="jboss:service=invoker,type=http">
| <!-- Use a URL of the form http://<hostname>:8080/invoker/EJBInvokerServlet
| where <hostname> is InetAddress.getHostname value on which the server
| is running.
|
| -->
|
| <attribute name="InvokerURL">http://[Internal IP]:[port]/invoker/EJBInvokerServlet</attribute>
| <attribute name="InvokerURLPrefix">http://</attribute>
| <attribute name="InvokerURLSuffix">:8080/invoker/EJBInvokerServlet</attribute>
| <attribute name="UseHostName">false</attribute>
| </mbean>
|
| <!-- Expose the Naming service interface via HTTP -->
| <mbean code="org.jboss.invocation.http.server.HttpProxyFactory"
| name="jboss:service=invoker,type=http,target=Naming">
| <!-- The Naming service we are proxying -->
| <attribute name="InvokerName">jboss:service=Naming</attribute>
| <!-- Compose the invoker URL from the cluster node address -->
| <!--
| -->
| <attribute name="InvokerURL">http://[Internal IP]:[port]/invoker/JMXInvokerServlet</attribute>
| <attribute name="InvokerURLPrefix">http://</attribute>
| <attribute name="InvokerURLSuffix">:8080/invoker/JMXInvokerServlet</attribute>
| <attribute name="UseHostName">false</attribute>
|
| <attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute>
| <attribute name="JndiName"></attribute>
| <attribute name="ClientInterceptors">
| <interceptors>
| <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
| <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
| <interceptor>org.jboss.naming.interceptors.ExceptionInterceptor</interceptor>
| <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
| </interceptors>
| </attribute>
| </mbean>
|
| <!-- Expose the Naming service interface via clustered HTTP. This maps
| to the ReadOnlyJNDIFactory servlet URL
| -->
| <mbean code="org.jboss.invocation.http.server.HttpProxyFactory"
| name="jboss:service=invoker,type=http,target=Naming,readonly=true">
| <attribute name="InvokerURL">http://[Internal IP]:[port]/invoker/JMXInvokerServlet</attribute>
| <attribute name="InvokerName">jboss:service=Naming</attribute>
| <attribute name="InvokerURLPrefix">http://</attribute>
| <attribute name="InvokerURLSuffix">:8080/invoker/readonly/JMXInvokerServlet</attribute>
| <attribute name="UseHostName">false</attribute>
| <attribute name="ExportedInterface">org.jnp.interfaces.Naming</attribute>
| <attribute name="JndiName"></attribute>
| <attribute name="ClientInterceptors">
| <interceptors>
| <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
| <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor>
| <interceptor>org.jboss.naming.interceptors.ExceptionInterceptor</interceptor>
| <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
| </interceptors>
| </attribute>
| </mbean>
| </server>
|
|
Also connecting code of my server is given below:
| props.put("java.naming.factory.initial",
| "org.jboss.naming.HttpNamingContextFactory");
| props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
| props.put("java.naming.provider.url", "http://" + routingIP + ":"
| + port+ "/invoker/JNDIFactory");
|
| InitialContext ic = new InitialContext(props);
| Object objRef = ic.lookup("ejb/EjbTxn");
| ejbTxnHome home = (ejbTxnHome) PortableRemoteObject.narrow(
| objRef, ejbTxnHome.class);
| ejbTxn = home.create();
|
Will I have to use invoker in my server also or not? Error that occur during connection is also given below:
| 16:45:52,869 INFO [STDOUT] Unable to lookup home: ejbTxnHome Operation failed
| 16:45:52,869 ERROR [STDERR] javax.naming.CommunicationException: Operation failed [Root exception is java.rmi.ServerException: IOE; nested exception is:
| java.net.ConnectException: Connection timed out]
| 16:45:52,870 ERROR [STDERR] at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:65)
| 16:45:52,870 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
| 16:45:52,870 ERROR [STDERR] at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
| 16:45:52,870 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
| 16:45:52,870 ERROR [STDERR] at $Proxy65.lookup(Unknown Source)
| 16:45:52,870 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
| 16:45:52,870 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| 16:45:52,870 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
| 16:45:52,870 ERROR [STDERR] at org.apache.jsp.trans_005fdetail_jsp.getNpgTxn(trans_005fdetail_jsp.java:124)
| 16:45:52,870 ERROR [STDERR] at org.apache.jsp.trans_005fdetail_jsp._jspService(trans_005fdetail_jsp.java:722)
| 16:45:52,870 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| 16:45:52,871 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| 16:45:52,871 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
| 16:45:52,871 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
| 16:45:52,871 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
| 16:45:52,871 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| 16:45:52,871 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| 16:45:52,871 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 16:45:52,871 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| 16:45:52,871 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 16:45:52,871 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| 16:45:52,871 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| 16:45:52,871 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| 16:45:52,871 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| 16:45:52,872 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
| 16:45:52,872 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| 16:45:52,872 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| 16:45:52,872 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| 16:45:52,872 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| 16:45:52,872 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| 16:45:52,872 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| 16:45:52,872 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| 16:45:52,872 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| 16:45:52,872 ERROR [STDERR] at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
| 16:45:52,872 ERROR [STDERR] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
| 16:45:52,872 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
| 16:45:52,873 ERROR [STDERR] Caused by: java.rmi.ServerException: IOE; nested exception is:
| java.net.ConnectException: Connection timed out
| 16:45:52,873 ERROR [STDERR] at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvokerProxy.java:133)
| 16:45:52,873 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:331)
| 16:45:52,873 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:194)
| 16:45:52,873 ERROR [STDERR] at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInterceptor.java:57)
| 16:45:52,873 ERROR [STDERR] ... 35 more
| 16:45:52,874 ERROR [STDERR] Caused by: java.net.ConnectException: Connection timed out
| 16:45:52,874 ERROR [STDERR] at java.net.PlainSocketImpl.socketConnect(Native Method)
| 16:45:52,874 ERROR [STDERR] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
| 16:45:52,874 ERROR [STDERR] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
| 16:45:52,874 ERROR [STDERR] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
| 16:45:52,874 ERROR [STDERR] at java.net.Socket.connect(Socket.java:520)
| 16:45:52,874 ERROR [STDERR] at java.net.Socket.connect(Socket.java:470)
| 16:45:52,874 ERROR [STDERR] at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
| 16:45:52,874 ERROR [STDERR] at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
| 16:45:52,874 ERROR [STDERR] at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
| 16:45:52,874 ERROR [STDERR] at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
| 16:45:52,874 ERROR [STDERR] at sun.net.www.http.HttpClient.New(HttpClient.java:304)
| 16:45:52,874 ERROR [STDERR] at sun.net.www.http.HttpClient.New(HttpClient.java:321)
| 16:45:52,874 ERROR [STDERR] at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:813)
| 16:45:52,875 ERROR [STDERR] at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:765)
| 16:45:52,875 ERROR [STDERR] at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:690)
| 16:45:52,875 ERROR [STDERR] at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:857)
| 16:45:52,875 ERROR [STDERR] at org.jboss.invocation.http.interfaces.Util.invoke(Util.java:163)
| 16:45:52,875 ERROR [STDERR] at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvokerProxy.java:118)
| 16:45:52,875 ERROR [STDERR] ... 38 more
|
Could anyone tell me how to solve this problem ? If any suggest, please provide it to me.
Thank you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159813#4159813
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159813
More information about the jboss-user
mailing list