【问题标题】:SRVE0200E error on WebSphere Application Server 8.5WebSphere Application Server 8.5 上的 SRVE0200E 错误
【发布时间】: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


    【解决方案1】:

    这个问题可能与 Tomcat 使用的某些库没有进入 WebSphere 环境有关;所以我解决了用 IBM Java 库编译代码的问题。以下步骤解决了我的问题。

    1. 为 Eclipse 安装 WASdev 插件。可以从这个 URL 检索到:http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/V8.5/

    2. 在 Eclipse 中,在“Window > Preferences > Server > Runtime Environments”下,应单击“Add... 添加新的运行时环境" 按钮。

    3. 在“IBM”文件夹下选择“WebSphere Application Server v8.5”运行环境并勾选“新建本地服务器 ”。在下一个窗口中,必须提供“安装目录”;例如:{your_path}\IBM\WebSphere\AppServer

      如果在这些操作期间显示“安全服务器仅支持 IBM JRE 6.0 或更高版本。使用产品安装映像中的 IBM JRE。”之类的消息,您可以follow this tutorial in为了更改eclipse.ini 内容。行:

      --launcher.defaultAction
      openFile
      -vmargs
      -Dosgi.requiredJavaVersion=1.5
      -Dhelp.lucene.tokenizer=standard
      -Xms40m
      -Xmx512m
      

      必须替换为以下行:

      --launcher.defaultAction
      openFile
      -vm
      {your_path}\IBM\WebSphere\AppServer\java\bin\javaw.exe
      -vmargs
      -Dosgi.requiredJavaVersion=1.5
      -Xms40m
      -Xmx512m
      
    4. 现在您可以创建一个新的“Dynamic Web Project”,将 WebSphere Application Server 指定为目标运行时。 p>

    导出的 WAR 文件可以作为 企业应用程序正常工作。

    我希望这会很有用。

    【讨论】:

      【解决方案2】:

      按照上面的步骤 3 可能无法解决如下消息:

      “安全服务器仅支持 IBM JRE 6.0 或更高版本。使用 产品安装映像中的 IBM JRE。”

      您可能需要直接将 JVM 添加到 eclipse.exe 命令行而不是更改 eclipse.ini

      {eclipse_install_path}/eclipse.exe -vm "C:\Program 文件\Java\jdk1.6.0_16\bin\javaw.exe" -vmargs -Xmx1024m -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode

      Howto start eclipse in JDK?查看更多信息

      【讨论】:

        猜你喜欢
        • 2015-05-19
        • 2012-07-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多