2014-10-08 75 views
0

我收到以下错误。Spring +无法加载Hibernate注释jar

java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean

这里的pom.xml。请让我知道我是否缺少任何Jar或jar版本文件之间的任何冲突。

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>MySpringMvc</groupId> 
    <artifactId>MySpringMvc</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <name>MySpringMvc</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <java.version>1.6</java.version> 
     <spring.version>3.1.0.RELEASE</spring.version> 
     <cglib.version>2.2.2</cglib.version> 
     <hibernate.version>3.6.9.Final</hibernate.version> 
    </properties> 

    <dependencies> 
     <!-- Spring core & mvc --> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-context</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-webmvc</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-orm</artifactId> 
      <version>${spring.version}</version> 
      <type>jar</type> 
      <scope>compile</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-test</artifactId> 
      <version>${spring.version}</version> 
      <type>jar</type> 
      <scope>test</scope> 
     </dependency> 

     <!-- CGLib for @Configuration --> 
     <dependency> 
      <groupId>cglib</groupId> 
      <artifactId>cglib-nodep</artifactId> 
      <version>${cglib.version}</version> 
      <scope>runtime</scope> 
     </dependency> 


     <!-- Servlet Spec --> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>2.4</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet.jsp</groupId> 
      <artifactId>jsp-api</artifactId> 
      <version>2.1</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-jdbc</artifactId> 
       <version>${spring.version}</version> 
     </dependency> 
     <!-- Hibernate --> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-entitymanager</artifactId> 
      <version>${hibernate.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>${hibernate.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.28</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-dbcp</groupId> 
      <artifactId>commons-dbcp</artifactId> 
      <version>1.4</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-tx</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 


    </dependencies> 

    <repositories> 
     <repository> 
      <id>springsource-milestones</id> 
      <name>SpringSource Milestones Proxy</name> 
      <url>https://oss.sonatype.org/content/repositories/springsource-milestones</url> 
     </repository> 
    </repositories> 

    <build> 
     <finalName>MySpringMvc</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.0.2</version> 
       <configuration> 
        <source>${java.version}</source> 
        <target>${java.version}</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

感谢

+0

下载它确保弹簧ORM-3.1.1.RELEASE.jar文件是在构建/类路径 – Amy 2014-10-08 12:03:46

+0

你有解决办法吗? – Amy 2014-10-08 12:26:47

回答

0

请您构建路径添加弹簧ORM-3.1.1.RELEASE.jar。

here