0 Replies Latest reply on Mar 22, 2005 7:59 PM by George Berish

    Desperate for a hint.  JNDI over HTTP

    George Berish Novice

      Can anyone help me understand why the code below fails?

      I tired to get an instance of InitialContext over HTTP per chapter of the JBoss 4 Application Server Guide at:

      You will find below:
      1.The code which should run on any current out of the box jboss server.
      2.The Screen Print from that code.
      3. Info on JMXInvokerServlet from the web-console that show it is being accessed on each failure.
      4. Relevant exerpts from chapter

      I obviously am missing something very basic, and would sure appreciate a hint of where else to look.

      import java.lang.reflect.Method;
      import java.util.Hashtable;
      import javax.jms.*;
      import javax.naming.*;
      public class Test {
       public static void main (String[] args) {
       Test test = new Test ();
       test.doMessage ();
       // method
       public void doMessage () {
       try {
       // get initial context
       Hashtable<String, String> env= new Hashtable<String, String> ();
       p ("Calling InitialContext");
       ctx = new InitialContext(env);
       p ("InitialContext Found");
       } catch (NamingException e) {
       p ("\nNaming Exception");
       p (" Explanation: " + "\n " + e.getExplanation() + "\n");
       p (" Resolved Name: " + "\n " + e.getResolvedName() + "\n");
       p (" RemaingingName: " + "\n " + e.getRemainingName() + "\n");
       p (" Root Cause: " + "\n " +e.getRootCause() + "\n");
       p (" Stack Trace: ");
       e.printStackTrace ();
       } finally {
       if (connection != null) {
       try {
       connection.stop ();
       } catch (JMSException e) {
       System.out.println("\nmain () End:");
       void p (String s) {
       System.out.println (s);
       // members
       Context ctx;
       Queue destination;
       QueueConnection connection;
       QueueConnectionFactory factory;
       QueueReceiver receiver;
       QueueSession session;
       QueueSender sender;
       TextMessage message;
      Calling InitialContext
      Naming Exception
       Failed to retrieve Naming interface
       Resolved Name:
       Root Cause:
       java.io.IOException: Invalid reply content seen: class org.jboss.invocation.InvocationException
       Stack Trace:
      javax.naming.NamingException: Failed to retrieve Naming interface [Root exception is java.io.IOExcep
      tion: Invalid reply content seen: class org.jboss.invocation.InvocationException]
       at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java
       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 Test.doMessage(Test.java:38)
       at Test.main(Test.java:22)
      Caused by: java.io.IOException: Invalid reply content seen: class org.jboss.invocation.InvocationExc
       at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:1
       at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java
       ... 6 more
      main () End:
      Press any key to continue . . .
      JBoss Web-Server Info for JMXInvokerServlet:
      Name: JMXInvokerServlet
      Servlet Statistics:
      Min (ms)| Max (ms) | Average (ms) | Total (ms) | # Invocations|
       0 | 20 | 12.5 | 100 | 8 |
      The HTTP InitialContext Factory Implementation The JNDI naming service can be accessed over HTTP.
      The complete set of support InitialContext environment properties for this factory are:
      java.naming.factory.initial: ... must be org.jboss.naming.HttpNamingContextFactory.
      java.naming.provider.url: ...must be ... the public URL of the JBoss servlet container plus /invoker/JMXInvokerServlet. Examples include:
      http://www.jboss.org/invoker/JMXInvokerServlet ...
      I tired both and both fail
      The first example accesses the servlet using the port 8080.
      The second uses the standard HTTP port 80 ...
       java.naming.factory.url.pkgs: ... must be org.jboss.naming:org.jnp.interfaces.
      ...The proxy needs to know what the URL of the bridge servlet is in order to operate...
      If the JBoss web server is sitting behind one or more firewalls It is not ...
      Hope someone can help. I have been lost on this for over a week.