grails 2.4 Java 8和tomcat 7.0.55.2 [英] grails 2.4 java 8 and tomcat 7.0.55.2

查看:61
本文介绍了grails 2.4 Java 8和tomcat 7.0.55.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有tomcat插件的grails 2.4.4运行一个https站点:

I am attempting to run a https site using grails 2.4.4 with tomcat plugin :

build ':tomcat:7.0.55.2'

在首次尝试启动该应用程序时,我遇到了以下问题: issue 648

Upon first attempt to launch the app I hit the following issue: issue 648

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

当我将tomcat的tomcat依赖关系更改为tomcat 8.0.22并再次运行应用程序时,它成功并超出了范围,即createSSLCertificate(File keystoreDir)可以工作,尽管该应用程序无法启动.如果我现在将其更改回tomcat 7.0.55.2,则已生成密钥,并且该应用程序可以正常工作.

When I change the tomcat dependency for tomcat to tomcat 8.0.22 and run app again it succeeds and goes beyond i.e. createSSLCertificate(File keystoreDir) works and although the app does not start up. If I now change it back to tomcat 7.0.55.2 the keys have been generated and the app works.

我想的问题是我不确定Graeme指出的修补程序仅存在于tomcat 8中,还是我可以使用的tomcat 7的更高版本对此问题进行了修补.

I guess the question is I was unsure if that fix that Graeme has pointed to only exists in tomcat 8 or is there a later version of tomcat 7 I could use that has a fix for this problem.

虽然对于开发机器来说,这种破解是可以的,但是当通过jenkins等构建应用程序时,我确实需要更具体的东西.

Whilst this hack is ok for a development machine, I really need something more concrete for when the app is built via jenkins etc.

要在本地重新创建,

grails clean-all 

然后尝试

grails run-app -https 

我第一次遇到这个问题,直到我再次重复上述步骤.

I hit the issue for the very first time until I repeat the above steps again.

考虑一下,Jenkins生成WAR文件实际上可能很好,尽管从开发的角度来看,找到一种更好的方法来使所有这些工作仍然很不错.

Thinking about it Jenkins producing a WAR file may actually be fine, although from a development point of view it still be nice to find a nicer way of making this all work.

推荐答案

我自己也遇到了这个问题.我尝试了在互联网上找到的其他解决方案,直到偶然发现 https://github.com/grails/grails-profile-repository/pull /14/文件 这为我解决了这个问题并使用-https

I've run into this problem myself aswell. I have tried some other solutions I found on the internet until I stumbled on https://github.com/grails/grails-profile-repository/pull/14/files This did the trick for me to solve this issue and run my application with -https

转到TomcatServer.groovy,然后替换:

protected getKeyToolClass() {
    try {
        Class.forName 'sun.security.tools.KeyTool'
    }
    catch (ClassNotFoundException e) {
        // no try/catch for this one, if neither is foun\d let it fail
        Class.forName 'com.ibm.crypto.tools.KeyTool'
    }
}

具有:

protected Class getKeyToolClass() {
    try {
        try {
            // Sun JDK 8
            return Class.forName('sun.security.tools.keytool.Main')
        }
        catch (ClassNotFoundException e1) {
            try {
                // Sun pre-JDK 8
                return Class.forName('sun.security.tools.KeyTool')
            }
            catch (ClassNotFoundException e2) {
                 // no try/catch for this one, if neither is found let it fail
                 return Class.forName('com.ibm.crypto.tools.KeyTool')
            }
        }
    }
    catch (Throwable e) {
        return null
    }
}

这篇关于grails 2.4 Java 8和tomcat 7.0.55.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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