2016-04-14 1613 views
2

我想在WAS8.5.5.2中部署应用程序。我与结构的耳朵:WebSphere Application Server 8:错误404:java.io.FileNotFoundException:SRVE0190E:文件未找到:

serverEar.ear
- serverWar.war
---- WEB-INF
---- '网络' 目录下的内容

我有application.xml中:

<application version="6" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" > 
    <module> 
     <web> 
      <web-uri> serverWar.war</web-uri> 
      <context-root>serverWar</context-root> 
     </web> 
    </module> 

    <library-directory> web/lib</library-directory> 

</application> 

web.xml中:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
     version="3.1"> 

    <servlet> 
     <servlet-name>p1</servlet-name> 
     <servlet-class>com.test.Server</servlet-class> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>p1</servlet-name> 
     <url-pattern>/server</url-pattern> 
    </servlet-mapping> 

    <security-constraint> 
     <display-name/> 
     <web-resource-collection> 
      <web-resource-name/> 
      <description/> 
      <url-pattern>/*</url-pattern> 
      <http-method>POST</http-method> 
      <http-method>GET</http-method> 
     </web-resource-collection> 
     <user-data-constraint> 
      <description/> 
      <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
     </user-data-constraint> 
    </security-constraint> 

</web-app> 

我的目录结构:

enter image description here

我已经安装的应用程序从被IBM /控制台。安装目录是..\Desktop\Test\out\artifacts\serverEar,我的耳朵文件放在这里(不知道安装目录是否影响到这个?)。

应用程序已成功安装并启动。

我已经试过的网址:https://my_server:9443/serverWar/server,这让我:Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /server

我从来没有处理之前,我不知道在那里我可能会错误。

任何建议,指针非常感谢!

回答

0

好了,现在问题就解决了。问题在于context root未设置为serverWar,因此它不能识别serverWar/server url。所以我按照这些步骤到set context root from IBM console

解决这个问题后,我得到了另一个相关的问题:

Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet: Could not find required class

看来,我们需要有classes目录中WEB-INF,其中的IntelliJ由于某种原因没有创造和上面的结构,工作了WildFly和WebLogic。因此,在WAS上部署ear文件时,您只需从production目录复制类。它使我的应用程序按预期工作。

完成上述所有更改后,我可以成功访问网址https://my_server:9443/serverWar/server

希望这可以帮助那些刚接触WAS的人!