linux - 我无法使用 java.lang.ClassFormatError : Incompatible magic value 0 in class file 在 linux 上的 tomcat 8.0.36/8.0.24 上部署 grails 应用程序

原文 标签 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 编译。相同的应用程序,相同的 war 在 windows 和 linux 的 vm box 上运行良好。

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

面临问题的 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
是否有任何我需要检查的 native 库或需要调整的一些操作系统参数?

最佳答案

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

将打开的文件增加到 4096 后,服务器开始工作。该应用程序似乎很重, war 中有 15000 多个文件。

关于linux - 我无法使用 java.lang.ClassFormatError : Incompatible magic value 0 in class file 在 linux 上的 tomcat 8.0.36/8.0.24 上部署 grails 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40987876/

相关文章:

java - Tomcat、Comet 和 getOutputStream() 已经为此响应调用

groovy - 树和列表在同一页面上

grails - 将独立的Solr搜索服务器与grails域object_集成

spring - Grails Spring DSL 未设置字符串属性

linux - 连接到远程网络上的Raspberry Pi(XFinity路由器)

linux - 启动apache2.4时出错

c - C编程-使用sudo特权执行另一个程序

linux - 从bash中的文件内容设置变量(循环)

tomcat - 连接到 JIRA 时出现间歇性 102 错误 (ERR_CONNECTION_REFUSED)

java - 从Maven Clean保存用户上传的文件