7 Replies Latest reply on Dec 13, 2007 9:35 AM by didi1976

    EJB3 over HTTP and Reverse Proxy

    didi1976

      All examples regarding Remoting only work for the simple scenario where a client directly connects to the Server. This configuration is already working (even over HTTP). I used the description in the wiki (http://wiki.jboss.org/wiki/Wiki.jsp?page=Accessing_EJB3s_over_HTTP_HTTPS).

      Our destination scenario looks like:

      Java Client --HTTP(S)--> Reverse Proxy (httpd/mod_proxy) --AJP/HTTP/HTTPS--> JBoss

      My main problem is to reconfigure the @RemoteBinding/ServerInvokerServlet/Remoting to connect to my reverse proxy instead of directly trying to contact the AS. clientConnectAddress and clientConnectPort dont work as supposed.

      In "good old days" of JBoss 4.0.x all this was configurable by setting a simple InvokerURL. Now, in JBoss 4.2.x, this feature is lost (or not obvious to me ... what I really hope). It was even possible to switch from http to https by changing that. Now you have to define two different RemoteBindings and access your EJB3 SLSB/SFSB using different JNDI-Names (again, do I miss anything here).

        • 1. Re: EJB3 over HTTP and Reverse Proxy
          didi1976

          I know that it is possible to specify the RemoteBinding also in an XML file (did not test it till now) but I dont wanna let a customer edit such files.

          Maybe it would help to explain by the fact that most customers run different systems for QA, training and production. Each time I move a release from QA to training to production, it would be neccessary to adapt files within the EAR/JAR/...

          In the old style (InvokerURL in JBoss 4.0.x) all this was not affected by any file inside my EAR. I had preconfigured AS where I deployed the same EAR without any changes.

          • 2. Re: EJB3 over HTTP and Reverse Proxy
            itsme

            As far as I know (and we're using EJB3overHTTP(S) really heavy) the generated EJB3-Stub sent to the client need the communication endpoint read from @RemoteBinding(clientBindUrl="xxx"), which is in fact a really bad idea, or from jboss.xml and the <client-bind-url></client-bind-url> within the <remote-binding> tag. This works for us and all our possible environments whereas are some more as 3 (probably something around 15).

            \sandor\

            • 3. Re: EJB3 over HTTP and Reverse Proxy
              didi1976

              Could you please post an example of the jboss.xml. I was searching in the DTD (http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd) but I did not find the tags.

              • 4. Re: EJB3 over HTTP and Reverse Proxy
                didi1976

                Found it myself. Here is an example:

                <jboss>
                 <enterprise-beans>
                 <session>
                 <ejb-name>TestSessionBean</ejb-name>
                 <remote-binding>
                 <jndi-name>test/TestSessionBean/remote</jndi-name>
                 <client-bind-url>
                 http://localhost:8080/servlet-invoker/ServerInvokerServlet
                 </client-bind-url>
                 </remote-binding>
                 </session>
                 </enterprise-beans>
                </jboss>
                


                This still leaves the problem of an invalid DTD. As soon as you add the DOCTYPE to jboss.xml it will not deploy.
                <!DOCTYPE jboss PUBLIC
                 "-//JBoss//DTD JBOSS 4.2//EN"
                 "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
                


                • 5. Re: EJB3 over HTTP and Reverse Proxy
                  didi1976

                  And again something I missed.

                  You have to use the http://www.jboss.org/j2ee/schema/jboss_5_0.xsd.

                  • 6. Re: EJB3 over HTTP and Reverse Proxy
                    didi1976

                    One last problem remains. Everything is working perfekt as long as I use http. As soon as I use https, only fetching the InitialContext works and the lookup ends up with:

                    12:15:47,484 DEBUG [SSLSocketBuilder] Could not find keystore url. Can not find store file for url because store url is null.
                    javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]
                     at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1150)
                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
                     at javax.naming.InitialContext.lookup(InitialContext.java:351)
                     at at.softsolution.esa.client.gui.LoginPanel$LoginAction$1.run(LoginPanel.java:1022)
                    Caused by: java.lang.reflect.UndeclaredThrowableException
                     at $Proxy1.createProxy(Unknown Source)
                     at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:53)
                     at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
                     at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
                     at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
                     ... 4 more
                    Caused by: java.lang.reflect.InvocationTargetException
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                     at java.lang.reflect.Method.invoke(Method.java:585)
                     at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:419)
                     at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:320)
                     at org.jboss.remoting.Client.connect(Client.java:441)
                     at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:61)
                     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                     at org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:70)
                     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                     at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
                     ... 9 more
                    Caused by: java.lang.NullPointerException
                     at org.jboss.remoting.transport.http.ssl.HTTPSClientInvoker.createSocketFactory(HTTPSClientInvoker.java:144)
                     at org.jboss.remoting.RemoteClientInvoker.<init>(RemoteClientInvoker.java:46)
                     at org.jboss.remoting.transport.http.HTTPClientInvoker.<init>(HTTPClientInvoker.java:105)
                     at org.jboss.remoting.transport.http.ssl.HTTPSClientInvoker.<init>(HTTPSClientInvoker.java:63)
                     at org.jboss.remoting.transport.https.TransportClientFactory.createClientInvoker(TransportClientFactory.java:39)
                     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                     at java.lang.reflect.Method.invoke(Method.java:585)
                     at org.jboss.remoting.InvokerRegistry.loadClientInvoker(InvokerRegistry.java:419)
                     at org.jboss.remoting.InvokerRegistry.createClientInvoker(InvokerRegistry.java:320)
                     at org.jboss.remoting.Client.connect(Client.java:441)
                     at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:61)
                     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                     at org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:70)
                     at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                     at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
                     at $Proxy1.createProxy(Unknown Source)
                     at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:53)
                     at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
                     at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
                     at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
                     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
                     at javax.naming.InitialContext.lookup(InitialContext.java:351)
                     at at.softsolution.esa.client.gui.LoginPanel$LoginAction$1.run(LoginPanel.java:1022)
                     at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
                     ... 13 more
                    


                    What keystore url is needed and where can I set it?

                    My client can connect to the reverse proxy and gets some response (so I think there isn't any problem):
                    192.168.16.242 - - [13/Dec/2007:12:57:33 +0100] "GET /invoker/HAJNDIFactory HTTP/1.1" 200 1445 "-" "Java/1.5.0_13"
                    192.168.16.242 - - [13/Dec/2007:12:57:33 +0100] "POST /invoker/JMXInvokerHAServlet HTTP/1.1" 200 679 "-" "Java/1.5.0_13"
                    192.168.16.242 - - [13/Dec/2007:12:57:34 +0100] "POST /invoker/JMXInvokerHAServlet HTTP/1.1" 200 1387 "-" "Java/1.5.0_13"
                    


                    • 7. Re: EJB3 over HTTP and Reverse Proxy
                      didi1976

                      An upgrade from JBoss 4.2.0.GA to 4.2.2.GA solved the issue ... seemed to be some problem in the remoting.

                      So I hopefully end this thread and maybe its of some help for others.

                      P.S.: Now the trouble moved towards jbossws, but thats an other story ...