File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes Problems hot-deploying EJBs to an existing application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Problems hot-deploying EJBs to an existing application" Watch "Problems hot-deploying EJBs to an existing application" New topic
Author

Problems hot-deploying EJBs to an existing application

Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hello all,
I should be able to drop in a new stateless session bean into a live application (webapp + 2 'static' stateless session beans).
The problem I am facing is that after deploying the EJB using the console GUI, the existing classes don't see its home/remote interfaces and are throwing ClassNotFoundExceptions upon using the newly deployed EJB.
What to do? Could the command line tool be of help? (it sure wasn't documented too well by BEA)


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Forgot. Using WebLogic 6.1...
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
These "existing classes" need access to the Home and Remote (or Local) interfaces of this new EJB.
If the existing classes are in a WebApp, you can build a client jar and add it to the webapp's WEB-INF/lib. An EJB can pick up a client jar for another EJB by using the Class-Path entry in the jar manifest.
But the best approach (IMO) is to package everything into a single EAR. See my response to this thread for more info.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Dave Landers:
These "existing classes" need access to the Home and Remote (or Local) interfaces of this new EJB.
If the existing classes are in a WebApp, you can build a client jar and add it to the webapp's WEB-INF/lib. An EJB can pick up a client jar for another EJB by using the Class-Path entry in the jar manifest.
But the best approach (IMO) is to package everything into a single EAR. See my response to this thread for more info.


Are you saying that WebLogic is polling for changes in all .jar files in mywebapp/WEB-INF/lib?
Here's how I understood your suggestion:
- configure the "deploy at startup" EJBs to use a client.jar from path/to/client.jar
- instruct the developer of "hot-deploy while server is running" EJBs to add their interfaces to path/to/client.jar
This is the direction of the dependency. The hot-deployed EJBs don't need to know anything about existing EJBs, but the 2 EJBs deployed at startup time must see all interfaces of the hot-deployed EJBs.

Thanks for your input.
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
The answer really depends on how you are deploying these three EJBs. If they are all in one application (an ear or exploded-ear directory with a META-INF/application.xml) then all three EJBs will "see" each other. When you redeploy, you actually redeploy the whole application - all 3 ejbs. Everything bounces as a unit, and all changes are picked up. Also you don't have to worry about client jars or whatever because all the code is loaded together.
If your ejbs are deployed in separate applications (or as stand-alone ejb-jars), then the two ejbs will need access to the remote and home interfaces of the hot-deployed ejb.
This requirement really has nothing to do with hot deploy, it is just that any class referencing another has to have access to whatever interfaces, etc. it needs. Same requirement was there when you compiled the code.
So, if you create a client jar for the "hot" ejb, and make it available to the other two (i.e. by referencing it in their manifest's Class-Path or by just including these classes in the other ejb jars), then this should work.
The only problem is if you change the Remote or Home interface and redeploy the "hot" EJB, you will also have to redeploy the other two so they are working with current versions of these interfaces.
Jaiganesh Pasupathy
Greenhorn

Joined: Oct 04, 2004
Posts: 1
Hi All,
Is it possible to update an EJB which is packed and deployed in an .ear file in weblogic. Whenever i do any modification to the file, i need
to restart the server, which is ofcourse time consuming. Any help appreciateed.
Thanks,
jai.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems hot-deploying EJBs to an existing application
 
Similar Threads
Question About Simple EJB Application..
Mark Hansen - SOA and EJB
CMR - 2005Q1
What is Multiple Deployment of an EJB?
XDoclet problem