File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes ReDeploying EJB == Servlet problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ReDeploying EJB == Servlet problems" Watch "ReDeploying EJB == Servlet problems" New topic

ReDeploying EJB == Servlet problems

keith doyle

Joined: Jan 25, 2005
Posts: 15
Hi People,
This may be a no-brainer for someone:
I have two seperate projects
One for my EJBs (bus. tier) and one for my servlets (pres. tier)
Everytime I redeploy my EJBs the following servlet code fails:

Object ref = context.lookup("java:/comp/env/ejb/PT");

I then have to redeploy my servlets so that the lookup works. I'm using JBOSS jboss-3.2.3. There is more than likely a simple explanation to this - does anyone have any ideas?
Much thanks,
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Keith,

I don�t use JBoss and I cannot tell you exactly why, but I can give you some hint, from my experience with WebLogic. First of all I believe that you pack your EJBs and your servlets separately. You probably have a war file and multiple jars. If that�s the case, than you must provide the home interfaces and remote interfaces in your war (or at least this is what WebLogic requires due to its class loading architecture). Now it seems to me that if you change your EJBs than you need to update the war with the new home and remote interfaces. Therefore you have to redeploy the war all the time as well. Again this might be the reason for your errors but I�m not sure. However there is one more observation I�d like to make (this applies to WebLogic and might not be the case with JBoss): packing all the files within a unique ear is a much better choice. The reason is that if your EJBs are located in a different file then you cannot use local interfaces. The container will always use remote stubs as with any remote client (which makes the point that local is really local). There are several other container related features that are lost and I�m not going through this here; I suppose you got the point. So think about deploying your app as an ear and this might solve your problem.

I think, therefore I exist -- Rene Descartes
keith doyle

Joined: Jan 25, 2005
Posts: 15
Thanks for the feedback Valentin,

You are quiet correct: both war and ejbs are maintained seperately. Although I do appreciate your points on local interfaces, there are several reasons for this in our architecture, including:

a. web and application server will be seperated so all requests will operate remotely (via a stateless session bean facade)
b. we don't want every developer to access the business logic (ejbs) so an ear containing both ejbs and servlets is not possible.(we use xdoclet to produce the interfaces seperately)

The interesting thing is that even if I don't change the ejbs and merely re-deploy them and error is thrown in the lookup. I would have assumed that one benefit of j2ee is to be able to redeploy EJBs without affecting your presentation tier?
If I get anywhere with this I'II let you know,
Thanks again!
I agree. Here's the link:
subject: ReDeploying EJB == Servlet problems
It's not a secret anymore!