spring2.0常见异常

1: Exception in thread "main" java.lang.NoClassDefFoundError : org/apache/commons/logging/LogFactory at org.springframework.util.ClassUtils.<clinit>(ClassUtils.java:67) at org.springframework.core.io.DefaultResourceLoader.<init>(DefaultResourceLoader.java:52) at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:184) at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:80) at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:58) at
需要加上:commons-logging.jar log4j-1.2.11.jar

2: Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException : Unexpected exception parsing XML document from class path resource [text.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
at java.lang.Class.forName0(Native Method)

需要加上:aspectjweaver.jar

3: Exception in thread "main" org.springframework.beans.factory.BeanCreationException : Error creating bean with name 'logBean' defined in class path resource [text.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
Caused by: org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
需要加上:cglib-2.1.3.jar


4: Exception in thread "main" org.springframework.beans.factory.BeanCreationException : Error creating bean with name 'logBean' defined in class path resource [text.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type
Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type
at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180)
需要加上:asm.jar
转载:http://pengchua.javaeye.com/blog/142879

5: CGLIB Enhancement failed: com.bowen.domain.Schools
java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java:77)
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:173)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
解决:由于不同版本让我想到了可能会因为其它三方包是不同版本引起的最新的MyEclipse,所以里面的Hibernate也是最新的3.1(它里面还带有一个3.0版本的)
删除 多余的包 Hibernate3.1现象2:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource [/WEB-INF/dataAccessContext-hibernate.xml] of ServletContext: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
java.lang.NoClassDefFoundError: javax/transaction/TransactionManager

原因:缺少jta.jar

6 .Unexpected exception parsing XML document from class path resource [exer/applicationContext.xml]; nested exception is java.lang.SecurityException: class "org.springframework.beans.factory.support.GenericBeanDefinition "'s signer information does not match signer information of other classes in the same package
Caused by: java.lang.SecurityException: class "org.springframework.beans.factory.support.GenericBeanDefinition"'s signer information does not match signer information of other classes in the same package

原因:jar包冲突,spring.jar和spring-core.jar冲突
解决:保留spring.jar,spring-web.jar,spring-context.jar

你可能感兴趣的:(java,spring,AOP,bean,Hibernate)