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

Publish date: 2024-05-22

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!

2 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!

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 6 while my application needed jdk 8

0

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJoam9uYmqFcYCOsJybq6CdsrOxjJqnqaSZmK61tc6nZKydoquys3mXZpyrqp%2BnenV8k2ahmq6RYrawecWio56mn6mzsMHNnZyxm5Wlwaq7zWaqq66VZQ%3D%3D