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.
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?
you can set the class path of all the dynamic classes in startWeblogic.cmd if u r working on windows or startWeblogic.sh in linux based systems u can find this file in ur domain in weblogic.
i am not sure
but hope this will work.
The startWebLogic.sh internally calls setEnv.sh and I did set the classpath in setEnv.sh but it doesn't help :(
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 behavior - one ear file, when deployed manually works perfectly fine; and the same ear when deployed through weblogic's auto-deploy doesn't work well - looks very strange.