有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java通过复制到webapps手动部署Tomcat应用

我试图通过将Tomcat应用程序复制到webapps目录来部署它。我的webapps目录如下所示:

webapps/test
           |_ index.jsp
           |_ WEB-INF
                    |_ lib
                         |_ test.jar

index.jsp的内容如下:

<html>
    Test App<br>
    <%= com.stevekuo.Test.test() %>
</htm>

test.jar具有Test类,该类具有仅返回字符串的静态test()方法

当我通过http://tomcatserver:8080/test/访问我的应用程序时,我得到的只是:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 3 in the jsp file: /index.jsp
com.stevekuo.Test cannot be resolved to a type
1: <html>
2:     Test<br>
3:     <%= com.stevekuo.Test.test() %>
4: </html>

我还尝试过将上述目录结构打包到WAR文件中,并复制到webapps,但仍然会出现相同的错误

我正在Ubuntu 10.04上运行标准的开箱即用Tomcat 6。Tomcat是由Ubuntu安装的。所有文件都有-rw-r--r--权限,目录为drwxr-xr-x。为什么Tomcat不能解析位于WEB-INF/lib/test.jar中的Test


共 (1) 个答案

  1. # 1 楼答案

    你导入了com.stevekuo.Test你需要说<%@ page import="com.stevekuo.Test"%>

    这绝对是错误