当我试图在响应时请求休息服务时它会异常..
Feb 21, 2013 2:34:49 PM com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at de.vogella.jpa.simple.main.Main.getObj(Main.java:18)
at com.poshs.webapp.MyResource.setIt(MyResource.java:43)
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)
这个结果我得到了运行mvn依赖:tree
[INFO] +- com.sun.jersey:jersey-server:jar:1.8:compile
[INFO] | +- asm:asm:jar:3.1:compile
[INFO] | \- com.sun.jersey:jersey-core:jar:1.8:compile
[INFO] +- com.sun.jersey:jersey-json:jar:1.8:compile
[INFO] | +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] | | \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | \- javax.activation:activation:jar:1.1:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.7.1:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.7.1:compile
[INFO] | +- org.codehaus.jackson:jackson-jaxrs:jar:1.7.1:compile
[INFO] | \- org.codehaus.jackson:jackson-xc:jar:1.7.1:compile
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] +- com.sun.jersey:jersey-client:jar:1.8:test
[INFO] +- org.glassfish.distributions:web-all:jar:10.0-build-20080430:test
[INFO] +- org.glassfish.embedded:gf-embedded-api:jar:1.0-alpha-4:test
[INFO] | +- org.glassfish.api:dtds:jar:resources:9.0.2:test
[INFO] | \- org.glassfish.api:schemas:jar:resources:9.0.2:test
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.0-alpha4:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.0-beta1:compile
[INFO] | \- commons-codec:commons-codec:jar:1.3:compile
[INFO] +- com.google.code.gson:gson:jar:2.2.2:compile
[INFO] +- org.apache.openejb:commons-dbcp-all:jar:1.3-r699049:compile
[INFO] +- org.apache.directory.studio:org.apache.commons.pool:jar:1.6:compile
[INFO] | \- commons-pool:commons-pool:jar:1.6:compile
[INFO] +- org.nuiton.thirdparty:asm-attrs:jar:1.5.4-snapshot:compile
[INFO] +- org.sonatype.sisu.inject:cglib:jar:2.2.2:compile
[INFO] +- org.jvnet.hudson.dom4j:dom4j:jar:1.6.1-hudson-3:compile
[INFO] +- org.hibernate:ejb3-persistence:pom:3.3.2.Beta1:compile
[INFO] +- org.hibernate:hibernate:jar:3.2.6.ga:compile
[INFO] | +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] | +- javax.transaction:jta:jar:1.0.1B:compile
[INFO] | +- asm:asm-attrs:jar:1.5.3:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | \- cglib:cglib:jar:2.1_3:compile
[INFO] +- org.hibernate:hibernate-annotations:jar:3.2.1.ga:compile
[INFO] | \- javax.persistence:persistence-api:jar:1.0:compile
[INFO] +- org.hibernate:hibernate-commons-annotations:jar:3.0.0.ga:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.2.1.ga:compile
[INFO] | +- jboss:javassist:jar:3.3.ga:compile
[INFO] | \- jboss:jboss-archive-browsing:jar:5.0.0alpha-200607201-119:compile
[INFO] +- org.hibernate:hibernate-validator-annotation-processor:jar:5.0.0.Beta1:compile
[INFO] +- commons-beanutils:commons-beanutils-bean-collections:jar:1.8.3:compile
[INFO] +- jboss:jboss-common:jar:4.2.2.GA:compile
[INFO] +- javassist:javassist:jar:3.12.1.GA:compile
[INFO] +- hibernate:hibernate-entitymanager:pom:3.4.0.GA:compile
[INFO] | +- org.hibernate:ejb3-persistence:jar:1.0.2.GA:compile
[INFO] | \- org.hibernate:hibernate-core:jar:3.3.0.SP1:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.0.0.Beta1:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Beta3:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.1.GA:compile
[INFO] | +- com.fasterxml:classmate:jar:0.8.0:compile
[INFO] | +- de.odysseus.juel:juel-spi:jar:2.2.5:compile
[INFO] | +- de.odysseus.juel:juel-api:jar:2.2.5:compile
[INFO] | \- de.odysseus.juel:juel-impl:jar:2.2.5:compile
[INFO] +- commons-collections:commons-collections:jar:3.1:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.2:compile
[INFO] +- com.google.sitebricks:slf4j:jar:0.8.3:compile
[INFO] | \- com.google.inject:guice:jar:2.0:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.2:compile
[INFO] | \- log4j:log4j:jar:1.2.17:compile
[INFO] +- postgresql:postgresql:jar:9.1-901.jdbc4:compile
[INFO] +- com.tunnelvisionlabs:antlr4:jar:4.0:compile
[INFO] | +- com.tunnelvisionlabs:antlr4-runtime:jar:4.0:compile
[INFO] | | \- org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1:compile
[INFO] | +- org.antlr:antlr-runtime:jar:3.5:compile
[INFO] | | \- org.antlr:stringtemplate:jar:3.2.1:compile
[INFO] | \- org.antlr:ST4:jar:4.0.7:compile
[INFO] +- cglib:cglib-nodep:jar:2.2.2:compile
[INFO] +- org.ow2.asm:asm:jar:4.1:compile
[INFO] \- org.ow2.asm:asm-util:jar:4.1:compile
[INFO] \- org.ow2.asm:asm-tree:jar:4.1:compile
这是在运行mvn依赖项:tree之后得到的, 我检查了我对cglib的依赖,但我不确定版本是否兼容,请检查让我知道哪些兼容我的项目。
由于
答案 0 :(得分:1)
对于cglib,你可能会错过一个jar。
这是什么时候发生的(unitTest,已部署)? 你如何建立你的项目(Maven,ant)?哪个版本的Hibernate?没有一些信息很难帮助你。
编辑:尝试运行mvn dependency:tree
并在此处发布结果,我们应该看看有什么问题
编辑:你有2个版本的cglib。你不应该手动包含cglib,因为它已经被hibernate包含为传递依赖。
答案 1 :(得分:0)
只需检查项目中有多少cglib JAR。尝试确保对于您的项目+框架版本,您有所需的cglib JAR而不是一些额外的JAR浮动。
答案 2 :(得分:0)
你在课程路径上错过了什么。这就是它显示“MappableContainerException”的原因。此异常与数据库管理器有关。那么请你停止服务器,清理并重新部署它。感谢。