13
回答
spring 2.5.6转spring 3.0.4的问题?高手请指示。
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

在spring 2.5.6中bean 注入 

<bean id="userRegService" class="com.msd.msdPay.service.impl.UserRegServiceImpl"/>

<bean name="/HessianReg"

class="com.msd.commons.util.HessianServiceExporter">

<!--需要导出的目标bean-->

<property name="service" ref="userRegService" />

<!--Hessian服务的接口-->

<property name="serviceInterface" value="com.msd.msdPay.service.UserRegService" />

</bean>

但转为spring 3.0.4后报错了.

严重: StandardWrapper.Throwable

org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/HessianReg' defined in ServletContext resource [/WEB-INF/Hessian-servlet.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)

at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)

at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)

at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)

at javax.servlet.GenericServlet.init(GenericServlet.java:151)

at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1164)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1118)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1005)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4529)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4809)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:785)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:763)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:557)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1124)

at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1047)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:542)

at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1390)

at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:355)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)

at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:313)

at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:293)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:996)

at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)

at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)

at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)

at org.apache.catalina.core.StandardService.startInternal(StandardService.java:427)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)

at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)

at org.apache.catalina.startup.Catalina.start(Catalina.java:585)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)

Caused by: java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

at java.lang.Class.getConstructor0(Class.java:2699)

at java.lang.Class.getDeclaredConstructor(Class.java:1985)

at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:65)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)

... 51 more

Caused by: java.lang.ClassNotFoundException: org.aopalliance.aop.Advice

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1666)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1511)

... 57 more

举报
sunney888
发帖于7年前 13回/4K+阅
共有13个答案 最后回答: 7年前

发现是 spring 3.0 与 hessian 4.0.7有兼容性问题,在官网又说这个问题处理了。不知道是为什么不行,应该是WEW.XML的配置有问题。请路过的大虾指点一下。

引用来自#2楼“puras”的帖子

别的不知道,只知道你应该是少包。

java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice

我把spring 3.0.4的21个包要了,还是spring 3 与 hessian 的问题。

以前都是用spring 2.5.6 与hessian 3.1.5 很方便很好用,但spring想升级到3.0,但又与hessian 4.0.7或其它版本合不来。晕到。有高手指点一下吗。

顶部