将grails 2.5.5 app部署到tomcat 7

时间:2017-09-02 13:23:58

标签: tomcat grails web-deployment

我试图将Grails 2.5.5应用程序部署到Tomcat 7(在Ubuntu服务器上运行)。我使用Intellij 14中的命令war -stacktrace -verbose来创建war文件。在我的target目录中,它成功创建了war文件,让我们称之为myapp-0.1.war。然后在终端(我使用Linux Mint)我使用以下命令将其复制到我的服务器(我在下面的示例中替换了我的详细信息,例如mypcusernamemyserverusername和{{ 1}})

123.123.123.123

不要担心上述命令的rsync -rtvW --delete /home/mypcusername/NetbeansProjects/myapp/target/myapp-0.1.war/ myserverusername@123.123.123.123:/home/myserverusername/myapp-0.1.war/ 部分,它最初是一个Netbeans项目。然后我使用NetbeansProjects后跟sudo cp -a myapp-0.1.war/ /var/lib/tomcat7/webapps/删除原始sudo rm -R ROOT目录。然后我运行了ROOT,这就是问题所在。日志给了我以下内容:

sudo service tomcat7 restart

编辑感谢suricatta,我按照他的指示创建和chowning所有这些警告消失的目录。我正在更新日志。

由于最初提出这个问题,我意识到我从未真正将.war文件复制到我的服务器,因为当我尝试提取文件时,它会告诉我类似于&#34;您无法提取目录&#34 34;,然后我注意到每次使用Sep 03, 2017 10:23:39 AM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["http-bio-8080"] Sep 03, 2017 10:23:39 AM org.apache.catalina.core.StandardService stopInternal INFO: Stopping service Catalina Sep 03, 2017 10:23:39 AM org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["http-bio-8080"] Sep 03, 2017 10:23:39 AM org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["http-bio-8080"] Sep 03, 2017 10:23:43 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Sep 03, 2017 10:23:43 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1734 ms Sep 03, 2017 10:23:43 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Sep 03, 2017 10:23:43 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu) Sep 03, 2017 10:23:43 AM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT Sep 03, 2017 10:24:18 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined Sep 03, 2017 10:24:18 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://www.springframework.org/tags/form is already defined 2017-09-03 10:24:26,325 [localhost-startStop-1] ERROR context.ContextLoader - Context initialization failed 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 org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622) at java.lang.Thread.run(Thread.java:748) Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! ... 5 more Caused by: java.lang.UnsupportedClassVersionError: grails/plugin/cache/CacheConfigArtefactHandler : Unsupported major.minor version 52.0 (unable to load class grails.plugin.cache.CacheConfigArtefactHandler) at CacheGrailsPlugin.<init>(CacheGrailsPlugin.groovy:49) ... 5 more 2017-09-03 10:24:26,330 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! 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 org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622) at java.lang.Thread.run(Thread.java:748) Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! ... 5 more Caused by: java.lang.UnsupportedClassVersionError: grails/plugin/cache/CacheConfigArtefactHandler : Unsupported major.minor version 52.0 (unable to load class grails.plugin.cache.CacheConfigArtefactHandler) at CacheGrailsPlugin.<init>(CacheGrailsPlugin.groovy:49) ... 5 more 2017-09-03 10:24:26,332 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing Grails: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! 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 org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622) at java.lang.Thread.run(Thread.java:748) Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [CacheGrailsPlugin]! ... 5 more Caused by: java.lang.UnsupportedClassVersionError: grails/plugin/cache/CacheConfigArtefactHandler : Unsupported major.minor version 52.0 (unable to load class grails.plugin.cache.CacheConfigArtefactHandler) at CacheGrailsPlugin.<init>(CacheGrailsPlugin.groovy:49) ... 5 more Sep 03, 2017 10:24:26 AM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart Sep 03, 2017 10:24:26 AM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [] startup failed due to previous errors Sep 03, 2017 10:24:26 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Sep 03, 2017 10:24:26 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 43228 ms 时它都会创建一个名为myapp-0.1.war的空目录。

然后我使用rsync -rtvW --delete /home/mypcusername/NetbeansProjects/myapp/target/myapp-0.1.war/ myserverusername@123.123.123.123:/home/myserverusername/myapp-0.1.war/确实将战争复制到我的服务器。这次在/ var / lib / tomcat7 / webapps / ROOT中提取实际文件后,我重新启动了Tomcat,然后给了我上面的日志。当我转到123.123.123.123:8080时,我得到一个空白页面,其中包含scp /home/mypcusername/NetBeansProjects/myapp/target/myapp-0.1.war myserverusername@41.185.91.194:/home/myserverusername javascript错误,我尝试了GET http://123.123.123.123:8080/ 404 (Not Found)<ip>:8080/myapp之类的不同变体,结果相同。

我查看了this回答,但这似乎并不适用于我因为我在applicationContext.xml中没有与该问题的OP相同的值。如果我需要发布我的applicationContext.xml,请告诉我。

1 个答案:

答案 0 :(得分:0)

我开始了一个新项目,将我尝试部署的项目中的所有内容复制到新项目中并进行部署,这解决了我遇到的问题。