RE: integrating Web tier (Tomcat v4.0b1) with an EJB tier (RI v1.2)

2001-05-11 Thread Michael Schommer

Hi,

I'm using a Tomcat (3.3) with the J2EESDK(1.3)  reference.
I think you have to specify a JNDI-name for the EJB (I don't know, if you
have done that?) and lookup for this name???!
I think the INITIAL_CONTEXT_FACTORY is declared in the file jndi.properties
under lib\classes in J2EE-reference

My problem is to get an Initial Context in the servlet in the tomcat.
Is there any trick, you know?


Gruß
Michael

--
Java - write once, run anywhere


***

From: Bryan Basham
 Subject:  integrating Web tier (Tomcat v4.0b1) with an EJB tier (RI v1.2)
 Date:  Thu, 5 Apr 2001 10:39:37 -0600 (MDT)

 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/SportsLeague9835
69674
 255Server.jar

/usr/local/j2sdkee1.2.1/repository/basham/applications/SportsLeague98356967
4255S
 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: [EMAIL PROTECTED] |  humanity.
 | Address: 500 Eldorado Blvd|
 |  MailStop: UBRM05-135 |  -- The Art of Living,
 Epictetus
 |  Broomfield, CO 80021 | (trans. Sharon Lebell)
 +---
 +--+





integrating Web tier (Tomcat v4.0b1) with an EJB tier (RI v1.2)

2001-04-05 Thread Bryan Basham

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: [EMAIL PROTECTED] |  humanity."
| Address: 500 Eldorado Blvd|
|  MailStop: UBRM05-135 |  -- The Art of Living, Epictetus
|  Broomfield, CO 80021 | (trans. Sharon Lebell)
+---+--+