Search code examples
javaeclipsejsptomcatservlets

index.jsp not found (cannot be loaded)


i am trying to create a dynamic web app in Eclipse (Tomcat v7). The problem is that when i run my webapp index.jsp cannot be accessed. I can Access every other .jsp, but the index.jsp not.The next problem of course is ´that index.jsp cannot be loaded at the start of the app. I get the following message:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name: org/apache/jsp/Index_jsp)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:343)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)


root cause 

java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name: org/apache/jsp/Index_jsp)
    java.lang.ClassLoader.defineClass1(Native Method)
    java.lang.ClassLoader.defineClass(Unknown Source)
    java.security.SecureClassLoader.defineClass(Unknown Source)
    java.net.URLClassLoader.defineClass(Unknown Source)
    java.net.URLClassLoader.access$100(Unknown Source)
    java.net.URLClassLoader$1.run(Unknown Source)
    java.net.URLClassLoader$1.run(Unknown Source)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(Unknown Source)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

I have tried everything (the last option was to create a index.html and redirect it to the index.jsp but it didn't work). I have also tried to copy index.jsp in every folder of the app but it also didn't work. Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>Test_WebApp_1</display-name>
  
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

I have also searched on Google, and there where some cases where the index.jsp was not loading, but the solutions didn't help me.

Does anybode has some idea ? Could this be something with Apache ? I have tried to run Version 6.0 but i could not start it because it didn't support some of the modules used in my app.

So, i am happy for any Information

Kinde regards


Solution

  • i have tried something else. I have exported my app as a war and deployed it on Apache. When i run my app right from Apache it works fine, and the index.jsp is being loaded. So i assume it is something in eclipse

    edit : i solved it by installing the jdk develpment kit and Setting the JAVA_HOME Variable

    thanks für the answers