Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Tomcat JNDI Help Needed

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am deploying a war file in Tomcat 6.0 . As part of this war file, I am using a thirdparty api (which internally access ejbs deployed on remote weblogic server).

I dont have any controller on the thirdpary , or the server where thier ejbs are running. I dont even know the ejb details.

All I need to do to access that api is, I have to specify the jndi connection factory and host details in my war file. Previously I deployed this was in JBOSS and it worked fine with the jndi.properties in /WEB-INF/classes folder. But , this is not working in tomcat. If I set jndi properties using system.setProperty(), it is working in tomcat.

My question is, why the jndi.properties in my war is not recognized in tomcat ? How to configure them for Tomcat ? I cant use Syste,.setProperties() because, there is another module running in the same war which uses another set of jndi properties.

Can I get some help here

 
Saloon Keeper
Posts: 25466
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The difference between Tomcat and JBoss is that JBoss contains Tomcat, but it also contains J2EE services that Tomcat does not. Tomcat is not a full-stack J2EE server, but JBoss is.

I think your real problem is that there are 2 different JNDI servers involved. Tomcat runs its own internal JNDI server and that's what resolves the items defined in web.xml (and often overridden in the Tomcat webapp Context). However, the WebLogic EJB server also includes a JNDI server, and that's the server that you resolve remote EJB references from.

This means that you have 2 sets of JDNI connection parameters to deal with. One is for local JNDI references (Tomcat) and one is for remote references (WebLogic EJB). You have to make sure you connect to the right one at the right time.
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom,

Thanks for the reply.

Is there any way, that we can override these properties just for one war file in tomcat (in web.xml or in Server.xml).

java.naming.factory.initial
java.naming.factory.url.pkgs
java.naming.provider.url



 
Tim Holloway
Saloon Keeper
Posts: 25466
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wouldn't count on it. You can, however, override the properties you pass to the getInitialContext method that actually locates the EJBs. You can create a Properties object and populate it either via Java code and/or from a resource stream load, then use that.

Obviously, this works best if you have an app-wide central bean locator service instead of hard-coded context lookups for each EJB reference.
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic