Reputation: 6292
I have a maven built project built into a jar file. It is a standalone java application.
Now I tried to run this project using:
java -cp SpringMavenProject-1.0.jar;<maven repo path>\spring\2.5.5\spring-2.5.5.jar;
<maven repo path>\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar
com.vaannila.HelloWorldApp
However, it cannot find the the Spring XML config file.
I can see the config file is in the jar file created by maven.
How can I specify the path of the Spring XML file?
Thanks
Upvotes: 0
Views: 1305
Reputation: 308763
I'll assume that you have the Spring context XML in a directory that's in the CLASSPATH and your app is accessing it using the ClasspathXmlApplicationContext
(not certain of the exact class name).
If the directory that your context XML resides is not in your -cp list, I'd suggest that you add it and see if that works better for you.
Upvotes: 1
Reputation: 3509
Just hint - if you run maven with '-X' flag (debug) you will see all the classpath it use. So you can use this classpath by copy+paste in your standalone app.
Upvotes: 0
Reputation: 1530
Probably you should add spring-context.jar and spring-beans.jar, because they are responsible of parsing the beans configuration file.
Upvotes: 0