- This topic has 5 replies, 3 voices, and was last updated 21 years, 1 month ago by Scott Anderson.
-
AuthorPosts
-
robwunderlichParticipantI am receiving the JSP compile error
cannot load class: webcrm.WebUserSession dbtest.jsp webcrm/WebRoot/monitor line 1
However, the application runs fine. The class is compiled without errors. This problem *does not occur in myEclipse 2.5.1.*
Contents of dbtest.jsp:
<jsp:useBean id="user" class="webcrm.WebUserSession" scope="session"/> <jsp:useBean id="orders" class="webcrm.OrdersJSP" scope="request"/> <jsp:setProperty name="orders" property="user" value="<%= user %>"/> (remainder omitted)
The useBean tag for webcrm.WebUserSession appears in almost every jsp in my project, either explicitly or via include. All jsp with that useBean are posting the error.
I am also receiving this error for class webcrm.WebUserManager. No other classes are not being flagged, even though they use similar useBean tags.
The only thing that seems to be different about the classes that are being flagged is that they implement interfaces that are declared outside the project.
Specs:
Win2k SP4Eclipse Platform
Version: 2.1.1
Build id: 200306271545
Upgraded from 2.1.0 using update manager.org.eclipse.pde.* plugins=7
MyEclipse 2.6.2
JDK 1.4.2
Tomcat 4.24Thanks,
Rob Wunderlich
support-michaelKeymasterIf the interface that the problematic classes implement is defined in another Eclipse project just add that project to the build path of your web-project.
1) Select the web-project, right click>Properties>Java Build Path>Projects tab.
2) Then select the project that contains the interface followed by OK.
3) Lastly rebuild all JSPs to resolve the dependence on the interface.Michael
MyEclipse Support
robwunderlichParticipantThe project that contains the interface *is* on the classpath. The java classes compile fine. It is only the JSP files that have report problems. Note the application executes fine.
Please note that this problem does not appear in myEclipse 2.5.1, and I am not having this problem with any other projects.
.
Scott AndersonParticipantRob,
The only thing that seems to be different about the classes that are being flagged is that they implement interfaces that are declared outside the project.
The project that contains the interface *is* on the classpath. The java classes compile fine. It is only the JSP files that have report problems. Note the application executes fine.I’ve run a test where I set up a web project and a simple JSP page with a use-bean tag that references a class defined within the project. The bean class implements an interface I’ve defined in an external project that is referenced on the Java build path. The JSP compiles without any issues. Does that sound like a valid test?
There is one difference in our environments. I’m using the pre-release candidate build for version 2.6.3, which should be available no later than Monday. If you agree that the test is valid, I think the problem has been fixed as a side effect of addressing a couple of other issues in the JSP editor.
–Scott
MyEclipse Support
robwunderlichParticipantI’ve done some more testing and narrowed the problem down. The problem occurs when the useBean attempts to resolve a class in the hierarchy that is contained in a jar in another project.
Here’s a simple test case.
1. Create a class “MySuperclass”. It need not have any methods.
2. JAR MySuperclass.class to mysuper.jar
3. Create a simple project “myjar”. Put mysuper.jar in the myjar project.4. Create J2EE Web Module project, “MyBugTest”.
5. Add mysuper.jar to the MyBugTest project using the “Add JARs” button on the Java Build Path window (Do not use the “Add External JARs” button).
6. In project MyBugTest, create a simple class “MySubclass” that extends “MySuperclass”. It should compile ok.
7. In project MyBugTest, create test.jsp which has text:<jsp:useBean id="user" class="MySubclass" scope="session"/>
The JSP compile will report error “cannot load class: MySubclass”.
8. Note the error also occurs if the useBean references the JARed class directly, that is:
<jsp:useBean id="user" class="MySuperclass" scope="session"/>
The problem does not occur if mysuper.jar is added to the classpath using the “Add External JARs” button on the Java Build Path window. For now, this is an acceptable workaround for me.
-Rob Wunderlich
Scott AndersonParticipantRob,
Thank you very much for the detail you provided after running this down. You even included a workaround. 🙂
I’ve placed the issue and your detailed steps to reproduce it into our internal tracking system so that we can resolve it in an upcoming service release.
–Scott
MyEclipse Support -
AuthorPosts