I am using spring and hibernate in my java project which is managed by maven. I created an assembly (jar with dependencies) using following command mvn install assembly:assembly
Now, when I am trying to run my main class with the command: java -cp xyz-1.0-SNAPSHOT-jar-with-dependencies.jar com.xyz.class
then I am getting following error:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/jpa]**
Offending resource: class path resource [xyz-component-scans-config.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:271)
.
.
I am not understanding that why it is not able to find the NamespaceHandler? as I already have following dependencies in pom.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.1.0.RELEASE</version
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.0.2.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
</dependency>
I did try the suggestion in the following thread, but it didn't work for me. Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/jpa]
Source code for org.springframework.beans.factory.parsing.BeanDefinitionParsingException