1 2 Previous Next 20 Replies Latest reply on Mar 30, 2004 11:49 AM by srinivaschowdary

    What is HTTPInvoker for? Can it be used to access EJBs over

    mikesu Newbie

      What is HTTPInvoker for? Can it be used to access EJBs over http?

        • 1. Re: What is HTTPInvoker for? Can it be used to access EJBs o
          Jon Barnett Master

          Yes. Look at this tutorial for configuration to locate and invoke over HTTP. http://nemesisit.rdsnet.ro/opendocs/simplearch/simplejboss.html. It has some good tips on pitfalls when connecting through firewalls.

          • 2. Re: What is HTTPInvoker for? Can it be used to access EJBs o
            mikesu Newbie

            Thanks for the link. I still don't get what should be done on the client side in addition to changing jndi factory.

            • 3. Re: What is HTTPInvoker for? Can it be used to access EJBs o
              mikesu Newbie

              I have the following configuration and this doesn't seem to work. JNDI lookup is going through HTTP but all other RMI calls aren't.

              >>> jboss.xml

              <enterprise-beans>

              <ejb-name>Hello</ejb-name>
              <configuration-name>HTTP Stateless</configuration-name>
              <jndi-name>Hello</jndi-name>

              </enterprise-beans>


              >>>New lines in standardjboss.xml
              <container-configuration extends="Standard Stateless SessionBean">
              <container-name>HTTP Stateless</container-name>
              <home-invoker>jboss:service=invoker,type=http</home-invoker>
              <bean-invoker>jboss:service=invoker,type=http</bean-invoker>

              <instance-pool>org.jboss.ejb.plugins.StatelessSessionInstancePool</instance-pool>
              <instance-cache></instance-cache>
              <persistence-manager></persistence-manager>
              <container-pool-conf>
              100
              </container-pool-conf>
              </container-configuration>

              • 4. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                Jon Barnett Master

                There is nothing to be done on the client side other than changing the context properties and performing remote lookups without the "java:/" prefix as described in the document.

                If the lookups are fine but you aren't invoking the EJBs over HTTP to the specified port, then you are not passing the right references from the server-side. Check the container configuration again and check that your HTTP invoker (last section of the reference) is also correctly set up - particularly if you are operating behind the firewall.

                I would also test in stages if you can and limit the HTTP communication for invocation to one EJB while testing, rather than the entire server. It is good practice for security, in any case. It allows you to only expose certain EJBs to HTTP invocation rather than the whole application.

                • 5. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                  mikesu Newbie

                  Lookups are fine. Lookups do go through http.

                  I use jndi.properties file with:
                  java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
                  java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                  java.naming.provider.url=http://alpha:8888/invoker/JNDIFactory

                  How can I check container configuration?
                  Last version of my jboss.xml looks like (not to modify standardjboss.xml):

                  <?xml version="1.0"?>

                  <container-configurations>
                  <!-- A custom container configuration for RMI/HTTP -->
                  <container-configuration extends="Standard Stateless SessionBean">
                  <container-name>HTTP Stateless SessionBean</container-name>
                  <home-invoker>jboss:service=invoker,type=http</home-invoker>
                  <bean-invoker>jboss:service=invoker,type=http</bean-invoker>
                  </container-configuration>
                  </container-configurations>

                  <enterprise-beans>

                  <ejb-name>Hello</ejb-name>
                  <configuration-name>HTTP Stateless SessionBean</configuration-name>

                  </enterprise-beans>


                  "HTTP Stateless SessionBean" configuration seems to be completely ignored :(

                  • 6. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                    Jon Barnett Master

                    You shouldn't define the pkgs for over HTTP.

                    You can test that your "HTTP Stateless Session Bean" reference is being used by commenting out the <container-configurations> section of the jboss.xml, while leaving the <configuration-name> intact. You should get an error saying that the EJB cannot find the "HTTP Stateless Session Bean" configuration definition or something to that effect.

                    You've made sure that the invoker URL is correct in the http-invoker.sar/META-INF/jboss-service.xml?

                    :8080/invoker/EJBInvokerServlet

                    etc.

                    It would help if you could monitor traffic to see where the Home reference you receive from your JNDI lookup is directing your invocation. By default the HTTP invoker uses the OS to determine the hostname reported in the location of the invoker (Invoker URL). If this is wrong or a value that the remote client cannot resolve, you can have an invocation problem. Normally, you would get some sort of I/O connection error trying to create the remote EJB from the Home (factory) object.

                    It should generate, from your example, some sort of URL like:
                    http://alpha:8888/invoker/EJBInvokerServlet

                    This reference URL for invocation is buried in the obtained Home object from the JNDI lookup so that invocation uses this for the creation and method execution duties.

                    • 7. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                      mikesu Newbie

                       

                      You can test that your "HTTP Stateless Session Bean" reference is being used by commenting out the <container-configurations> section of the jboss.xml, while leaving the <configuration-name> intact. You should get an error saying that the EJB cannot find the "HTTP Stateless Session Bean" configuration definition or something to that effect.


                      Tried that. Receive mentioned error when deploying.

                      It would help if you could monitor traffic to see where the Home reference you receive from your JNDI lookup is directing your invocation


                      Just examined recieved client proxy. In it's fields, there is a hashmap where "INVOKER" key has value "JRMPInvoker" and "INVOKER_BINDING" points to "statelesss-rmi-invoker" :(.

                      • 8. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                        mikesu Newbie

                        Problem solved. The missing (the most important) part was invoker-proxy-binding, that should be mentioned in container-configuration ( <invoker-proxy-binding-name>stateless-http-invoker</invoker-proxy-binding-name>
                        ):

                        <invoker-proxy-binding>
                        stateless-http-invoker
                        <invoker-mbean>jboss:service=invoker,type=http</invoker-mbean>
                        <proxy-factory>org.jboss.proxy.ejb.ProxyFactory</proxy-factory>
                        <proxy-factory-config>
                        <client-interceptors>

                        org.jboss.proxy.ejb.HomeInterceptor
                        org.jboss.proxy.SecurityInterceptor
                        org.jboss.proxy.TransactionInterceptor
                        org.jboss.invocation.InvokerInterceptor


                        org.jboss.proxy.ejb.StatelessSessionInterceptor
                        org.jboss.proxy.SecurityInterceptor
                        org.jboss.proxy.TransactionInterceptor
                        org.jboss.invocation.InvokerInterceptor

                        </client-interceptors>
                        </proxy-factory-config>
                        </invoker-proxy-binding>

                        • 9. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                          mikesu Newbie

                          Man this is fast, only about 40% penalty for going over http.

                          • 10. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                            Jon Barnett Master

                            Yes. That makes sense now. Must remember that for next time.

                            Glad it is up and running now. Performance is not so bad for HTTP but still a hit - try carting BLOBs across HTTP. We convinced a client that delivering stored PDFs across HTTP to a Java GUI client would be very painful.

                            • 11. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                              taiwuco Newbie

                              Hi,

                              My jboss is running on a virtual IP, 192.168.3.5 and behind a firewall. I can get an InitialContext and do the lookup. I have no exceptions generated from executing the following codes.

                              InitialContext jndiContext = new InitialContext();
                              Object ref = jndiContext.lookup("xxxx/jaaslogin");
                              homeJAAS = (JAASHome)PortableRemoteObject.narrow (ref, JAASHome.class);

                              However, when I try to do remoteJAAS = homeJAAS.create();

                              I got the following errors:
                              java.rmi.ConnectIOException: Exception creating connection to: 192.168.3.5; nested exception is:
                              java.net.NoRouteToHostException: No route to host
                              at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:580)
                              at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
                              at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
                              at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
                              at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
                              at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
                              at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
                              at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
                              at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
                              at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
                              at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
                              at $Proxy1.create(Unknown Source)

                              As you may see, I got 192.168.3.5. I set jndi.properties to use
                              HttpNamingContextFactory and JNDIFactory.

                              On the server side, I set
                              http://<real ip>:8080/invoker/EJBInvokerServlet

                              Didn't I tell the client please use http://<real ip>:8080.... to invoke? I could lookup but why did I still get a virtual/internal IP?

                              My codes are running OK via JNDI over HTTP without a firewall. What settings should I make? Please help.

                              Brian

                              • 12. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                                mikesu Newbie

                                2jonlee
                                Glad it is up and running now. Performance is not so bad for HTTP but still a hit - try carting BLOBs across HTTP. We convinced a client that delivering stored PDFs across HTTP to a Java GUI client would be very painful.

                                It's still extremely good. On the other hand, jboss rmi is overall 3 times slower than oc4j (orion oracle)/bea weblogic.

                                I am in fact doing that "BLOBs across HTTP". What's the guys problem? If you have limited bandwidth use compression. (I think it is possible to configure invokers to use gzip compression)


                                2taiwuco2

                                I don't quite understand your problem. Where is the client located? If you want to tunnel through http just setting jndi properties for client is not enough. Client would doo jndi lookups through http, but home object you'll get will try to connect using rmi. Btw I don't know if what I did would work with statefull/entity beans.

                                • 13. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                                  Jon Barnett Master

                                  It's not a problem, just a performance issue. A 40% increase of a large number is noticeable. It's not a matter of the proportions, it's a matter of the magnitude. ;)

                                  There are certain expectations on responsiveness and useability - we use Jakob Nielsen's text as the base guideline though I've been keeping an eye on some of the studies coming from the German Universities on useability guidelines.

                                  Compression requires CPU on both ends so there are also trade-offs including scalability. Besides, PDFs are already compressed so there is little to be gained from attempting additional compression.

                                  Anyway, suffice to say there are some interesting environmental forces to balance in the equation. I pray that the great Architect has had a hand in our endeavours to solve these issues. ;)

                                  • 14. Re: What is HTTPInvoker for? Can it be used to access EJBs o
                                    taiwuco Newbie

                                    to mikesu,

                                    Here is the connection route.

                                    Remote Swing Client @61.13.xxx.xxx
                                    ----->Bandwidth Managment and NAT @ 203.73.xxx.xxx
                                    ----->Firewall @ 192.168.1.0
                                    ----->jboss @ 192.168.3.5

                                    You mentioned that the Swing Client still use RMI. So, I have to configure standardjboss.xml as did you. I also need to configure jboss.xml. Are these sufficient to tell the client to call via http?

                                    Thanks.

                                    Brian

                                    1 2 Previous Next