Trying to connect to JNDI remotely, but get exception with description "Server redirected too many times"
Issue
Customer has JBoss running on their local machine. When they go to a browser and type in http://localhost:8080/invoker/JNDIFactory, the browser download a file named JNDIFactory.
But when they try to configure a client to use that URL via JNDI http initialfactory implementation, they keep getting
javax.naming.NamingException: Failed to retrieve Naming interface for provider http://10.10.117.60:8080/invoker/JNDIFactory [Root exception is java.net.ProtocolException: Server redirected too many times (20)]
at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:96)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at org.jboss.soa.esb.samples.quickstart.helloworldaction.test.SendJMSMessage.setupConnection(SendJMSMessage.java:52)
at org.jboss.soa.esb.samples.quickstart.helloworldaction.test.SendJMSMessage.main(SendJMSMessage.java:89)
Caused by: java.net.ProtocolException: Server redirected too many times (20)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1496)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1490)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1144)
at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:209)
at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:92)
... 6 more
Caused by: java.net.ProtocolException: Server redirected too many times (20)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1451)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2301)
at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:579)
at java.net.URLConnection.getContentLength(URLConnection.java:474)
at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:204)
... 7 more
Environment
- JBoss EAP 5.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
