1

Eclipse の tomcat で spring MVC プロジェクトを実行すると、このエラーが発生します。

java.lang.ClassNotFoundException: org.springframework.cglib.proxy.MethodInterceptor

グーグルはエラーに関する結果を持っていません。

<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">

<tx:annotation-driven />     
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/resources/" />
<context:component-scan base-package="/"></context:component-scan>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"></property>
<property name="suffix" value=".jsp"></property>
</bean>

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:maxUploadSize="1000000" />

<bean id="personService" class="PersonService" />

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/database" />
    <property name="username" value="root" />
    <property name="password" value="root" />
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" /> 
    <property name="packagesToScan" value="/" />
    <property name="hibernateProperties">
        <props> 
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
        </props>
    </property>
</bean>

<bean id="transactionManger" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

cglib-2.2.3.jar を lib フォルダーに配置しましたが、違いはありません。

私は少し途方に暮れています。私はクラスを持っており、クラスが何のために必要かを理解していますが、春にこれを見せる方法がわかりません。

ありがとう。

4

2 に答える 2

0

実際には、クラスはありません。cglib-2.2.3.jarにはクラスが含まれていません。

どのバージョンのSpringFrameworkを使用していますか?XSDから、まだリリースされていないSpring3.2への参照が表示されます。最新のリリースバージョン(3.1.2)に固執する方が良いでしょう

于 2012-09-12T15:50:52.190 に答える
0

3.2 M2 以降、Spring は外部 JAR に依存しませんcglibが、元の JAR との衝突の可能性を減らすために名前が変更された独自のコピーを使用します。

3.2 M2 の時点で、新しい CGLIB 3.0 にアップグレードされました。すべての net.sf.cglib クラスを org.springframework.cglib に再パッケージ化し、spring-core JAR 内に直接インライン化します。これは、すべての @Configuration およびサブクラスのプロキシ機能が M2 ですぐに使用できることを意味し、CGLIB が他のプロジェクトと競合する可能性がないことを意味します。

詳細については、次のリンクを参照してください。

したがって、クラスパスに異なるSpringバージョンのJARがあると思います。それらがすべて 3.2 M2 バージョンであることを確認してください。

于 2012-09-20T09:12:51.063 に答える