Reputation: 85
As I continue to investigate using Ant Build Scripts, Spring and Glassfish I have run into another issue when deploying a WAR to Glassfish.
My build script seems to compile and produce a war file correctly, but when I come to deploy it using
<glassfish-deploy force="true" file="${dist.dir}/${name}.war" />
I get the following error message
[glassfish-deploy] remote failure: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.ClassNotFoundException: uk.co.crowderconsult.spider.controllers.HelloController. Please see server.log for more details.
Of which I belive the underlying issue is
java.lang.ClassNotFoundException: uk.co.crowderconsult.spider.controllers.HelloController
However, the class that it can't find is one of the ones I have written and contained within the WAR file. I checked by opening the WAR with winzip and the classfile is within there.
Normally I would figure that I hadn't included something in the classpath, but 1) the class is in the file I'm trying to deploy so would expect it to be on the classpath anyway and 2) I don't know how to set the classpath for glassfish's deploy command.
I've also tried to deploy it using the command line asadmin task, and the admin console of glassfish, with the same results.
Can anyone point me in the right direction as I feel like I'm just going round in circles?! If any other information is required please let me know
Many thanks.
Upvotes: 1
Views: 7535
Reputation: 309008
When you say "it's there", I interpret that to mean there's a HelloController.class
in the WEB-INF/classes
folder in the package path uk.co.crowderconsult.spider.controllers
. Is that true? If yes, the class loader should find it. If not, that would explain why you have the CNFE.
You are correct: if your WAR file is constructed properly, you shouldn't have to do anything else to explain CLASSPATH to the web server.
Upvotes: 1