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

标签 java websphere-8

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

服务器Ear.ear
-- serverWar.war
---- 网络信息
---- 'web' 目录内容

我有 应用程序.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

我已经从 WAS ibm/console 安装了该应用程序。安装目录为..\Desktop\Test\out\artifacts\serverEar我的ear文件放在哪里(不确定安装目录是否影响这个?)。

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

我试过网址:https://my_server:9443/serverWar/server它给了我:Error 404: java.io.FileNotFoundException: SRVE0190E: File not found: /server
我以前从未处理过 WAS,并且不确定我可能哪里出错了。

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

最佳答案

好的,现在问题解决了。问题是 context root未设置为 serverWar,因此无法识别 serverWar/server url。所以我按照这些步骤到 set context root from IBM console .

解决此问题后,我又遇到了另一个相关问题:
Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet: Could not find required class
似乎我们需要在 WEB-INF 中有 classes 目录,IntelliJ 由于某种原因没有创建它,上述结构适用于 WildFly 和 WebLogic。因此,在 WAS 上部署 Ear 文件时,您需要做的就是从 production 复制类。目录。它使我的应用程序按预期工作。

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

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

关于java - WebSphere Application Server 8 : Error 404: java. io.FileNotFoundException:SRVE0190E:找不到文件:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36625804/

相关文章:

websphere - WAS 8.5,如何避免注释扫描?

java - 将 JFrame 内容保存为 .png

java - 领域逻辑 - 读取模型

java - 如何将其从 IntelliJ 迁移到 Android Studio

java - 使用不提供 WADL 的 REST 服务

IBM Websphere 中的 Java 7.1

java - Foreach in foreach 从列表中删除项目

websphere-8 - eclipse 和 websphere 8.0 - 无法更改上下文根

jms - 与激活规范绑定(bind)名称等效的注释

jsf - java.io.NotSerializedException : org.omnifaces.taghandler.Converter