2016-04-14 203 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的人!

相關問題