java.lang.NoClassDefFoundError:部署到Google App Engine时无法初始化类net.sf.cglib.proxy.Enhancer

时间:2013-04-01 20:39:17

标签: java google-app-engine spring-mvc

我正在使用Spring框架和Google App Engine构建Web应用程序。在开发服务器中它可以工作但是在部署到Google App Engine服务器时我遇到了这个错误

Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

Initialization of bean failed; nested exception is java.lang.IncompatibleClassChangeError: class net.sf.cglib.core.DebuggingClassWriter has interface org.objectweb.asm.ClassVisitor as super class

第一个错误显示我似乎错过了cglib.jar中的net.sf.cglib.proxy.Enhancer但是当我检查它已经存在时。我无法理解第二个日志

我在classpath中使用了几个jar文件:

asm-4.0
asm-util-4.0
cglib-3.0
app engine sdk 1.7.6
spring framework 3.2.0

有什么问题?我该如何解决?

提前致谢

2 个答案:

答案 0 :(得分:9)

看起来Spring 3.2已经包含了cglib和asm(参见发行说明的第4.21项:http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/spring-framework-reference/html/new-in-3.2.html)。他们在弹簧核心罐子里。

你应该尝试从类路径中删除asm和cglib jar,看看它是否有任何区别。

答案 1 :(得分:0)

如下所示,从poium.xml文件的appium java-client中排除cglib依赖项。经过大量的Google搜索,这为我解决了这个问题。

<dependency>
      <groupId>io.appium</groupId>
      <artifactId>java-client</artifactId>
      <version>7.3.0</version>
      <exclusions>
        <exclusion>
          <groupId>cglib</groupId>
          <artifactId>cglib</artifactId>
        </exclusion>
      </exclusions>
    </dependency>