weblogic9.1 spring mybatis 部署异常
异常信息如下:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in ServletContext resource [/WEB-INF/spring/spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/mybatis/spring/SqlSessionTemplate : org/apache/ibatis/session/SqlSession
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:532)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:198)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeansOfType(DefaultListableBeanFactory.java:439)
at org.springframework.context.support.AbstractApplicationContext.invoke
BeanFactoryPostProcessors(AbstractApplicationContext.java:624)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebA
pplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:112)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run
(EventsManager.java:374)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(Eve
ntsManager.java:83)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:1581)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletCon
text.java:2678)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:874)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:326)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(Module
ListenerInvoker.java:114)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartMod
ulesFlow.java:25)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.ja
va:640)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:26)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.
java:252)
at weblogic.application.internal.DeploymentStateChecker.activate(Deploym
entStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(Ap
pContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.ac
tivate(AbstractOperation.java:567)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.ac
tivateDeployment(ActivateOperation.java:131)
Caused by: java.lang.NoClassDefFoundError: org/mybatis/spring/SqlSessionTemplate
: org/apache/ibatis/session/SqlSession
at java.lang.ClassLoader.defineClass(Ljava.lang.String;[BIILjava.securit
y.ProtectionDomain;)Ljava.lang.Class;(Unknown Source)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericCla
ssLoader.java:274)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(Generic
ClassLoader.java:227)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
Loader.java:195)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAw
areClassLoader.java:54)
at java.lang.ClassLoader.loadClass(Ljava.lang.String;Z)Ljava.lang.Class;
(Unknown Source)
at java.lang.ClassLoader.loadClass(Ljava.lang.String;)Ljava.lang.Class;(
Unknown Source)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClass
Loader.java:130)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAw
areClassLoader.java:35)
at java.lang.ClassLoader.loadClassFromNative(Ljava.lang.String;)Ljava.la
ng.Class;(Unknown Source)
at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Lj
ava.lang.Class;(Unknown Source)
at jrockit.reflect.MemberAccess.getClassesFromMethodDesc(Ljava.lang.Stri
ng;Ljava.lang.ClassLoader;)[Ljava.lang.Class;(Unknown Source)
at java.lang.reflect.Method.getParameterTypes0()[Ljava.lang.Class;(Unkno
wn Source)
at java.lang.reflect.Method.getParameterTypes()[Ljava.lang.Class;(Unknow
n Source)
at org.springframework.beans.ExtendedBeanInfo.isCandidateWriteMethod(Ext
endedBeanInfo.java:133)
at org.springframework.beans.ExtendedBeanInfoFactory.supports(ExtendedBe
anInfoFactory.java:54)
at org.springframework.beans.ExtendedBeanInfoFactory.getBeanInfo(Extende
dBeanInfoFactory.java:44)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedInt
rospectionResults.java:236)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedI
ntrospectionResults.java:152)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResul
ts(BeanWrapperImpl.java:321)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorIntern
al(BeanWrapperImpl.java:351)
at org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrap
perImpl.java:427)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1395)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1134)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:295)
哪位高手碰到过这个问题,请告知解决方案。 --------------------编程问答-------------------- jar包冲突,ctrl+shift+T查看下,是不是有多个版本。
java.lang.NoClassDefFoundError: org/mybatis/spring/SqlSessionTemplate : org/apache/ibatis/session/SqlSession --------------------编程问答-------------------- 没有导入mybatis的jar包 --------------------编程问答-------------------- 把
mybatis-spring-1.1.1.jar
这个包导入进来就可以了。 --------------------编程问答-------------------- MyBatis 开发的时候,Spring3.0 已经研发完毕。
所以 spring 自己的包里是没有对 Mybatis 支持的。
mybatis-spring-1.1.1.jar 是 Mybatis 社区自己开发的 Mybatis-Spring 来整合的。 --------------------编程问答-------------------- 这些包都都有了,在tomcat中部署没有问题,换到了weblogic9.1就出现这个问题了。
补充:Java , Web 开发