tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pier P. Fumagalli" <>
Subject FW: My Tomcat-Jboss HOWTO
Date Wed, 06 Jun 2001 12:46:56 GMT

------ Forwarded Message
From: Bas Cancrinus <>
Organization: Cancrinus Groep B.V.
Date: Sat, 02 Jun 2001 03:59:01 +0200
Subject: My Tomcat-Jboss HOWTO

Hi webmaster,

I've had lots of problems configuring Tomcat to cooperate with Jboss and
according to the list archives I'm not alone...
The attached HOWTO is written to simplify this tedious task for future
Tomcat-Jboss users and I'd really appreciate it if you could add it to
the existing online Tomcat-documentation.

Thanks a lot!

Bas E. Cancrinus        <>
Product Manager RepTrack (TM)    <>
Developer Cancrinus Search    <>

Tomcat - Jboss HOWTO
This document describes how you should configure Tomcat v3.2.2, and
applications deployed within, if you want to operate on remote Enterprise
JavaBeans deployed in Jboss v2.2.1 from these applications. It is assumed
that your EJB's work well when you operate on them directly (i.e. from
stand-alone apps or applets).
Step 1: Configure Tomcat
Your out-of-the-box Tomcat-distribution is almost ready for JBoss. You only
have to add a RequestInterceptor to the chain of RequestInterceptors in the
Interceptors-section of your <tomcat home>/conf/server.xml:

className="org.apache.tomcat.request.Jdk12Interceptor" />
Tomcat should not generate extra output during startup after this
Step 2: Configure your application
There are many quick and dirty ways to make your application ready for
Jboss, but in this section we try to play by the rules. This section defines
3 necessary activities:
* Modify your <app home>/WEB-INF/web.xml
* Distribute your Jboss client-libraries
* Distribute your EJB home and remote interfaces
* Modify your JSP/Servlet-code for remote EJB-operations

Add the following code between the web-app tags of your <app



Copy the following libraries from <jboss home>/client/ to <app

Copy ejb.jar from <jboss home>/lib/ext/ to <app home>/WEB-INF/lib/ and copy
the home and remote interface of all needed EJB's to <app

Finally make sure that your JSP/Servlet code references the properties set
in <app home>/WEB-INF/web.xml using the
getServletContext().getInitParameter() method. The following code-snippet
demonstrates how this method can be used in a JSP/Servlet:

// Set properties
Properties newProps = System.getProperties();
newProps.put ("java.naming.factory.initial",
getServletContext().getInitParameter ("java.naming.factory.initial"));
newProps.put ("java.naming.provider.url",
getServletContext().getInitParameter ("java.naming.provider.url"));
System.setProperties (newProps);
AnEJB x = null;

// Obtain a remote reference
try {
  InitialContext jndiContext = new InitialContext();
  Object ref = jndiContext.lookup("ejb/AnEJBHome");
  AnEJBHome home = (AnEJBHome) PortableRemoteObject.narrow (ref,
  gocha = home.create();

catch (Exception e) {
  System.err.println ("An exception occurred while obtaining a remote
  System.err.println (e.toString());

Bas Cancrinus <>

------ End of Forwarded Message

View raw message