【发布时间】:2012-10-08 15:11:41
【问题描述】:
我已经开发了一个正确部署在 Apache Tomcat 上的 Java 动态 Web 项目。现在我正在尝试在 WebSphere Application Server 8.5 上部署 .war 文件。企业应用程序已正确创建,但当我尝试使用浏览器访问我的应用程序时,出现以下错误:
Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet [it.foo.simpleapp.SimpleApp]: Could not find required class - class java.lang.ClassNotFoundException: it.foo.simpleapp.SimpleApp
应用程序非常简单:当 GET 到达时,它应该以 text/html 内容进行响应。
我很确定 .war 文件是正确的,但我是 WebSphere 部署的新手。
servlet 类是:
@WebServlet("/")
public class SimpleApp extends HttpServlet {
private static final long serialVersionUID = 1L;
public SimpleApp() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.getWriter().print("<html><body><h1>SimpleApp servlet ready!</h1>");
response.getWriter().print("</body></html>");
response.setContentType("text/html");
}
}
web.xml 文件是:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>SimpleApp</display-name>
</web-app>
提前致谢!
【问题讨论】:
标签: jakarta-ee servlets websphere