5 Replies Latest reply on Jul 10, 2003 12:44 AM by jonlee

    howto integrate jboss with tomcat

    ittay

      Hi,

      I want to have JBoss use Tomcat, but I want the full featured version of Tomcat, not the one that comes with JBoss. Is there any howto as to how integrate it into JBoss?

      Thank you,
      Ittay

        • 1. Re: howto integrate jboss with tomcat
          jovial

          In that case Tomcat would be like any other client to your EJB application.

          In order to contact the JBoss server the stand alone Tomcat should have the following things in the class path:
          - j2ee.jar
          - jndi.properties
          here you specify the JBoss server and port in
          java.naming.provider.url=<JBOSS_SERVER_NAME>:1099
          - JBOSS_DIST/client/*.jar files
          - path to the client JAR files of your application that you use in your Tomcat app to reference the classes of the J2EE app deployed on JBoss. Those are usually Session beans classes, interfaces, and Value Object classes.

          By doing all of this you gain all the features of Tomcat container like being able to configure different context under the same virtual host but you lose the advantages that JBoss provides like security layer for the application and some other things I cannot think of at the moment.

          i hope this helped.

          good luck,

          dimitar

          • 2. Re: howto integrate jboss with tomcat
            cherianmathew

            Hai,

            I was also having the same problem. I am having jboss 3.2.1 and Tomcat 4.1.24.

            where can I find these j2ee.jar, jndi.properties files. I searched in the distribution, but can't find one.

            Also that where should I add the URL: java.naming.provider.url=<JBOSS_SERVER_NAME>:1099
            - JBOSS_DIST/client/*.jar files

            Can you also explain JBOSS_DIST?

            Any help appreciated.

            Thanks,
            Cherian

            • 3. Re: howto integrate jboss with tomcat
              jovial

              hi,

              - j2ee,jar is part of J2EE distribution. you will find it in the lib folder of the installation.

              - jndi.properties is a simple ASCII file that contains information necessary for the client to find the EJB classes of your application i.e. application server on the network.
              example of jndi.properties file:
              --------------------------------------------
              java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
              java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
              java.naming.provider.url=mars:1099
              --------------------------------------------
              you need to replace mars with the name of your JBoss instance in
              java.naming.provider.url=mars:1099

              you can leave the other lines unchanged.

              - JBOSS_DIST points to the root folder of the JBoss installed on your machine. example c:\programs\jboss-3.0.4.
              You will need to create environment variables with this name and set its value. Do the same thing for J2SE SDK (JAVA_HOME) and J2EE SDK (J2EE_HOME) distributions.

              your client application will have to create CLASSPATH dynamically that will include j2ee.jar, jndi.properties
              and all the JAR files from JBOSS_DIST/client folder.

              You could copy j2ee.jar, jndi.properties and JBOSS_DIST/client/*.JAR files
              1) to the WEB-INF/lib folder of your application.
              2) CATALINA_HOME/common/lib so they are accessible to all applications on your tomcat instance
              3)edit CATALINA_HOME/bin/catalina.bat and add all the JAR files to the CLASSPATH environment variable.
              catalina.bar starts the Tomcat server.

              You will have to play with it until it works.

              dimitar

              • 4. Re: howto integrate jboss with tomcat
                prabu

                I get conflict for AJP13Listener on port 8009 when i try to run both Tomcat and JBoss...

                Error message is
                14:27:18,175 WARN [jbossweb] WARNING: Failed to start: AJP13Listener@0.0.0.0:80
                09
                14:27:18,175 ERROR [JettyService] multiple exceptions...
                14:27:18,175 ERROR [JettyService] exception
                java.net.BindException: Address already in use: JVM_Bind

                • 5. Re: howto integrate jboss with tomcat
                  jonlee

                  JBoss has an embedded servlet container - in your case Jetty. This has an AJP13 listener defined at 8009. Either change the listener binding - server/default/deploy/jbossweb-jetty.sar/META-INF/jboss-service.xml or remove the embedded Jetty service. There are other threads that discuss this as it is not straightforward.