Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

I have 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>

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\serverEar where my ear file is placed (Not sure if the installation directory affects this?).

Application has been installed successfully and is started.

I have tried the url : https://my_server:9443/serverWar/server and it gives me : 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.

Any suggestions, pointers are highly appreciated!

like image 893
HitchHiker Avatar asked Apr 14 '16 14:04

HitchHiker


People also ask

What is 404 error in websphere?

Problem. You encounter Error 404: Servlet not found error upon accessing the J2EE application index or home page after deploying the application on Websphere Application Server.

What is SRVE0190E?

The SRVE0190E generally means that there was an external HTTP request received by the server to one of the web modules but the URL contains a path that does not exist for for that web module. The client sending the request should see a HTTP 404 error.


1 Answers

Okay so the problem is solved now. The issue was the context root was 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.

After resolving this issue, I got another related issue :

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 production directory. It made my application work as expected.

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

Hope this helps the people who are new to WAS!

like image 120
HitchHiker Avatar answered Sep 21 '22 03:09

HitchHiker