我有一个grails应用程序,该应用程序使用 grails 2.1.0 , groovy 1.8.6 。当我运行“ grails run-app”时,应用程序启动,并且能够在浏览器中运行该应用程序,但是当我通过“ grails war”创建war并将其部署在Tomcat 7的webapp目录中时,应用无法运行。 在运行这些命令之前,我始终为 Java 6 分别设置 JAVA_HOME 和路径。该应用程序是旧的,基于 Java 6 。
部署战争并启动tomcat之后,当我检查应用程序似乎未运行时。当我检查日志 localhost.2019-07-05.log 时,它显示以下错误:
Jul 05, 2019 1:01:29 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jul 05, 2019 1:01:29 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jul 05, 2019 1:01:30 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: [Ljava/util/HashMap$Entry;
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: [Ljava/util/HashMap$Entry;
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
... 5 more
Caused by: java.lang.ClassNotFoundException: java.util.HashMap$Entry
... 9 more
Jul 05, 2019 1:01:30 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Jul 05, 2019 1:01:30 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Jul 05, 2019 1:01:31 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@4f9b20dd')
Jul 05, 2019 1:01:31 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@5a93f728')
我也尝试过通过将env设置为development( grails -Dgrails.env = development war )来制造战争,但是没有运气。我遇到同样的错误。