tomcat 7应用程序迁移到tomcat 8 [英] tomcat 7 application migration to tomcat 8

查看:193
本文介绍了tomcat 7应用程序迁移到tomcat 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下xml文件在tomcat 8中部署应用程序:

I'm trying to deploy an application in tomcat 8 with the following xml file:

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/home/httpd/chAdmin" path="/chAdmin">
<Loader className="org.apache.catalina.loader.VirtualWebappLoader"
        virtualClasspath="/usr/local/calendar/libs/google-api-client-1.19.0.jar;/usr/local/calendar/google-api-services-calendar-v3-rev107-1.19.0.jar;/usr/local/calendar/libs/google-http-client-1.19.0.jar;/usr/local/calendar/libs/google-http-client-jackson2-1.19.0.jar;/usr/local/calendar/libs/google-oauth-client-1.19.0.jar;/usr/local/calendar/libs/jackson-core-2.1.3.jar"/>
</Context>

我已经阅读了很多有关迁移到Resource方法的信息,并将xml文件更改为:

I've read a lot about the migration to the Resource methods and have changed the xml file to:

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/home/httpd/chAdmin" path="/chAdmin">
    <Resources className="org.apache.catalina.webresources.StandardRoot">
        <JarResources className="org.apache.catalina.webresources.JarResourceSet"
            base="/usr/local/calendar/libs/google-api-client-1.19.0.jar" webAppMount="/" />
        <JarResources className="org.apache.catalina.webresources.JarResourceSet"
            base="/usr/local/calendar/google-api-services-calendar-v3-rev107-1.19.0.jar" webAppMount="/" />
        <JarResources className="org.apache.catalina.webresources.JarResourceSet"
            base="/usr/local/calendar/libs/google-http-client-1.19.0.jar" webAppMount="/" />
        <JarResources className="org.apache.catalina.webresources.JarResourceSet"
            base="/usr/local/calendar/libs/google-http-client-jackson2-1.19.0.jar" webAppMount="/" />
        <JarResources className="org.apache.catalina.webresources.JarResourceSet"
            base="/usr/local/calendar/libs/google-oauth-client-1.19.0.jar" webAppMount="/" />
        <JarResources className="org.apache.catalina.webresources.JarResourceSet"
            base="/usr/local/calendar/libs/jackson-core-2.1.3.jar" webAppMount="/" />
    </Resources>
</Context>

应用程序启动正常,但未从jar文件导入类.我确定我在这里遗漏了一些东西,找不到关于如何执行此操作的良好示例.请帮忙.

The app is starting OK but is not importing the classes from the jar files. I'm sure I'm missing something here and cannot find a good example on how to do this. Please help.

我的JSP无法编译并且正在抛出

My JSP will not compile and is throwing

org.apache.jasper.JasperException:无法编译JSP的类: 在生成的Java文件中的第20行出现错误:[/usr/local/apache-tomcat-8.0.30/work/Catalina/localhost/chAdmin/org/apache/jsp/charters_jsp.java] 只能导入类型. com.google.api.client.json.JsonFactory解析为包

org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [20] in the generated java file: [/usr/local/apache-tomcat-8.0.30/work/Catalina/localhost/chAdmin/org/apache/jsp/charters_jsp.java] Only a type can be imported. com.google.api.client.json.JsonFactory resolves to a package

显然,这意味着jar文件未正确导入,因为com/google/api/client/json/JsonFactory.class位于google-http-client-1.19.0.jar

Apparently this means that the jar file is not importing correctly because com/google/api/client/json/JsonFactory.class is in google-http-client-1.19.0.jar

推荐答案

我在寻找遗漏的jar问题时发现了这个问题,通过将webAppMount更改为WEB-INF/classes来使它正常工作

I found this while searching for my missing jar issue, I got it to work by changing the webAppMount to WEB-INF/classes, like this

<JarResources className="org.apache.catalina.webresources.JarResourceSet"
        base="/usr/local/calendar/libs/google-http-client-1.19.0.jar" webAppMount="/WEB-INF/classes" />

这篇关于tomcat 7应用程序迁移到tomcat 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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