Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat JNDI lookup on Weblogic

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have an EJB app running on Weblogic and I have a web application deployed in Tomcat. How can I configure Tomcat webapp to do a remote lookup to the EJB's in Weblogic. I get always a NamingException when I try to access my EJB's.
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, the EJBs have to include the remote interface. That used to be a given, but these days, it's worth mentioning! If you don't have the remote interface, there's no place for the Tomcat system to make its RMI EJB calls to.

Secondly, the Tomcat app has to address WebLogic's JNDI port in order to locate the EJB(s). More precisely, the conneciton has to be made to WebLogic's JNDI server, at the specified host and port locations. WebLogic doesn't use the default port ID for JNDI, so you have to specify it explicitly, just like Tomcat doesn't by default use http's default port (80) so you have to supply one explicitly (8080).

That's really about all there is to it. It's pretty well covered in the WebLogic documentation. The fact that the client is inside of Tomcat isn't any different than it would be for a stand-alone application except for maybe the need to set up a Properties object to hold JDNI config information since the normal command-line options aren't available.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course I meant the Remote Interface of my EJB's. In my startup.bat, I have the following configured:



and in my resources directory of my web app, I have the following in the jndi.properties:



What else do I need? When I tried to access my application, I got a NamingException as below:

 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, everything looks good to me except for 2 possibilities. One is your JNDI properties. You've got it listed in file format, but you're going to need it as an actual properties object supplied explicitly when you do the JNDI lookup. Otherwise Tomcat's own internal JNDI is likely to override it.

If you've got that handled, the other possibility is that your resource name isn't correct. I believe the WebLogic console will display the actual JNDI name that the EJB's published under.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Well, everything looks good to me except for 2 possibilities. One is your JNDI properties. You've got it listed in file format, but you're going to need it as an actual properties object supplied explicitly when you do the JNDI lookup. Otherwise Tomcat's own internal JNDI is likely to override it.

If you've got that handled, the other possibility is that your resource name isn't correct. I believe the WebLogic console will display the actual JNDI name that the EJB's published under.


The second possibility (resource name isn't correct) cannot be the case. Can you please throw some light on the first possibility? How can I get it as the Properties object explicitly in Tomcat?
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


You can also load properties using the Properties.load method, but that's not as useful in a webapp for short lists that aren't likely to change.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But where does this piece of code go?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Harry wrote:But where does this piece of code go?


Perhaps, com.web.user.client.service.impl.CustomerServiceClient.getCustomerFacade. I guess that's where you are using the InitialContext to do the lookup.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic