JBoss error report: HTTP Status 404 - Servlet is not available

49,349

Solution 1

I still dont know what was wrong, but I've created another servlet called user, and in the web.xml I've added /servlet before the class and navigated to it in the browser (http://localhost:8080/web/servlet/User) and it worked.

<servlet>
    <servlet-name>User</servlet-name>
    <servlet-class>pages.User</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>User</servlet-name>
    <url-pattern>/servlet/User</url-pattern>
  </servlet-mapping>

Thanks everyone for your help!

Solution 2

404 means the URL you're trying to access does not point to an existing resource on your server. Check the address again, maybe the "web" (from http://localhost:8080/web/UserInterface) part is not correct because maybe the app is not deployed with that name. By default the app context name is derrived from the filename of the ".war" file such as if your file is "myApp.war", your app should be available at http://localhost:8080/myApp

Also, if you're actually deploying your war inside an .ear file that that ear file will contain an application.xml aplpication descriptor which can map your app file to a specific context, no-matter what the .war filename is, something like:

<module>
    <web>
      <web-uri>myApp.war</web-uri>
      <context-root>theApp</context-root>
    </web>
  </module>

Finally, if you're autodeploying from Eclipse with the JBoss Eclipse connector, sometimes the thing bugs out and doesn't in fact deploy your app properly (even though the app itself is fine). If that's the case, trying manually deploying the .war to an application server and check it that way.

Solution 3

HTTP Status 404 - Servlet is not available.

The loading of the servlet has failed (if the servlet wasn't properly declared in web.xml or the URL was wrong, then you should instead have seen "404 - Resource not found"). Simply put, the <servlet-class> is wrong or the concrete class file isn't present in /WEB-INF/classes.

Share:
49,349
NadaNK
Author by

NadaNK

A software engineer. Web development is my personal favorite but I I can work in any other domain

Updated on November 26, 2020

Comments

  • NadaNK
    NadaNK over 3 years

    I'm trying to create a very basic web project called "web" using MyEclipse and JBoss 5 as an application server. I've created one package called "pages" and inside it one servlet called "UserInterface". The problem is when I deploy the project and run the server I always get the error report: HTTP Status 404 - Servlet is not available.

    This is a part of my web.xml:

    <servlet>
        <servlet-name>UserInterface</servlet-name>
        <servlet-class>pages.UserInterface</servlet-class>
      </servlet>
    
      <servlet-mapping>
        <servlet-name>UserInterface</servlet-name>
        <url-pattern>/UserInterface</url-pattern>
      </servlet-mapping>
    

    and I'm navigating in the browser to: http://localhost:8080/web/UserInterface

    What am I doing wrong here?

    Thanks