Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Hot Deploy with Weblogic 8.1

 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

In order to use the hot deploy (re-deploy the app without restarting server), I'm using the server in development mode and using the following directory structure for my enterprise application.

domains/my_domain/applications/myapp
|
|-APP-INF
|-APP-INF/classes
|-APP-INF/lib
|-META-INF
|-META-INF/application.xml
|-META-INF/REDEPLOY
|-myejbs.jar
|-mywebapp.war

The jar file contains all the EJB classes and deployment descriptor; the war file contains the JSPs, servlet classes and web.xml; and the APP-INF/classes folder contains all the common classes.

Now to test this after deploying first time with this structure, I changed one of the JSPs, and copied the modified war file and then changed the timestamp of the REDEPLOY file (by touching it). And it refreshed the changes, so logically it is redeploying the files without restarting the server.

Now, the problem is that there are some classes which are being instantiated dynamically (using Class.forName()). And when it tries to load the first class through Class.forName, it fails by giving "java.lang.NoClassDefFoundError".

I tried following alternatives to get rid of this error, but no luck so far:
- Tried adding the common classes directory explicitly in classpath
- Deploy the application as a bundled EAR file instead of exploded structure
- Tried adding the required classes in the jar and/or war files.

Any clues at this point?
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's been a while since I've done these things, but one thing I do remember is that it's a good idea to create the EAR file which contains all the files for your application (as this reduces the chance of running into classloader problems).

Also, consider deploying using the wldeploy Ant Task or the weblogic.Deployer utility.
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried deploying the EAR file as well, but there also I'm getting few errors.

I also tried the weblogic.Deployer, but it's asking me for password of "installadministrator" which I doesn't know. Tried some standard passwords here but none works.

By the way, in my ear file, there are some set of classes which are common, means they are being used in both the servlets as well as EJBs. Where in the structure of EAR file should I copy these classes?
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am somehow getting a feeling that the structure in which I'm packaging the EAR is having problem.

In the EJB jar file, I've included all EJB classes, DD and all the other helper classes used by EJBs.

In war file, I've included all the jsps, servlets, DD and helper classes being used by jsps and servlets.

Now, in the EAR file, if I just keep the jar, war and META-INF/application.xml, it throws exception for BasicConfigurator.class which is part of log4j.jar. This is inspite of the fact that log4j.jar file is already present in WEB-INF\lib.

If I include this log4j.jar file in APP-INF\lib directory, then it is able to find that class and then it gives me an exception that not able to find one of the .propertis file.

Now, if I copy this properties file under APP-INF\classes folder, it is able to find the properties file but then gives me NoClassDefFoundError for that class which is being loaded through Class.forName. ((
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try doing this instead.

Package your common classes in a common.jar file.

In the WAR file, create a manifest file which references the common.jar file.


The manifest file should be located in the archive at META-INF/MANIFEST.MF.

You will need to place the common.jar file next to the WAR file:

/<directory>/MyClient.war
/<directory>/common.jar

Now, do something similar with your EJB JAR file.

Hopefully, this will solve your problem.
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried what you suggested above, but it still doesn't work.

I deployed the EAR with following structure: (MANIFEST.MF in the war > WEB-INF/META-INF and jar > META-INF contains Class-Path as you suggested):

EAR
+ META-INF
- MANIFEST.MF
- application.xml
- myejb.jar
- myweb.war
- mycommon.jar

Now while deploying it is throwing NoClassDefFoundError for one of the classes in mycommon.jar file. Note, here that this class is being loaded normally, not through Class.forName().
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Surprisingly, I am able to re-create exact same problem on a different machine as well.
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another interesting thing to note here.

The reason I'm trying to get the Hot Deployment in place is, during development we change lot of things frequently and need to keep redeploying the application frequently and manual redeployment is taking quite long time.

Now, if I take the ear file which I'm deploying manually (which works perfectly fine) and copy this in the domains/applications folder it gets deployed, but at the runtime it is not able to find third party library files (even if I have added that jar in "Class-Path" in META-INF/MANIFEST.MF file under war).

This looks very strange to me
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about deploying as an exploded directory rather than as an EAR file. This will enable you to do partial updates to a deployed application without redeploying the entire application.
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I deploy under the domains/mydomain/applications/ directory, either as EAR or exploded, the behavior is more or less same.

The difference is when I deploy it manually, that time everything works perfectly fine.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you doing to manually deploy the application?
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roger Chung-Wee:
What are you doing to manually deploy the application?



Go to console (http://server_ip:8001/console), login with the system user, go to Deployments > Applications. Delete existing application, Deploy new application, then restart the corresponding managed server.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic