• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ReDeploying EJB == Servlet problems

 
keith doyle
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
Keith
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Regards.
 
keith doyle
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
Keith.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic