-1

我有使用 spring + spring security + hibernate 使用 netbeans 开发的应用程序,并在 tomcat 中运行。我试图将此项目移至 Google App Engine,因此我决定将其移至 Eclipse,因为考虑到 Eclipse 具有 GAE 插件,我认为它更容易。

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
    Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V

这是我的调度员 servlet

    <?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: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">

        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

        <bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
            <property name="driverClassName" value="org.springframework.jdbc.datasource.DriverManagerDataSource"/>
            <property name="url" value="jdbc:google:rdbms://instancename/databasename"/>

        </bean>



        <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <property name="dataSource" ref="myDataSource" />
            <property name="annotatedClasses">
                <list>
                    <value>com.pulsa.bean.User</value>
                    <value>com.pulsa.bean.Customer</value>
                    <value>com.pulsa.bean.TableID</value>
                    <value>com.pulsa.bean.Balance</value>
                    <value>com.pulsa.bean.Capital</value>
                    <value>com.pulsa.bean.Contact</value>
                    <value>com.pulsa.bean.Product</value>
                    <value>com.pulsa.bean.Provider</value>
                    <value>com.pulsa.bean.Supplier</value>
                    <value>com.pulsa.bean.Transactions</value>
                </list>
            </property> 
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
                    <prop key="hibernate.show_sql">true</prop>
                    <prop key="hibernate.hbm2ddl.auto">create</prop>
                </props>
            </property>  
        </bean>

        <bean id="myUserDAO" class="com.dao.UserDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="myTableIDDAO" class="com.dao.TableIDDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>


        <bean class="com.util.SessionHelper" >
            <property name="userDAO" ref="myUserDAO" />
        </bean>

        <bean id="myBalanceDAO" class="com.dao.BalanceDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="myCapitalDAO" class="com.dao.CapitalDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
            <property name="balanceDAO" ref="myBalanceDAO" />
        </bean>

        <bean id="myContactDAO" class="com.dao.ContactDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="myProductDAO" class="com.dao.ProductDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="myProviderDAO" class="com.dao.ProviderDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="mySupplierDAO" class="com.dao.SupplierDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="myTransactionDAO" class="com.dao.TransactionDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="myCustomerDAO" class="com.dao.CustomerDAOImpl">
            <property name="sessionFactory" ref="mySessionFactory"/>
        </bean>

        <bean id="pageMaster" class="com.pulsa.bean.Page"></bean>

        <bean id="pageTransaction" class="com.pulsa.bean.TransactionPage"></bean>

        <bean name="/user/*.htm" class="com.controller.UserController" >
            <property name="userDAO" ref="myUserDAO" />
            <property name="page">
                <ref local="pageMaster"/>
            </property>
        </bean>

        <bean name="/supplier/*.htm" class="com.controller.SupplierController" >
            <property name="supplierDAO" ref="mySupplierDAO" />
            <property name="page">
                <ref local="pageMaster"/>
            </property>
        </bean>

        <bean name="/common/*.htm" class="com.controller.LoginController" >
            <property name="userDAO" ref="myUserDAO" />
        </bean>

        <bean name="/customer/*.htm" class="com.controller.CustomerController" >
            <property name="customerDAO" ref="myCustomerDAO" />
            <property name="userDAO" ref="myUserDAO" />
            <property name="contactDAO" ref="myContactDAO" />
            <property name="providerDAO" ref="myProviderDAO" />
            <property name="page">
                <ref local="pageMaster"/>
            </property>
        </bean>

        <bean name="/transaction/*.htm" class="com.controller.TransactionController" >
            <property name="transactionDAO" ref="myTransactionDAO" />
            <property name="productDAO" ref="myProductDAO" />
            <property name="customerDAO" ref="myCustomerDAO" />
            <property name="contactDAO" ref="myContactDAO" />
            <property name="tableIDDAO" ref="myTableIDDAO" />
            <property name="balanceDAO" ref="myBalanceDAO" />
            <property name="page">
                <ref local="pageTransaction"/>
            </property>
        </bean>

        <bean name="/product/*.htm" class="com.controller.ProductController" >
            <property name="productDAO" ref="myProductDAO" />
            <property name="userDAO" ref="myUserDAO" />
            <property name="supplierDAO" ref="mySupplierDAO" />
            <property name="providerDAO" ref="myProviderDAO" />
            <property name="page">
                <ref local="pageMaster"/>
            </property>
        </bean>

        <bean name="/balance/*.htm" class="com.controller.BalanceController" >
            <property name="balanceDAO" ref="myBalanceDAO" />
            <property name="capitalDAO" ref="myCapitalDAO" />
            <property name="transactionDAO" ref="myTransactionDAO" />
            <property name="userDAO" ref="myUserDAO" />
            <property name="supplierDAO" ref="mySupplierDAO" />
            <property name="page">
                <ref local="pageMaster"/>
            </property>
        </bean>

        <bean name="/capital/*.htm" class="com.controller.CapitalController" >
            <property name="balanceDAO" ref="myBalanceDAO" />
            <property name="capitalDAO" ref="myCapitalDAO" />
            <property name="transactionDAO" ref="myTransactionDAO" />
            <property name="userDAO" ref="myUserDAO" />
            <property name="supplierDAO" ref="mySupplierDAO" />
            <property name="tableIDDAO" ref="myTableIDDAO" />
            <property name="page">
                <ref local="pageMaster"/>
            </property>
        </bean>

        <bean name="/json/*.htm" class="com.controller.JSONController" >
            <property name="customerDAO" ref="myCustomerDAO" />
            <property name="productDAO" ref="myProductDAO" />
        </bean>

    </beans>

这是我的课程路径

    /webpulsa/war/WEB-INF/lib/aopalliance-1.0.jar
    /webpulsa/war/WEB-INF/lib/commons-logging-1.1.1.jar
    /webpulsa/war/WEB-INF/lib/spring-aop-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-asm-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-beans-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-context-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-context-support-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-core-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-expression-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-webmvc-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/antlr-2.7.6.jar
    /webpulsa/war/WEB-INF/lib/commons-collections-2.1.1.jar
    /webpulsa/war/WEB-INF/lib/dom4j-1.6.1.jar
    /webpulsa/war/WEB-INF/lib/ehcache-1.2.3.jar
    /webpulsa/war/WEB-INF/lib/hibernate-annotations.jar
    /webpulsa/war/WEB-INF/lib/hibernate-entitymanager.jar
    /webpulsa/war/WEB-INF/lib/hibernate-tools.jar
    /webpulsa/war/WEB-INF/lib/hibernate3.jar
    /webpulsa/war/WEB-INF/lib/jdbc2_0-stdext.jar
    /webpulsa/war/WEB-INF/lib/jackson-annotations-2.0.1.jar
    /webpulsa/war/WEB-INF/lib/jackson-core-2.0.1.jar
    /webpulsa/war/WEB-INF/lib/jackson-databind-2.0.1.jar
    /webpulsa/war/WEB-INF/lib/json-lib-2.2.2-jdk15.jar
    /webpulsa/war/WEB-INF/lib/spring-security-acl-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-acl-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-aspects-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-aspects-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-cas-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-cas-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-config-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-config-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-core-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-core-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-ldap-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-ldap-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-openid-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-openid-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-taglibs-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-taglibs-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-security-web-3.1.0.RC2-sources.jar
    /webpulsa/war/WEB-INF/lib/spring-security-web-3.1.0.RC2.jar
    /webpulsa/war/WEB-INF/lib/spring-orm-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-aspects-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-jdbc-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-jms-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-oxm-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-struts-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-test-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-tx-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/spring-webmvc-portlet-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/mysql-connector-java-5.1.17-bin.jar
    /webpulsa/war/WEB-INF/lib/spring-web-3.1.1.RELEASE.jar
    /webpulsa/war/WEB-INF/lib/hibernate-commons-annotations.jar
    /webpulsa/war/WEB-INF/lib/javassist.jar
    /webpulsa/war/WEB-INF/lib/cglib-2.2.jar
    /webpulsa/war/WEB-INF/lib/asm-attrs.jar
    /webpulsa/war/WEB-INF/lib/asm.jar

我的项目有问题吗?我还将该库放在我的 App Engine lib/impl 中,但也无法正常工作...

ps:可能与错误有关:java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V但我仍然没有修复我的项目..请帮助..提前谢谢。

4

1 回答 1

0

A java.lang.NoSuchMethodError(在您的情况下(java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V))表示类(ClassWriter)存在,但方法(在您的情况下:带有布尔参数的构造函数)不存在。

如果存在不兼容的库,则经常会出现这种错误:一个库需要lib B的x版本,但您有lib B的y版本。这两个版本不兼容。

如果您的项目使用 Netbeans 运行,但没有使用 Eclipse,那么我猜您在将项目从一个 IDE 移动到另一个 IDE 时修改了库。

在您的情况下,Class DebuggingClassWriterfromcgilib-2.2.jar在其构造函数中调用其超类的构造函数(带有一个布尔参数)ClassWriterfrom asm.jar(不幸的是,您没有指定asm.jar您使用的版本)。但我可以告诉你,例如asm-3.1.jar包含你需要的构造函数。

顺便说一句:我cglib-nodep-2.2.jar与 一起使用asm-3.1.jar,它可以工作

于 2012-12-14T06:46:31.190 回答