...

View Full Version : JSP Cannot Resolve Symbol Messages



mjlorbet
04-16-2008, 12:02 PM
Wow, my first post...

So, here's the problem, I've spent the past 3 weeks developing an application for the Blackboard Content System using a servlet relying on 5 classes I've written (yes compiled into class files & placed in the WEB-INF/classes directory, and jarred and placed in the WEB-INF/lib directory) and all was well until (because of a glitch in Tomcat 5.5.x) I had to abandon my servlet in exchange for 4 jsp pages. Given the exact same structure, the classes are being completely ignored for some reason, causing server error 500 with the specific error message which i will paste below.

The only things i cannot do to fix this:
restart tomcat (people will scream at me if i do)
change tomcat's configuration in any way (voids our support contract apparently)

so here's the message:



type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.

exception org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyObjectPair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyObjectPair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a
type org.apache.jasper.servlet.JspServletWrapper.handleJspException
(JspServletWrapper.java:510) org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:375) org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service
(HttpServlet.java:802) sun.reflect.GeneratedMethodAccessor7159.invoke(Unknown
Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke
(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged
(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute
(SecurityUtil.java:275) org.apache.catalina.security.SecurityUtil.doAsPrivilege
(SecurityUtil.java:161) java.security.AccessController.doPrivileged(Native Method) blackboard.platform.servlet.ContentTypeFilter.doFilter
(ContentTypeFilter.java:56) sun.reflect.GeneratedMethodAccessor7158.invoke(Unknown
Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke
(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged
(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute
(SecurityUtil.java:275) org.apache.catalina.security.SecurityUtil.doAsPrivilege
(SecurityUtil.java:217) java.security.AccessController.doPrivileged(Native
Method) blackboard.platform.servlet.RequestSessionFilter.handleRequest
(RequestSessionFilter.java:314) blackboard.platform.servlet.RequestSessionFilter.doFilter
(RequestSessionFilter.java:152) sun.reflect.GeneratedMethodAccessor7157.invoke(Unknown
Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke
(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged
(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute
(SecurityUtil.java:275) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)



root cause org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyObjectPair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyObjectPair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:PermissionObject cannot be resolvedAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:JSON cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a typeAn error occurred at line: 16 in the jsp
file: /QE_UserLoad.jspGenerated servlet error:KeyValuePair cannot be resolved to a
type org.apache.jasper.compiler.DefaultErrorHandler.javacError
(DefaultErrorHandler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError
(ErrorDispatcher.java:328) org.apache.jasper.compiler.JDTCompiler.generateClass
(JDTCompiler.java:414) org.apache.jasper.compiler.Compiler.compile(Compiler.java:297) org.apache.jasper.compiler.Compiler.compile
(Compiler.java:276) org.apache.jasper.compiler.Compiler.compile(Compiler.java:264) org.apache.jasper.JspCompilationContext.compile
(JspCompilationContext.java:563) org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:303) org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service
(HttpServlet.java:802) sun.reflect.GeneratedMethodAccessor7159.invoke(Unknown
Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke
(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged
(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute
(SecurityUtil.java:275) org.apache.catalina.security.SecurityUtil.doAsPrivilege
(SecurityUtil.java:161) java.security.AccessController.doPrivileged(Native Method) blackboard.platform.servlet.ContentTypeFilter.doFilter
(ContentTypeFilter.java:56) sun.reflect.GeneratedMethodAccessor7158.invoke(Unknown
Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke
(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged
(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute
(SecurityUtil.java:275) org.apache.catalina.security.SecurityUtil.doAsPrivilege
(SecurityUtil.java:217) java.security.AccessController.doPrivileged(Native
Method) blackboard.platform.servlet.RequestSessionFilter.handleRequest
(RequestSessionFilter.java:314) blackboard.platform.servlet.RequestSessionFilter.doFilter
(RequestSessionFilter.java:152) sun.reflect.GeneratedMethodAccessor7157.invoke(Unknown
Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke
(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243) java.security.AccessController.doPrivileged
(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute
(SecurityUtil.java:275) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)

i think this is less than helpful, because all this is generated by the import of the package HERZ_JSP (the package containing the classes i wrote/need).

if anyone has any ideas i would greatly appreciate them, i've spent hours upon hours searching, i've tried all the fixes i've found but nothing seems to work. i think i may have to compile the jsp so that it's not entirely up to the jit compiler to locate the dependencies, but i'm fairly new on the java scene and am not familiar with how to do that.

Thanks in advance

mamamia
04-22-2008, 06:54 PM
Tomcat is a very light application that you can install and run locally. So my first suggestion would be to install a copy on your local machine and test there. This way you will have the ability to restart the server as need be.

In regards to your specific problem, are you in fact importing the types in the JSP? For example:


<%@ page import="KeyObjectPair" %>

You mention that you import a package HERZ_JSP. But I'm not clear on your naming convention here. Package names are usually in all small letters using dot notation (i.e. com.foo.beans). So if you had a class/type called KeyObjectPair defined in the com.foo.beans package you would need an import statement like so:


<%@ page import="com.foo.beans.KeyObjectPair" %>

mjlorbet
04-22-2008, 07:16 PM
thank you for replying, the types are defined in HERZ_JSP, which is the package name, i realize it's not the common convention for package names, but it is the convention the company i work for has used in prior projects.

i have considered installing tomcat locally and did so before i realized the installation of tomcat that this must run on is heavily customized specifically for the blackboard system, which this page is designed for. i would remove references to the blackboard system for testing but the application of the components makes little sense without them.

also, i have tried importing the types directly
<&#37;@ page import="HERZ_JSP.KeyObjectPair" %> as well but this tells me it is expecting a package called KeyObjectPair, not a class which KeyObjectPair actually is.

the problem ultimately comes down to where to put the .class file (or .jar file containing all the class files). and/or what structure to have within the .jar file so that the classes within the package (HERZ_JSP) are accessible and can be found from a JSP at runtime.

mamamia
04-22-2008, 07:35 PM
Placing your files in /WEB-INF/classes is correct. So you should have KeyObjectPair (along with everything else) in /WEB-INF/classes/HERZ_JSP.

Also, note that Unix and Linux systems are case sensitive. So if you are running under a Unix/Linux environment where Tomcat is then your HERZ_JSP directory will need to be in all caps just like your import statement.

mjlorbet
04-22-2008, 07:37 PM
ah, forgot the HERZ_JSP path below classes, i will try this shortly, thanks ;)

mamamia
04-22-2008, 07:38 PM
Oh yeah one more thing. By default, Tomcat is not setup to dynamically load class file changes or pick up new class files. Thus, you would in fact need to restart for it to recognize the fact that you have placed new class files in it's WEB-INF. (This setting can be overwritten however, so that it does dynamically pick up new and updated class files.)

mjlorbet
04-23-2008, 12:21 AM
hrm.... no dice, any other ideas?

mjlorbet
04-23-2008, 07:14 AM
i've found a tentative solution, i'll be sure to post again if it works out along with a full example of how to implement it. the page i found leading me to this idea is http://www.panix.com/~mito/articles/articles/classloader/j-classloader-ltr.pdf. java's ClassLoader seems like it might do the trick.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum