2 Replies Latest reply on Apr 15, 2007 3:22 AM by eeldor

    Accessing EJB through HTTPS Invoker

    eeldor

      Hi,

      I'm trying to access ejb3 beans through RMI over HTTP using jboss4 app server.

      these are the configurations I did:
      1) I've configured my jndi.properties with the following:

      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
      java.naming.provider.url=http://localhost:1099/invoker/JNDIFactory

      2) configured the deploy/http-invoker.sar/META-INF/jboss-service.xml and http-invoker.war/WEB-INF/web.xml as written in the jboss tutorial.

      BUT, in the client's main, when reaching the
      context = new InitialContext();

      I get the following exception:

      javax.naming.NamingException: Failed to retrieve Naming interface [Root exception is java.lang.ClassCastException: java.rmi.MarshalledObject]
      at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:84)
      at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
      at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
      at javax.naming.InitialContext.init(Unknown Source)
      at javax.naming.InitialContext.(Unknown Source)
      at test.lib.Ejb3Client.createContext(Ejb3Client.java:178)
      at test.lib.Ejb3Client.main(Ejb3Client.java:199)
      Caused by: java.lang.ClassCastException: java.rmi.MarshalledObject
      at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:135)
      at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:80)
      ... 6 more
      Exception in thread "main" java.lang.RuntimeException: javax.naming.NamingException: Failed to retrieve Naming interface [Root exception is java.lang.ClassCastException: java.rmi.MarshalledObject]
      at test.lib.Ejb3Client.createContext(Ejb3Client.java:187)
      at test.lib.Ejb3Client.main(Ejb3Client.java:199)
      Caused by: javax.naming.NamingException: Failed to retrieve Naming interface [Root exception is java.lang.ClassCastException: java.rmi.MarshalledObject]
      at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:84)
      at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
      at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
      at javax.naming.InitialContext.init(Unknown Source)
      at javax.naming.InitialContext.(Unknown Source)
      at test.lib.Ejb3Client.createContext(Ejb3Client.java:178)
      ... 1 more
      Caused by: java.lang.ClassCastException: java.rmi.MarshalledObject
      at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:135)
      at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:80)
      ... 6 more


      does anyone has a clue about the problem?

      regards,
      Elad

        • 1. Re:  Accessing EJB through HTTPS Invoker
          slevy

          I think you should use port 8080 instead of 1099 for the JNDIFactory HTTP invocation (it is a servlet) :
          java.naming.provider.url=http://localhost:8080/invoker/JNDIFactory

          • 2. Re:  Accessing EJB through HTTPS Invoker
            eeldor

            Hi slevy,

            I've already solved this a while ago, but in any case - you're right.
            the configuration of RMI over HTTP can be done in the client side by setting the following properties:

            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
            java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
            java.naming.provider.url=http://localhost:8080/invoker/JNDIFactory

            there's no need to configure any ports in the /http-invoker.sar/META-INF/jboss-service.xml (unlike some tutorials state).

            hope this helps others that have the same problem.

            Elad