如何更改Grails 2的Tomcat 7插件源 [英] How to make changes to Tomcat 7 plugin source for Grails 2

查看:278
本文介绍了如何更改Grails 2的Tomcat 7插件源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Grails 2.3.11与Tomcat 7.0.54插件一起使用.我的Java版本是1.8.0_181.
当我尝试通过运行

I'm using Grails 2.3.11 with the Tomcat 7.0.54 plugin. My Java version is 1.8.0_181.
When I try to start the grails app with https enabled by running

grails run-app --https

我收到以下异常:

java.lang.ClassNotFoundException:com.ibm.crypto.tools.KeyTool

java.lang.ClassNotFoundException: com.ibm.crypto.tools.KeyTool

我找到了有关如何解决Tomcat插件中错误代码的答案: https://stackoverflow.com/a/44673672 /1037864
但是我不知道如何使更改生效.当我在Tomcatserver.groovy中编辑代码时,什么也没发生.我修改过的代码永远不会执行.

I found an answer on how to fix the faulty code in the Tomcat plugin: https://stackoverflow.com/a/44673672/1037864
However I don't know how to get my changes to apply. When I edit the code in Tomcatserver.groovy nothing happens. My altered code is never executed.

然后我发现Tomcat插件是一个jar文件(位于"C:\ Dev \ myproject \ webapp \ target \ work \ plugins \ tomcat-7.0.54 \ grails-plugin-tomcat-7.0.54. jar"),并且在我构建项目时不会更新该jar文件.
在我的BuildConfig.groovy中,它说:

Then I found that the Tomcat plugin is a jar-file (located at "C:\Dev\myproject\webapp\target\work\plugins\tomcat-7.0.54\grails-plugin-tomcat-7.0.54.jar") and that jar file is not updated when i build my project.
In my BuildConfig.groovy it says:

build ":tomcat:7.0.54"

...所以我试图将其更改为:

... so I tried to change that to:

compile ":tomcat:7.0.54"

但是当我尝试运行该项目时,出现另一个错误:

But when I try to run the project I get another error:

java.lang.NoClassDefFoundError:org/apache/catalina/startup/Tomcat 在java.lang.Class.getDeclaredMethods0(本地方法) 在java.lang.Class.privateGetDeclaredMethods(Class.java:2701) 在java.lang.Class.privateGetMethodRecursive(Class.java:3048) 在java.lang.Class.getMethod0(Class.java:3018) 在java.lang.Class.getMethod(Class.java:1784) 在sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) 在sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
引起原因:java.lang.ClassNotFoundException:org.apache.catalina.startup.Tomcat 在java.net.URLClassLoader.findClass(URLClassLoader.java:381) 在java.lang.ClassLoader.loadClass(ClassLoader.java:424) 在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:349) 在java.lang.ClassLoader.loadClass(ClassLoader.java:357) ...还有7个
错误:发生了JNI错误,请检查您的安装,然后重试

java.lang.NoClassDefFoundError: org/apache/catalina/startup/Tomcat at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.startup.Tomcat at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more
Error: A JNI error has occurred, please check your installation and try again

我想我缺少一些依赖项.
对Tomcatserver.groovy进行更改,然后进行编译(并替换jar文件)的正确方法是什么?

I guess I'm missing some dependencies.
What is the correct way to make the changes to Tomcatserver.groovy and then get it to compile (and replace the jar-file)?

推荐答案

我不知道是否还有其他方法,但是我通过以下方法使它起作用:

I don't know if there is another way, but I got it working by:

  • Github 下载Tomcat插件源代码.
  • 对源代码进行更改.
  • grails upgrade.
  • grails package-plugin --binary.
  • 将新的jar文件(target\grails-plugin-tomcat-7.0.54.jar)复制到主项目的tomcat目录(C:\Dev\myproject\webapp\target\work\plugins\tomcat-7.0.54\)).
  • grails run-app --https
  • 开始我的主项目
  • Downloading the Tomcat-plugin source code from Github.
  • Made the changes to the source code.
  • Ran grails upgrade.
  • Ran grails package-plugin --binary.
  • Copied the new jar-file (target\grails-plugin-tomcat-7.0.54.jar) to my main project's tomcat-directory (C:\Dev\myproject\webapp\target\work\plugins\tomcat-7.0.54\).
  • Started my main project with grails run-app --https

我现在能够在端口8443上使用https浏览到我的站点.

I was now able to browse to my site using https on port 8443.

这篇关于如何更改Grails 2的Tomcat 7插件源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