开发者

applicationContext-service.xml problem definitions

开发者 https://www.devze.com 2023-01-13 22:49 出处:网络
Working with spring, below, the code of applicationContext-service.xml: <bean id=\"mediaObjectService\" class=\"path.MediaObjectServiceImpl\">

Working with spring, below, the code of applicationContext-service.xml:

<bean id="mediaObjectService" class="path.MediaObjectServiceImpl">

 开发者_如何学Go       <property name="mediaObjectDao" >
            <ref bean="mediaObjectDao"/>
        </property>
        <property name="semanticQuestionDao" >
            <ref bean="semanticQuestionDao"/>
        </property> 
        <aop:scoped-proxy/>
    </bean>

And while doing a test, I get his error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.mediaObjectService' defined in class path resource [applicationContext-service.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: net.sf.cglib.proxy.Enhancer.setInterceptDuringConstruction(Z)V

As I know, the session scoped objects always have a prefix called scopedTarget. to the name of the bean-id.

So, if I am right, mediaObjectService is the bean-id, which is right declarated.

Maybe I am wrong, but anyway, I don't see the error I made.

Any help??

Thanks in advance


I used cglib-nodep-2.1_3.jar and it solved my problem


Google suggests this may be due to duplicate versions of the cglib library on your classpath.


Looks like your tests are running with an incompatible version of cglib.jar on their classpath, and its clashing with Spring's expectations. Make sure you're using the correct version, which is most likely 2.1_3.


The problem is the following:

I was testing in a web application project in java. In this application, applicationContext-service.xml has the tag <aop:scoped-proxy/>, which help eliminate scope impedance mismatches.
This tag is not well fixed with JUnit tests, so the solution for me, at least for now, is testing this service in other application.

Thans anyway for your comments


check the order in which cglib-2.1_3.jar has been defined in your .classpath file. Make sure it is defined before the spring jar's.

0

精彩评论

暂无评论...
验证码 换一张
取 消