我正在将Struts / Hibernate应用程序转换为Google App Engine。当我尝试启动应用程序的首页时,我收到以下错误消息。任何人都可以帮我这个吗?
java.lang.IllegalAccessError
at net.sf.cglib.core.ClassEmitter.setTarget(ClassEmitter.java:47)
at net.sf.cglib.core.ClassEmitter.<init>(ClassEmitter.java:39)
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at org.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:321)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
at com.configuration.ConfigurationListener.contextInitialized(ConfigurationListener.java:19)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:196)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:189)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:128)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:104)
上述错误消息中有一个名为ConfigurationListener的类的引用。这是我提供的一个类,它为应用程序获取数据库会话。这是发生错误的方法,我已经标记了哪一行是第19行。
public void contextInitialized(ServletContextEvent contextEvent) {
/* The following line is line 19. */
this.sessionFactory = this.configuration.configure().buildSessionFactory();
this.context = contextEvent.getServletContext();
this.context.setAttribute("sessionFactory", sessionFactory);
}
答案 0 :(得分:0)
请注意,GAE不直接支持Hibernate:
http://code.google.com/p/googleappengine/wiki/WillItPlayInJava
此外,如果这与您的previous question有关,请务必指出只需将字节码操作库替换为较旧的字节码操作库,而可能在某些的情况,几乎可以肯定是一个坏主意。图书馆依赖关系的任意混合和匹配,特别是那些在这种基础层面运作的依赖关系,并不是一种好的方法,IMO。