0

我正在将 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);
}
4

1 回答 1

0

请注意,GAE 下不直接支持 Hibernate:

http://code.google.com/p/googleappengine/wiki/WillItPlayInJava

此外,如果这与您之前的问题有关,重要的是要指出,简单地将字节码操作库替换为较旧的库,虽然它在某些情况下可能有效,但几乎可以肯定是一个坏主意。库依赖项的任意混合和匹配,特别是在这样一个基础级别上运行的依赖项,不是一个好方法,IMO。

于 2012-06-18T10:03:36.957 回答