6 Replies Latest reply on Oct 7, 2002 8:55 PM by Juha Lindfors

    Connecting from a remote Tomcat box

    Edmund Mitchell Newbie

      Hello

      JBoss is working fine, and all the examples, on it's box.
      I'd like to have the servlets from an existing Apache + Tomcat setup be able to access the ejb's on the JBoss box, but I don't know how.

      Can anyone point me to a detailed explanation?

      Thanks much for any help

        • 1. Re: Connecting from a remote Tomcat box
          Juha Lindfors Master

          basic ejb programming, lookup home from JBoss naming service, and create or find remote proxy in your servlet code then invoke application methods on ejb

          start with a good ejb book (like RMH book + JBoss workbook), check the getting started guide for jboss, start programming

          • 2. Re: Connecting from a remote Tomcat box
            Edmund Mitchell Newbie


            Thanks for your reply. I have the RMH book, and I've looked through the JBoss workbook, but all the examples I've seen are for localhost, and therefore don't address this problem.

            I'm trying to figure out what is needed to tell a client serlvet/webapp on my Tomcat box how to find the JBoss box.

            Looking at Chapter 4 of the Quick Start Guide, I am led to believe that maybe I need to place a jndi.properties file, as well as perhaps jnp-client.jar somewhere in the client. Webapp construction calls for jar files to be placed in the /WEB-INF/lib/ directory, but I'm unclear on where I need to place the jndi.properties file, as well as being unclear on what, if any, changes need to be made to the client's server.xml, or any jboss config files on the jboss box.

            Thanks for any clarification

            • 3. Re: Connecting from a remote Tomcat box
              Juha Lindfors Master

              jndi.properties need to be available somewhere in your servlet's classpath, and configured to connect to your JBoss naming service (and yes you are correct you do need jnp-client.jar on tomcat side as well)

              • 4. Re: Connecting from a remote Tomcat box
                Juha Lindfors Master

                and most likely a host of other jars from jboss' client/ dir on Tomcat as well

                the basic approach should not differ from coding a standalone ejb client app

                • 5. Re: Connecting from a remote Tomcat box
                  Edmund Mitchell Newbie

                  Thanks again, juha.

                  I put jndi.properties in $CATALINA_HOME/classes (since almost every servlet this Tomcat instance contains will need to talk to JBoss), and I copied every jar file from $JBOSS_DIST/client that had the word 'client' in it's name to $CATALINA_HOME/lib.
                  I edited nothing else whatsoever, and now the web-client example is much closer to working. The servlet now has output, and says:

                  Web Client
                  The next ID of a Test Entity is:
                  Caugth (sic) exception: Cannot create resource instance
                  Have fun and see you soon

                  Do you think I'm actually connecting? At first I thought I was, but now I think I'm not, after all, the only part of the output that I'm sure has to come from the JBoss server is the line that has the error message, and the 2002_10_07.request.log file is empty, so I think the server never got the request.

                  In my jndi.properties, I directed the connection to port 1099 (because Ch 4 of the Quick Start Guide says 1099 is the default port), but nmap doesn't show anything open on that port - do I need to enable a port in JBoss somehow?

                  Thanks again for your help!

                  • 6. Re: Connecting from a remote Tomcat box
                    Juha Lindfors Master

                    I'm not familiar with the examples in the guide. The easiest way for you is to add System.out.printlns to your EJB container methods and watch the server output to see whether your invocations are going thru or not.

                    By default 1099 is the naming service port so you should see something there.