You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bryan Basham <Br...@Sun.COM> on 2001/04/05 18:39:37 UTC
integrating Web tier (Tomcat v4.0b1) with an EJB tier (RI v1.2)
Hello Tomcat Users,
I am trying to integrate my Web tier with an EJB tier using the Business
Delegate pattern. I am having a problem on the Web tier side doing the
JNDI lookup on the remote EJB server. ***A very important note: I am using
Tomcat (v4.0b1) independently of the EJB tier (using the J2EESDK reference
implementation v1.2.1); that is, I am *not* deploying my Web app in the
J2EE server.***
I have the JNDI port on 1052 and the bean is named: java:comp/env/leagueService
Here is the J2EE statup response:
-----------------
Naming service started: :1052
Published the configuration object ...
Web service started: 9191
Web service started: 8000
Web service started: 7000
Loading
jar:/usr/local/j2sdkee1.2.1/repository/basham/applications/SportsLeague983569674
255Server.jar
/usr/local/j2sdkee1.2.1/repository/basham/applications/SportsLeague983569674255S
erver.jar
Binding name:`java:comp/env/leagueService`
Binding name:`java:comp/env/jdbc/SportsLeagueDB`
Looking up authenticator...
Binding name:`java:comp/env/jdbc/SportsLeagueDB`
J2EE server startup complete.
-----------------
On each HTTP request my servlet constructs a new LeagueDelegate object.
In the constructor, the delegate is doing the JNDI lookup on the leagueService
Home interface. Here is that constructor:
-----------------
public LeagueDelegate() {
System.out.println(">> Entering LeagueDelegate constructor");
try {
Hashtable ctxProperties = new Hashtable();
// ctxProperties.put(Context.INITIAL_CONTEXT_FACTORY,
// "???");
ctxProperties.put(Context.PROVIDER_URL,
"basham:1052");
System.out.println(">> creating intial context");
Context c = new InitialContext(ctxProperties);
System.out.println(">> looking up java:comp/env/leagueService");
Object result = c.lookup("java:comp/env/leagueService");
System.out.println(">> narrowing the leagueService Home");
leagueSvcHome
= (LeagueSessionHome)
PortableRemoteObject.narrow(result, LeagueSessionHome.class);
} catch (Exception e) {
System.out.println(e);
}
System.out.println("Exiting LeagueDelegate constructor");
}
-----------------
This is an excerpt from the Tomcat log file:
-----------------
LeagueAdminController: init
>> Entering LeagueDelegate constructor
>> creating intial context
>> looking up java:comp/env/leagueService
javax.naming.NameNotFoundException: Name leagueService is not bound in this
Context
Exiting LeagueDelegate constructor
-----------------
I have tried several variations on the JNDI name ('leagueService',
'java:leagueService', 'java:ejb/leagueService'). Nothing seems to work.
Also, I tried to figure out what to use for the INITIAL_CONTEXT_FACTORY,
but nothing I tried seemed to help.
Please let me know if you have any ideas I should try.
Thanks,
Bryan
+---------------------------------------+--------------------------------------+
| Bryan Basham | "You are not an isolated entity, but
| Java Courseware Developer | a unique, irreplaceable part of the
| Sun Educational Services | cosmos. Don't forget this. You are
| Phone: 1-303-272-8766 (x78766) | an essential piece of the puzzle of
| E-mail: Bryan.Basham@Sun.COM | humanity."
| Address: 500 Eldorado Blvd |
| MailStop: UBRM05-135 | -- The Art of Living, Epictetus
| Broomfield, CO 80021 | (trans. Sharon Lebell)
+---------------------------------------+--------------------------------------+