简体   繁体   English

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

[英]Manual deployment of Tomcat app by copying to webapps

I'm trying to deploy a Tomcat application by copying it to the webapps directory. 我正在尝试通过将Tomcat应用程序复制到webapps目录来部署它。 My webapps directory looks like: 我的webapps目录如下所示:

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

The contents of index.jsp are: index.jsp的内容是:

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

test.jar has the Test class with the static test() method that just returns a string. test.jar具有带有静态test()方法的Test类,该方法仅返回一个字符串。

When I access my app via http://tomcatserver:8080/test/ , all I get is: 当我通过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>

I've also tried packaging the above directory structure into a WAR file and copying to webapps , but it still gives the same error. 我也尝试将上述目录结构打包到WAR文件中并复制到webapps ,但仍然会出现相同的错误。

I'm running standard out-of-the-box Tomcat 6 on Ubuntu 10.04. 我正在Ubuntu 10.04上运行标准的现成的Tomcat 6。 Tomcat came installed by Ubuntu. Tomcat是由Ubuntu安装的。 All files have -rw-r--r-- permissions, and directories are drwxr-xr-x . 所有文件都具有-rw-r--r--权限,目录为drwxr-xr-x Why can't Tomcat resolve the Test class located in WEB-INF/lib/test.jar ? Tomcat为什么无法解析WEB-INF/lib/test.jarTest类?

have you imported com.stevekuo.Test you need to say <%@ page import="com.stevekuo.Test"%> 您是否已导入com.stevekuo.Test您需要说<%@ page import="com.stevekuo.Test"%>

this is most definitely the fault. 这绝对是错误。

Resolved. 解决。 I added an empty web.xml and it works. 我添加了一个空的web.xml ,它可以工作。

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app 
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
</web-app>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM