Hello I am new to Spring and I am having a problem getting my standalone application to run outside of the Spring Source environment. When I export the program I receive the following error when I try to run it. I can't understand why it runs great within Spring and gets errors when it is move outside that environment. Thanks for any assistance you can provide.
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefiniti
onStoreException: Line 9 in XML document from class path resource [org/interface
Transfer/fgc-common-dao-context.xml] is invalid; nested exception is org.xml.sax
.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
The first thing I would check is path and/or classpath. When you run the app in the Spring Source (I assume you mean STS) environment, the platform takes care of these settings for you. When you run outside of the STS, you have to take care of it yourself somehow.
I figured this out, it had to do with using Spring to create a runnable JAR file. When creating the JAR file with Spring it allows you to select one of three options under Library handling:
- Extract required libraries into generated JAR
- Package required libraries into generated JAR
- Copy required libraries into a sub-folder next to the generated JAR
When I used option 1 & 2 this would cause the error to occur. When I used option 3 the application worked correctly without any errors.