wood burning stoves 2.0*
The moose likes BEA/Weblogic and the fly likes JNDI and EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "JNDI and EJB" Watch "JNDI and EJB" New topic
Author

JNDI and EJB

Hardy Chou
Greenhorn

Joined: Jun 27, 2001
Posts: 27
i am a novice in j2ee and all, so please bear with me. let's say i created an entity bean from database. bea weblogic workshop automatically generates a JNDI name for that particular bean. however, when i compile the EJB, it says JNDI names for the EJBs are not found. my question is that do i have to create manually the JDNI name one by one? please advise. thank you in advance.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
A few questions/comments...

1) The JNDI name for an EJB (in WebLogic) is set by an entry in the weblogic-ejb-jar.xml descriptor. Is the JNDI that you are looking up the same as the one found in your EJB's descriptor?

2) What does the client code that you are using to look up the EJB look like? Is the client deployed with the EJB or is it external to the application?

3) If your client is external (typically for testing) then did you make sure your EJB is marked as Remote? Only Remote EJBs can be accessed externally from an application.
Hardy Chou
Greenhorn

Joined: Jun 27, 2001
Posts: 27
Since I am using weblogic workshop everything is done automatically, even the weblogic-ejb-jar.xml descriptor.

1. The JNDI name is the same as
2. The client is deployed with the EJB using ejbgen in weblogic workshop

* @ejbgen:jndi-name
* local="ejb.Rpd_dvw_serviceHome"

3. This is still preliminary testing, so I test the EJB inside my PC, the EJB is still local.

Apart from that, I've tried BEA tutorial samples which also yield the same warning messages during compilation that the JNDI name cannot be found.

Anyway, when I checked the JNDI tree in the server, it looks like the JNDI instance for ejb.Rpd_dvw_serviceHome is already there. The strange thing is that Workshop cannot find the JNDI name but the application runs okay. Hence, I assume the warning messages can be ignored. Thanks, though.

A few questions/comments...

1) The JNDI name for an EJB (in WebLogic) is set by an entry in the weblogic-ejb-jar.xml descriptor. Is the JNDI that you are looking up the same as the one found in your EJB's descriptor?

2) What does the client code that you are using to look up the EJB look like? Is the client deployed with the EJB or is it external to the application?

3) If your client is external (typically for testing) then did you make sure your EJB is marked as Remote? Only Remote EJBs can be accessed externally from an application.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Since I am using weblogic workshop everything is done automatically, even the weblogic-ejb-jar.xml descriptor.

I understand that, but part of the problem with using RAD tools to generate applications is the fact that most of the developers using them do not understand the underlying technology. When everything is working fine that is not an issue but when you run into problems (like in your case) then you often need to drop down a layer of abstraction to get at the root clause. In this particular case it is important for you to understand how EJBs work in order to properly troubleshoot the situation. I fear that looking at the Workshop generated deployment descriptors is going to be an all too common experience as your application gets more and more complex. These types of tools all offer RAD development but what they don't tell you is the price you will have to pay for it...

Apart from that, I've tried BEA tutorial samples which also yield the same warning messages during compilation that the JNDI name cannot be found.

Anyway, when I checked the JNDI tree in the server, it looks like the JNDI instance for ejb.Rpd_dvw_serviceHome is already there. The strange thing is that Workshop cannot find the JNDI name but the application runs okay. Hence, I assume the warning messages can be ignored. Thanks, though.


Okay, this was a bit of a misunderstanding on my part. Even though you clearly stated you were having a compile time problem, I jumped to the conclusion that it was a runtime issue with the client not being able to find the EJB (very common problem posted here). So I assume your client works fine? The next question that I need to know is what is the exact warning message that you are getting when you compile your application in Workshop?

3. This is still preliminary testing, so I test the EJB inside my PC, the EJB is still local.

This is completely orthogonal to your problem but I just wanted to point out that just because you are running and testing on your local PC doesn't mean your EJB has to be local. Remotely accessing an EJB just means that the client is in a different JVM than the EJB being accessed. They could be on machines halfway around the world or both residing on the same machine.
[ June 09, 2004: Message edited by: Chris Mathews ]
Hardy Chou
Greenhorn

Joined: Jun 27, 2001
Posts: 27
I have asked around in weblogic workshop forum. The reply I got was to ignore the warning messages. Everything is working just fine except that it tells me that the JNDIs are not found.
 
Consider Paul's rocket mass heater.
 
subject: JNDI and EJB