我必须升级项目才能开始使用Hibernate4和Maven进行构建。我有许多项目,这个过程使我丧命。我的项目是Spring WebFlow,MySQL,CAS和Hibernate4,它使用的是Hibernate3,没有任何问题。

我将pom.xml尽了最大的努力,但是看起来我可能遇到了Hibernate版本控制问题。我收到以下错误:

NoSuchMethodException:org.hibernate.cfg.Configuration.addAnnotatedClass

我认为我的项目可以尝试仍然使用Hibernate3,而不是Hibernate4。如果在下面查看我的pom.xml,将会看到我正在请求Hibernate4,但是如果在打包后查看我的WAR文件,则可以看到Hibernate4和Hibernate3库。

这是我得到的错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring/database-c3p0.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:848)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:790)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
    ... 56 more
Caused by: java.lang.ExceptionInInitializerError
    at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:259)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
    ... 66 more
Caused by: java.lang.IllegalStateException: Expected method not found: java.lang.NoSuchMethodException: org.hibernate.cfg.Configuration.addAnnotatedClass(java.lang.Class)
    at org.springframework.util.ClassUtils.getMethod(ClassUtils.java:627)
    at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.<clinit>(LocalSessionFactoryBuilder.java:68)
    ... 69 more
Sep 14, 2012 8:08:34 AM org.apache.catalina.core.StandardContext start


这是我的pox.xml

