WebSphere Application Server 8:错误 404:java.io.FileNotFoundException:SRVE0190E:找不到文件:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36625804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 18:30:00  来源:igfitidea点击:

WebSphere Application Server 8 : Error 404: java.io.FileNotFoundException: SRVE0190E: File not found:

javawebsphere-8

提问by HitchHiker

I want to deploy an application in WAS8.5.5.2. I have made the ear with the structure :

我想在 WAS8.5.5.2 中部署一个应用程序。我用结构做了耳朵:

serverEar.ear
-- serverWar.war
---- WEB-INF
---- 'web' directory contents

serverEar.ear
-- serverWar.war
---- WEB-INF
---- 'web' 目录内容

I have application.xml :

我有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:

<?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>

I have the directory structure :

我有目录结构:

enter image description here

在此处输入图片说明

I have installed the application from WAS ibm/console. The installation directory is ..\Desktop\Test\out\artifacts\serverEarwhere my ear file is placed (Not sure if the installation directory affects this?).

我已经从 WAS ibm/console 安装了该应用程序。安装目录就是..\Desktop\Test\out\artifacts\serverEar我的ear文件所在的地方(不知道安装目录会不会影响这个?)。

Application has been installed successfully and is started.

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

I have tried the url : https://my_server:9443/serverWar/serverand it gives me : Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /server

我已经尝试过网址:https://my_server:9443/serverWar/server,它给了我:Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /server

I have never handled WAS before and am not sure where I might be going wrong.

我以前从未处理过 WAS,并且不确定我可能哪里出错了。

Any suggestions, pointers are highly appreciated!

任何建议,指针是高度赞赏!

采纳答案by HitchHiker

Okay so the problem is solved now. The issue was the context rootwas not set to serverWar so it was not recognizing the serverWar/server url. So I followed these steps to set context root from IBM console.

好的,现在问题解决了。问题是context root未设置为 serverWar,因此无法识别 serverWar/server url。所以我按照这些步骤从 IBM 控制台设置上下文根

After resolving this issue, I got another related issue :

解决此问题后,我又遇到了另一个相关问题:

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

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

It seems that we need to have classes directory in WEB-INF, which IntelliJ had not created for some reason and the above structure worked for both WildFly and WebLogic. So while deploying an ear file on WAS all you need to do is to copy classes from productiondirectory. It made my application work as expected.

似乎我们需要在 中有 classes 目录WEB-INF,IntelliJ 由于某种原因没有创建这个目录,上面的结构适用于 WildFly 和 WebLogic。因此,在 WAS 上部署 ear 文件时,您需要做的就是从production目录中复制类。它使我的应用程序按预期工作。

After making all the above changes I can successfully access the url https://my_server:9443/serverWar/server.

进行上述所有更改后,我可以成功访问 url https://my_server:9443/serverWar/server

Hope this helps the people who are new to WAS!

希望这对刚接触 WAS 的人有所帮助!

回答by Ahmed Elkoussy

I hope this helps someone else as it took me many hours to find out the reason:

我希望这对其他人有帮助,因为我花了很多时间才找出原因:

I faced the same issue when I tried deploying a WAR file on WAS 8.5 , the issue in my case was that this WAS had java jdk 6while my application needed jdk 8

当我尝试在 WAS 8.5 上部署 WAR 文件时,我遇到了同样的问题,我的问题是这个WAS 有 java jdk 6我的应用程序需要 jdk 8