我无法在linux上使用java.lang.ClassFormatError在tomcat 8.0.36 / 8.0.24上部署grails应用程序:类文件中不兼容的魔术值0

时间:2016-12-06 04:31:39

标签: linux tomcat grails deployment tomcat8

我无法在运行于linux机器上的tomcat 8上部署grails 2.5.0应用程序。相同的应用程序在Windows上正常运行。虽然部署服务器启动会因某些或其他类而失败。


2016-11-29 05:09:06,234 [localhost-startStop-1] ERROR StackTrace  - Full Stack Trace:
java.lang.ClassFormatError: Incompatible magic value 0 in class file MarkdownGrailsPlugin$_closure1$_closure2
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2541)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:858)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1301)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
    at MarkdownGrailsPlugin$_closure1.doCall(MarkdownGrailsPlugin.groovy:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

获取错误的类文件的校验和与部署后在Windows机器上的内容不匹配。但是当我在WEB-INF/classes服务器启动时添加类文件但是在加载其他资源时失败或者在GSP编译中。相同的应用程序,相同的战争在Windows和vm的Linux盒上工作正常。

JDK / JRE甚至补丁级别在windows,linux机器上都是一样的。是否有任何必须增加的os参数。

面临问题的linux机器上的JDK / JRE的详细信息。

29-Nov-2016 05:07:40.966 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.36
29-Nov-2016 05:07:40.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 9 2016 13:55:50 UTC
29-Nov-2016 05:07:40.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.36.0
29-Nov-2016 05:07:40.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
29-Nov-2016 05:07:40.968 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            2.6.18-416.el5
29-Nov-2016 05:07:40.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
29-Nov-2016 05:07:40.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.7.0_79/jre
29-Nov-2016 05:07:40.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_79-b15
29-Nov-2016 05:07:40.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
29-Nov-2016 05:07:40.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /home/tomcat8/apache-tomcat-8.0.36
29-Nov-2016 05:07:40.969 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /home/tomcat8/apache-tomcat-8.0.36
29-Nov-2016 05:07:40.970 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/tomcat8/apache-tomcat-8.0.36/conf/logging.properties
29-Nov-2016 05:07:40.970 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
29-Nov-2016 05:07:40.970 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms2g
29-Nov-2016 05:07:40.970 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx4g
29-Nov-2016 05:07:40.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024m
29-Nov-2016 05:07:40.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.proxyHost=www-proxy.sct.com
29-Nov-2016 05:07:40.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.proxyPort=8080
29-Nov-2016 05:07:40.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
29-Nov-2016 05:07:40.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms2g
29-Nov-2016 05:07:40.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx4g
29-Nov-2016 05:07:40.971 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024m
29-Nov-2016 05:07:40.972 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.proxyHost=www-proxy.sct.com
29-Nov-2016 05:07:40.972 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.proxyPort=8080
29-Nov-2016 05:07:40.972 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote
29-Nov-2016 05:07:40.972 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=8999
29-Nov-2016 05:07:40.972 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
29-Nov-2016 05:07:40.972 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
29-Nov-2016 05:07:40.972 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=149.24.37.131
29-Nov-2016 05:07:40.973 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/home/tomcat8/apache-tomcat-8.0.36/endorsed
29-Nov-2016 05:07:40.973 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/tomcat8/apache-tomcat-8.0.36
29-Nov-2016 05:07:40.973 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/tomcat8/apache-tomcat-8.0.36
29-Nov-2016 05:07:40.973 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/tomcat8/apache-tomcat-8.0.36/temp

相同的应用程序在Windows机器上正常工作

30-Nov-2016 22:17:29.007 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.36
30-Nov-2016 22:17:29.009 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Jun 9 2016 13:55:50 UTC
30-Nov-2016 22:17:29.010 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.36.0
30-Nov-2016 22:17:29.011 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 8.1
30-Nov-2016 22:17:29.012 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.3
30-Nov-2016 22:17:29.012 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
30-Nov-2016 22:17:29.013 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.7.0_79\jre
30-Nov-2016 22:17:29.013 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_79-b15
30-Nov-2016 22:17:29.014 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
30-Nov-2016 22:17:29.014 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\sandbox\apache-tomcat-8.0.36
30-Nov-2016 22:17:29.015 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         C:\sandbox\apache-tomcat-8.0.36
30-Nov-2016 22:17:29.015 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024m
30-Nov-2016 22:17:29.016 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:PermSize=512m
30-Nov-2016 22:17:29.016 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms2048m
30-Nov-2016 22:17:29.017 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx4096m
30-Nov-2016 22:17:29.017 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DPROXY_SERVER_NAME=http://m039220:8081/nexus/content/groups/public
30-Nov-2016 22:17:29.017 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
30-Nov-2016 22:17:29.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\sandbox\apache-tomcat-8.0.36\conf\logging.properties
30-Nov-2016 22:17:29.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
30-Nov-2016 22:17:29.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms512m
30-Nov-2016 22:17:29.029 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx1524m
30-Nov-2016 22:17:29.035 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:PermSize=256m
30-Nov-2016 22:17:29.036 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:MaxPermSize=1024m
30-Nov-2016 22:17:29.042 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+CMSClassUnloadingEnabled
30-Nov-2016 22:17:29.049 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseConcMarkSweepGC
30-Nov-2016 22:17:29.050 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:-UseGCOverheadLimit
30-Nov-2016 22:17:29.086 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\sandbox\apache-tomcat-8.0.36\endorsed
30-Nov-2016 22:17:29.087 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\sandbox\apache-tomcat-8.0.36
30-Nov-2016 22:17:29.093 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\sandbox\apache-tomcat-8.0.36
30-Nov-2016 22:17:29.095 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\sandbox\apache-tomcat-8.0.36\temp
是否有我需要检查的本机库或需要调整的某些OS参数?

2 个答案:

答案 0 :(得分:1)

问题在于服务器上的打开文件。在VM中,值设置为4096,而在我们面临问题的服务器上设置为1024.

将打开的文件增加到4096后,服务器开始工作。在战争中,应用程序似乎很重,有15000个奇怪的文件。

答案 1 :(得分:0)

很可能这个类是为Java 8编译的,而你的JVM是Java 7.这可能是Grails(Markdown插件)发行版中的一个错误,或者你混合了这些版本。