0

I have the following web structure

Root
- ----- Web-Inf
- --------- (classes, web.xml, etc...)
- ----- Members area (a normal folder)
- --------- FileB.jsp
- ----- FileA.jsp

and I am having this really weird problem, both FileA and B.jsp have in their first line

<jsp:useBean id="User" scope="session" class="kcc.Users"/>

the FilaA.jsp works fine, but the FileB.jsp cant seem to find the class with the error

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: kcc/Users
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.ServletException: java.lang.NoClassDefFoundError: kcc/Users
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:325)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

How can i solve this, thank.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Yehia A.Salam
  • 1,987
  • 7
  • 44
  • 93
  • hmm, apparently i have to place the jsps in the root directory tow rok, like FileA.jsp, but this is very limiting, i found this question in a few places on the internet but none give an working solution – Yehia A.Salam Jan 06 '13 at 11:18
  • This should not form a problem. Which servletcontainer are you using? Stacktrace suggests Tomcat, but which version? – BalusC Jan 06 '13 at 16:14
  • @BalusC tomcat6, i added a copy of Web-inf in the subdirectory, and it worked, but thats not the right way to do things – Yehia A.Salam Jan 06 '13 at 17:40
  • does that have something to do with the ProxyPass directive, because i've used the above structure under a mod_jk and it worked fine – Yehia A.Salam Jan 13 '13 at 00:34
  • to shed more light on this, it looks like the WEB-INF folder is not in my classpath anymore when accessing jsp from subdirectories, compare http://www.localkicks.com/cpx/test.jsp and http://www.localkicks.com/test.jsp – Yehia A.Salam Jan 13 '13 at 21:39
  • @YehiaA.Salam If WEB-INF is not in the classpath, how FileA.jsp is finding that class? The situation you explained should never happen. It would be easier to find a solution if you can share the project structure with actual file names. – Ravindra Gullapalli Jan 19 '13 at 19:43

4 Answers4

0

This is the stacktrace of a welcome-file and has nothing to do with FileB.jsp.

Grim
  • 1,938
  • 10
  • 56
  • 123
0

The description is too simple to get idea.

My best guess is security policy of this tomcat prevent B.jsp from accessing kcc.Users (BTW, it is in WEB-INF/classes or some lib jar?), have an eye on tomcat/conf/policy.d

pinxue
  • 1,736
  • 12
  • 17
0

Check you FileB.jsp I think you are missing some jar file. taglibs??

SaK
  • 410
  • 3
  • 10
0

it was a problem with the tomcat root application path and the way the application was configured under the virtual host, basically i needed to create a ROOT folder under the virtual host entry.

Yehia A.Salam
  • 1,987
  • 7
  • 44
  • 93