Reputation: 85
First the main problem:
We've a web application in tomcat that overloads and shut down when the system tries to send e-mails at 12 o'clock. At first it was just hundreds of them (and the server behaved well) but now it's thousands and runs out of everything.
We want to "run" these jobs in a different JVM. For that purpose I've been asked to create a stand alone app that loads Spring and hibernate context and call the methods that sends the e-mails and sms; and runs this via command line. But they want to use the same "war" that resides in the tomcat's server (avoiding any kind of replication).
I've created the application via Eclipse and when I hit run, it does its magic. But when I try to run it via command line I get a NoClassDefFoundError, Obviouly, thanks to a ClassPath reference problem. I've tried to put the path to the "WEB-INF" directory w/o success. We don't care to kill portability if that mean running this app.
C:\Program Files\Java\jdk1.6.0_38\bin>java -jar -cp ".;D:\powerfollowups\trunk\WebContent\WEB-INF\lib\*;D:\powerfollowups\trunk\WebContent\WEB-INF\clases" D:\powerfollowups\workspace\PFUReportSender\target\pwrFU-2.jar
I also tried to put it in the manifest's Class-Path, like this:
Manifest-Version: 1.0
Main-Class: com.powerfollowups.StandAlonePFUReportSender
Class-Path: D:\powerfollowups\trunk\WebContent\WEB-INF\lib\* D:\powerfollowups\trunk\WebContent\WEB-INF\clases
How do I add all this in to the classpath?
Optimize the code it's not an option rigth now.
Upvotes: 1
Views: 1469
Reputation: 12334
You need a few things on the classpath:
edit: based upon your updated question
java -jar -cp ".;D:\powerfollowups\trunk\WebContent\WEB-INF\lib\*;D:\powerfollowups\trunk\WebContent\WEB-INF\classes" D:\powerfollowups\workspace\PFUReportSender\target\pwrFU-2.jar
Upvotes: 2