Search code examples
jspservletshttp-status-code-404http-status-code-500

Webinf/lib folder missing caused error 500 and 404 in servlets


Why am I getting the Error instantiating servlet class error? It was working fine until I added a main page.

I have tried cleaning project and serer and rebuilding. Doesn't work. The path seems okay. Can't figure out why.

The error on the web browser

enter image description here

Web page error

enter image description here

When I go back and click on submit, I get the 404 error.

HTTP Status 404 -
type Status report
message
description The requested resource is not available.

I'm using Apache Tomcat/7.0.47 and Eclipse IDE

My folder structure:

enter image description here

My web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <welcome-file-list>
        <welcome-file>Main.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>JuzzyServlet</servlet-name>
        <servlet-class>org.juzzy.client.Choice</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>JuzzyServlet</servlet-name>
        <url-pattern>/Choice</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
</web-app>

Solution

  • I had a problem with my libraries. Went to the problems view on my eclipse and fixed problems in my project. Deleted my jars from all folders, imported them into the webinf/lib folder and added them to my build path. There was nothing wrong wit the code apparently.