<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.uftwf.schoolvisit</groupId>
    <artifactId>SchoolVisit</artifactId>
    <name>School Visit</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>

    <properties>
        <java-version>1.5</java-version>
        <springframework-version>3.1.1.RELEASE</springframework-version>
        <springwebflow-version>2.3.1.BUILD-SNAPSHOT</springwebflow-version>
        <springsecurity-version>3.1.1.RELEASE</springsecurity-version>
        <org.slf4j-version>1.5.10</org.slf4j-version>
        <hibernate.version>4.1.1.Final</hibernate.version>
    </properties>

    <dependencies>
        <!-- Spring -->

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${springframework-version}</version>
            <!-- will come with all needed Spring dependencies such as spring-core
                and spring-beans -->
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${springframework-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springframework-version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>spring-faces</artifactId>
            <version>${springwebflow-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${springsecurity-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${springsecurity-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
            <version>${springsecurity-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-cas</artifactId>
            <version>${springsecurity-version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-cas-client</artifactId>
            <version>3.0.7.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.5</version>
        </dependency>




        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.21</version>
        </dependency>

        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.2.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.2.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>1.6.2</version>
        </dependency>

        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Logging -->


        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-ext</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>

        </dependency>
        <!-- JSF-303 Dependency Injection -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</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>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- Sun Mojarra JSF 2 runtime -->
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1.7</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.7</version>
        </dependency>


        <!-- JSR 303 validation -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>

        <!-- **********************************************************************
            ** HIBERNATE DEPENDENCIES ** ********************************************************************** -->

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.0.2.GA</version>
        </dependency>



        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <!-- For testing against latest Spring snapshots -->
        <repository>
            <id>org.springframework.maven.snapshot</id>
            <name>Spring Maven Snapshot Repository</name>
            <url>http://maven.springframework.org/snapshot</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <!-- For developing against latest Spring milestones -->
        <repository>
            <id>org.springframework.maven.milestone</id>
            <name>Spring Maven Milestone Repository</name>
            <url>http://maven.springframework.org/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- For Hibernate Validator -->
        <repository>
            <id>org.jboss.repository.releases</id>
            <name>JBoss Maven Release Repository</name>
            <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- For Sun Mojarra JSF 2 implementation -->
        <repository>
            <id>maven2-repository.dev.java.net</id>
            <name>Java.net Repository for Maven</name>
            <url>http://download.java.net/maven/2/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- For PrimeFaces JSF component library -->

    </repositories>

    <build>
        <finalName>SchoolVisit</finalName>
    </build>
</project>


这是来自Maven的WAR中我的lib中的文件列表:

activation-1.1.jar
antlr-2.7.6.jar
antlr-2.7.7.jar
aopalliance-1.0.jar
asm-3.1.jar
asm-3.3.1.jar
asm-attrs-1.5.3.jar
aspectjrt-1.6.8.jar
aspectjtools-1.6.2.jar
aspectjweaver-1.6.8.jar
c3p0-0.9.1.2.jar
c3p0-0.9.2-pre4.jar
cal10n-api-0.7.2.jar
cas-client-core-3.1.10.jar
cas-client-core-3.1.12.jar
cas-client-core-3.2.1.jar
cglib-2.2.2.jar
cglib-2.2.jar
commons-beanutils-1.8.0.jar
commons-codec-1.4.jar
commons-codec-1.6.jar
commons-collections-3.1.jar
commons-dbcp.jar
commons-digester-1.8.1.jar
commons-email-1.0.jar
commons-fileupload-1.1.1.jar
commons-io-1.1.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
commons-pool.jar
dom4j-1.6.1.jar
dumbster-1.6.jar
ehcache-1.2.3.jar
hibernate-annotations-3.5.0-Final.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-3.5.0-Final.jar
hibernate-core-4.1.1.Final.jar
hibernate-entitymanager-3.5.0-Final.jar
hibernate-entitymanager-4.1.1.Final.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-search-3.0.0.GA.jar
hibernate-validator-4.0.2.GA.jar
hsqldb-1.8.0.10.jar
httpclient-4.1.2.jar
httpclient-4.2.1.jar
httpclient-cache-4.1.2.jar
httpcore-4.1.2.jar
httpcore-4.2.1.jar
httpmime-4.1.2.jar
icu4j-2.6.1.jar
jackson-core-asl-1.5.3.jar
jackson-mapper-asl-1.5.3.jar
javassist-3.15.0-GA.jar
javassist-3.9.0.GA.jar
javax.inject-1.jar
javax.servlet-jstl-1.2.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.3.jar
jaxen-1.1.1.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jcl-over-slf4j-1.5.10.jar
jdom-1.0.jar
joda-time-1.6.jar
joda-time-jsptags-1.0.2.jar
jsf-api-2.1.7.jar
jsf-impl-2.1.7.jar
jstl-1.2.jar
jstl-jstl-1.2.jar
jta-1.1.jar
list.txt
log4j-1.2.14.jar
log4j-1.2.15.jar
log4j-1.2.16.jar
lucene-core-2.3.2.jar
lucene-highlighter-2.0.0.jar
mail-1.4.5.jar
mail-1.4.jar
mailapi.jar
mail.jar
mchange-commons-java-0.2.2.jar
mysql-connector-java-5.0.5.jar
mysql-connector-java-5.1.21.jar
org.springframework.aop-3.1.1.RELEASE.jar
org.springframework.asm-3.1.1.RELEASE.jar
org.springframework.aspects-3.1.1.RELEASE.jar
org.springframework.beans-3.1.1.RELEASE.jar
org.springframework.binding-2.3.1.RELEASE.jar
org.springframework.context-3.1.1.RELEASE.jar
org.springframework.context.support-3.1.1.RELEASE.jar
org.springframework.core-3.1.1.RELEASE.jar
org.springframework.expression-3.1.1.RELEASE.jar
org.springframework.faces-2.3.1.RELEASE.jar
org.springframework.instrument-3.1.1.RELEASE.jar
org.springframework.instrument.tomcat-3.1.1.RELEASE.jar
org.springframework.jdbc-3.1.1.RELEASE.jar
org.springframework.jms-3.1.1.RELEASE.jar
org.springframework.js-2.3.1.RELEASE.jar
org.springframework.js.resources-2.3.1.RELEASE.jar
org.springframework.orm-3.1.1.RELEASE.jar
org.springframework.oxm-3.1.1.RELEASE.jar
org.springframework.test-3.1.1.RELEASE.jar
org.springframework.transaction-3.1.1.RELEASE.jar
org.springframework.web-3.1.1.RELEASE.jar
org.springframework.webflow-2.3.1.RELEASE.jar
org.springframework.web.portlet-3.1.1.RELEASE.jar
org.springframework.web.servlet-3.1.1.RELEASE.jar
org.springframework.web.struts-3.1.1.RELEASE.jar
persistence-api-1.0.jar
quartz-1.5.2.jar
slf4j-api-1.5.10.jar
slf4j-ext-1.5.10.jar
slf4j-log4j12-1.5.10.jar
smtp.jar
spring-aop-3.0.7.RELEASE.jar
spring-asm-3.1.1.RELEASE.jar
spring-aspects-3.1.1.RELEASE.jar
spring-beans-3.1.1.RELEASE.jar
spring-binding-2.3.1.BUILD-20120326.222602-13.jar
spring-context-3.1.1.RELEASE.jar
spring-context-support-3.1.1.RELEASE.jar
spring-core-3.1.1.RELEASE.jar
spring-expression-3.1.1.RELEASE.jar
spring-faces-2.3.1.BUILD-20120326.222626-13.jar
spring-jdbc-3.1.1.RELEASE.jar
spring-js-2.3.1.BUILD-20120326.222614-13.jar
spring-js-resources-2.3.1.BUILD-20120326.222607-13.jar
spring-ldap-1.3.1.RELEASE-all.jar
spring-ldap-core-1.3.1.RELEASE.jar
spring-orm-3.1.1.RELEASE.jar
spring-security-cas-3.1.0.RELEASE.jar
spring-security-cas-3.1.1.RELEASE.jar
spring-security-cas-client-3.0.7.RELEASE.jar
spring-security-config-3.1.0.RELEASE.jar
spring-security-config-3.1.1.RELEASE.jar
spring-security-core-3.1.0.RELEASE.jar
spring-security-core-3.1.1.RELEASE.jar
spring-security-crypto-3.1.0.RELEASE.jar
spring-security-ldap-3.1.0.RELEASE.jar
spring-security-ldap-3.1.1.RELEASE.jar
spring-security-openid-3.1.0.RELEASE.jar
spring-security-remoting-3.1.0.RELEASE.jar
spring-security-taglibs-3.1.0.RELEASE.jar
spring-security-web-3.1.0.RELEASE.jar
spring-security-web-3.1.1.RELEASE.jar
spring-tx-3.0.5.RELEASE.jar
spring-tx-3.1.1.RELEASE.jar
spring-web-3.1.1.RELEASE.jar
spring-webflow-2.3.1.BUILD-20120326.222621-13.jar
spring-webmvc-3.1.1.RELEASE.jar
stax-api-1.0-2.jar
tiles-api-2.1.3.jar
tiles-core-2.1.3.jar
tiles-jsp-2.1.3.jar
tiles-servlet-2.1.3.jar
urlrewritefilter-3.1.0.jar
validation-api-1.0.0.GA.jar
xalan-2.6.0.jar
xml-apis-1.0.b2.jar
xml-apis-1.3.02.jar
xmlParserAPIs-2.6.2.jar
xom-1.0.jar


如您所见,我的POM.XML正在导入同一文件的多个版本,我认为这可能是问题,但我不知道。作为Maven和Hibernate4的新手,我不知道真正的问题。期待听到一些回响...谢谢

这是我的mvndependency:tree的输出,但是我仍然看不到Hibernate3的来源:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building School Visit 1.0.0-BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ SchoolVisit ---
[INFO] org.uftwf.schoolvisit:SchoolVisit:war:1.0.0-BUILD-SNAPSHOT
[INFO] +- org.springframework:spring-orm:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-jdbc:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-aspects:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework.webflow:spring-faces:jar:2.3.1.BUILD-SNAPSHOT:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- org.springframework.webflow:spring-binding:jar:2.3.1.BUILD-SNAPSHOT:compile
[INFO] |  +- org.springframework.webflow:spring-js:jar:2.3.1.BUILD-SNAPSHOT:compile
[INFO] |  |  \- org.springframework.webflow:spring-js-resources:jar:2.3.1.BUILD-SNAPSHOT:compile
[INFO] |  \- org.springframework.webflow:spring-webflow:jar:2.3.1.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.0.7.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-ldap:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework.ldap:spring-ldap-core:jar:1.3.1.RELEASE:compile
[INFO] |     \- commons-lang:commons-lang:jar:2.5:compile
[INFO] +- org.springframework.security:spring-security-cas:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.jasig.cas.client:cas-client-core:jar:3.1.12:compile
[INFO] +- org.springframework.security:spring-security-cas-client:jar:3.0.7.RELEASE:compile
[INFO] |  \- org.jasig.cas:cas-client-core:jar:3.1.10:compile
[INFO] +- javax.transaction:jta:jar:1.1:compile
[INFO] +- javax.mail:mail:jar:1.4.5:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- cglib:cglib:jar:2.2.2:compile
[INFO] |  \- asm:asm:jar:3.3.1:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.21:compile
[INFO] +- c3p0:c3p0:jar:0.9.1.2:compile
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.2.1:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.2.1:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- org.aspectj:aspectjtools:jar:1.6.2:compile
[INFO] +- jstl:jstl:jar:1.2:compile
[INFO] +- org.slf4j:slf4j-ext:jar:1.5.10:compile
[INFO] |  \- ch.qos.cal10n:cal10n-api:jar:0.7.2:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.10:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.10:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.5.10:compile
[INFO] +- log4j:log4j:jar:1.2.16:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- com.sun.faces:jsf-api:jar:2.1.7:compile
[INFO] +- com.sun.faces:jsf-impl:jar:2.1.7:compile
[INFO] +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.1.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:4.1.1.Final:compile
[INFO] |  |  \- antlr:antlr:jar:2.7.7:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] |  +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.0.2.GA:compile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] |  |  \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  \- com.sun.xml.bind:jaxb-impl:jar:2.1.3:compile
[INFO] \- junit:junit:jar:4.7:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.291s
[INFO] Finished at: Fri Sep 14 09:06:33 EDT 2012
[INFO] Final Memory: 11M/162M
[INFO] ------------------------------------------------------------------------

最佳答案

我修好了它。我创建了一个新的maven webapp,并复制到pom.xml和源代码中,一切都很好。

关于java - 升级Spring WebFlow项目以使用Maven和Hibernate4。现在获取NoSuchMethodException:org.hibernate.cfg.Configuration.addAnnotatedClass,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12424423/

10-12 04:49