1
votes

I am developing swing project with Spring 3.0 and I am using eclipse IDE , the project is work find in IDE but when I produce jar file run it. An Error occur org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from class path resource [spring-beans.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 84; cvc-elt.1: Cannot find the declaration of element 'beans'.

Here is my spring config file

   <?xml version="1.0" encoding="UTF-8"?> 
     <beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
     xmlns:context="http://www.springframework.org/schema/context" 
     xmlns:tx="http://www.springframework.org/schema/tx"  
     xmlns:p="http://www.springframework.org/schema/p" 
     xsi:schemaLocation=" 
        http://www.springframework.org/schema/beans      
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
        http://www.springframework.org/schema/tx  
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
        http://www.springframework.org/schema/context  
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <context:annotation-config/> 
    <context:component-scan base-package="com.plyd.java"/>
  </beans>

I am googling that error and test the solution in my project but not ok. The code work find in IDE.But when I produce runnable jar and run this give me error. Please give me some advise Thank.

1
Is the JRE you use in Eclipse the same as the one you are using from the command line? E.g. are the both the same vendor/version, or different version same vendor, or different vendor?Paul Grime
@PaulGrime Yes both JRE are same.9ine

1 Answers

2
votes

If you are using Eclipse, try this one export jar with > Copy required libraries into a sub-folder