2 Replies Latest reply on Aug 19, 2006 1:05 AM by jwcone

    JNDI/HTTP/4.0.4GA

      I'm getting a java.io.EOFException on the server when trying to use JNDI over HTTP.

      I'm trying to get an InitialContext using:

      Properties prop = new Properties();
      prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,
       "org.jboss.naming.HttpNamingContextFactory");
      prop.setProperty(Context.PROVIDER_URL,
       "http://192.168.1.4:8080/invoker/JMXInvokerServlet");
      prop.setProperty(Context.URL_PKG_PREFIXES,
       "org.jboss.naming:org.jnp.interfaces");
      Context ctx = new InitialContext(prop);


      The server configuration is set up like this:

      <!-- 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="InvokerURLPrefix">http://</attribute>
       <attribute name="InvokerURLSuffix">:8080/invoker/JMXInvokerServlet</attribute>
       <attribute name="UseHostName">true</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>


      The client throws this exception when trying to get the InitialContext:

      javax.naming.NamingException: Failed to retrieve Naming interface [Root exception is java.io.IOException: Invalid reply content seen: class org.jboss.invocation.InvocationException]
       at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:84)
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
       at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
       at javax.naming.InitialContext.init(InitialContext.java:223)
       at javax.naming.InitialContext.<init>(InitialContext.java:197)
       at com.centerforce.ClientTestUI.initMessaging(ClientTestUI.java:37)
       at com.centerforce.ClientTestUI.<init>(ClientTestUI.java:25)
       at com.centerforce.ClientTestUI$1.run(ClientTestUI.java:105)
       at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
       at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
      Caused by: java.io.IOException: Invalid reply content seen: class org.jboss.invocation.InvocationException
       at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:153)
       at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:80)
       ... 14 more


      Any help is appreciated.

        • 1. Re: JNDI/HTTP/4.0.4GA

          Instead of specifying the properties with the InitialContext constructor, I tried using a jndi.properties file. Using jndi.properties worked.

          • 2. Re: JNDI/HTTP/4.0.4GA

            Crap. I take it back -- it's still not working. I thought it was okay, but it was just creating a default (i.e. empty) InitialContext. As soon as I tried a lookup it failed, again, with the NamingException I listed, above.