当前位置: 代码迷 >> J2EE >> Spring3.1和Hibernate3.6整合有关问题
  详细解决方案

Spring3.1和Hibernate3.6整合有关问题

热度:52   发布时间:2016-04-22 00:58:17.0
Spring3.1和Hibernate3.6整合问题
原本是打算整合Spring3.1、Hibernate3.6和Struts2.2的,但是把Spring3.1和Hibernate3.6整合到一起的时候就出问题了。
我添加的JAR包有:

antlr-2.7.6.jar

c3p0-0.9.1.jar

cglib-2.2.jar

commons-collections-3.1.jar

commons-io-2.0.1.jar

commons-lang3-3.0-beta.jar

commons-logging-1.1.1.jar

dom4j-1.6.1.jar

ehcache-1.5.0.jar

hibernate-jpa-2.0-api-1.0.0.Final.jar

hibernate3.jar

javassist-3.12.0.GA.jar

jta-1.1.jar

mysql-connector-java-5.1.14-bin.jar

org.springframework.aop-3.1.0.M1.jar

org.springframework.asm-3.1.0.M1.jar

org.springframework.aspects-3.1.0.M1.jar

org.springframework.beans-3.1.0.M1.jar

org.springframework.context-3.1.0.M1.jar

org.springframework.context.support-3.1.0.M1.jar

org.springframework.core-3.1.0.M1.jar

org.springframework.expression-3.1.0.M1.jar

org.springframework.jms-3.1.0.M1.jar

org.springframework.orm-3.1.0.M1.jar

org.springframework.oxm-3.1.0.M1.jar

org.springframework.spring-library-3.1.0.M1.libd

org.springframework.transaction-3.1.0.M1.jar

org.springframework.web-3.1.0.M1.jar

org.springframework.web.struts-3.1.0.M1.jar

slf4j-api-1.6.1.jar

slf4j-log4j12-1.6.1.jar



运行Main方法测试的时候出错信息是:

2011-4-9 15:13:19 org.springframework.context.support.AbstractApplicationContext prepareRefresh信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1608e05: startup date [Sat Apr 09 15:13:19 GMT+08:00 2011]; root of context hierarchy2011-4-9 15:13:19 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [applicationContext.xml]Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptorat org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:509)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:427)at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)at JUnit.SSJMainTest.main(SSJMainTest.java:14)Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptorat java.lang.ClassLoader.defineClass1(Native Method)at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)at java.lang.ClassLoader.defineClass(ClassLoader.java:616)at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)at java.net.URLClassLoader.access$000(URLClassLoader.java:58)at java.net.URLClassLoader$1.run(URLClassLoader.java:197)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:190)at java.lang.ClassLoader.loadClass(ClassLoader.java:307)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)at java.lang.ClassLoader.loadClass(ClassLoader.java:248)at org.springframework.transaction.config.TxAnnotationDrivenExecutor$AopAutoProxyConfigurer.configureAutoProxyCreator(TxAnnotationDrivenExecutor.java:113)at org.springframework.transaction.config.TxAnnotationDrivenExecutor.doExecute(TxAnnotationDrivenExecutor.java:11)at org.springframework.transaction.config.TxAnnotationDrivenExecutor.doExecute(TxAnnotationDrivenExecutor.java:1)at org.springframework.context.config.AbstractSpecificationExecutor.execute(AbstractSpecificationExecutor.java:43)at org.springframework.context.config.AbstractFeatureSpecification.execute(AbstractFeatureSpecification.java:75)at org.springframework.context.config.AbstractSpecificationBeanDefinitionParser.parse(AbstractSpecificationBeanDefinitionParser.java:44)at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1411)at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:188)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:144)at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:114)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)... 14 moreCaused by: java.lang.ClassNotFoundException: org.aopalliance.intercept.MethodInterceptorat java.net.URLClassLoader$1.run(URLClassLoader.java:202)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:190)at java.lang.ClassLoader.loadClass(ClassLoader.java:307)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)at java.lang.ClassLoader.loadClass(ClassLoader.java:248)... 40 more
  相关解决方案