Question

Trying to use compiled JSPs from my Web application, but I have no idea how to determine the appropriate class name for my web.xml, I placed the _db.class file in WEB-INF/classes/_db.class

Whenever I try to call my application with /context-root/dbx I get:

Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet [com/ibm/_jsp/_db]: 
Could not find required class - class java.lang.ClassNotFoundException: com/ibm/_jsp/_db

My web.xml contains a basic servlet mapping

<servlet>
            <servlet-name>dbx</servlet-name>
            <servlet-class>com/ibm/_jsp/_db</servlet-class>
</servlet>
<servlet-mapping>
            <servlet-name>dbx</servlet-name>
            <url-pattern>/dbx/*</url-pattern>
</servlet-mapping>

If I change <servlet-class> to be _db, I get:

Error 500: java.lang.NoClassDefFoundError: _db (wrong name: com/ibm/_jsp/_db)

Running /opt/IBM/WebSphere/AppServer/java/bin/javap _db gives

Compiled from "_db.java"
public final class com.ibm._jsp._db extends com.ibm.ws.jsp.runtime.HttpJspBase implements com.ibm.ws.jsp.runtime.JspClassInformation{
    static {};
    public com.ibm._jsp._db();
    public java.lang.String[] getDependants();
    public java.lang.String getVersionInformation();
    public boolean isDebugClassFile();
    public void _jspInit();
    public void _jspService(javax.servlet.http.HttpServletRequest,   
      javax.servlet.http.HttpServletResponse)   
      throws java.io.IOException, javax.servlet.ServletException;
}

If I try to use com.ibm._jsp._db for the server-class I get:

Error 404: javax.servlet.UnavailableException: SRVE0200E: Servlet [com.ibm._jsp._db]: 
Could not find required class - class java.lang.ClassNotFoundException: com.ibm._jsp._db

My actual jsp is very simple and contains no class definition.

Was it helpful?

Solution

Under WEB-INF/classes you must place the class according to its package name.

Try placing your Servlet here:

WEB-INF/classes/com/ibm/_jsp/_db.class
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top