Problem in accessing JNDI over HTTP
jjboss_user Nov 18, 2005 3:21 AMIam facing a timeout problem when trying to access JBoss JNDI over HTTP.
Have any come come across this issue???????. If so please help...
The details are given below
Requirement:
Need to access RMIAdaptor by doing JNDI naming service lookup over HTTP. Followed the steps specified below.
http://docs.jboss.com/jbossas/admindevel326/html/ch3.chapter.html#ch3.accessingjndi
JBoss System information:
JBoss version: 4.0.2
JBoss have multiple ip. One internal ip and another external ip. Only the internal ip is visible to the JNDI Client program.
Modification done in http-invoker.sar:
I modified jboss-service.xml and replaced InvokerURLPrefix,InvokerURLSuffix and UseHostName with single attribute InvokerURL pointing to http://internalidp:8080/invoker/...InvokerClass..
The JBoss client program is given below
public static void main(String args[]) throws Exception { String host = args[0]; String port = args[1]; Properties env = new Properties(); env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory"); env.setProperty(Context.PROVIDER_URL, "http://"+host+":"+port+"/invoker/JNDIFactory"); Context ctx = new InitialContext(env); System.out.println("Created InitialContext, env=" + env); Object data = ctx.lookup("jmx/invoker/RMIAdaptor"); System.out.println("lookup(jmx/invoker/RMIAdaptor): " + data); // System.out.println("Obtained : " + data.getClass().getName()); System.out.println("Total number of MBeans in JBoss server : "+((org.jboss.jmx.adaptor.rmi.RMIAdaptor)data).getMBeanCount()); }
The above code looksup MBeanServer. The below exception appears while doing the lookup opertaion
Operation failed [Root exception is java.rmi.ServerException: IOE; nested exception is: java.net.ConnectException: Connection timed out] at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInter ceptor.java:50) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55) at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.j ava:59) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86) at $Proxy0.lookup(Unknown Source)
Please note that Iam able to access internalip:<jboss port> from the machine in which my client program is running.
Additional Information:
Iam able to access http://<JBoss internalip>:8080/invoker/JNDIFactory from the client machine.
The complete trace is given below
java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory} Exception in thread "main" javax.naming.CommunicationException: Operation failed [Root exception is java.rmi.ServerException: IOE; nested exception is: java.net.ConnectException: Connection timed out] at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInter ceptor.java:50) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55) at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.j ava:59) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86) at $Proxy0.lookup(Unknown Source) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572) at javax.naming.InitialContext.lookup(Unknown Source) at org.jboss.chap3.ex1.ExClient.main(ExClient.java:23) Caused by: java.rmi.ServerException: IOE; nested exception is: java.net.ConnectException: Connection timed out at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvoker Proxy.java:118) at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor .java:227) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:1 67) at org.jboss.naming.interceptors.ExceptionInterceptor.invoke(ExceptionInter ceptor.java:42) ... 8 more Caused by: java.net.ConnectException: Connection timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.<init>(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source) at org.jboss.invocation.http.interfaces.Util.invoke(Util.java:145) at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvoker Proxy.java:103) ... 11 more