- This topic has 16 replies, 4 voices, and was last updated 20 years, 11 months ago by Scott Anderson.
-
AuthorPosts
-
zarazaMemberI created a new Struts 1.1 app using the struts-blank.war.
I’ve created a MyEclipse J2EE project that points to it.Then I created the first JSP using the “Struts 1.1” template.
Right away it gives me an error: “Error cannot load class: org.apache.struts.taglib.bean.CookieTei property.jsp RevenueProperty/Web Root line 4″
in my property.jsp file (line 4):
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
But…the class is there, I can see it in the struts.jar that shows up in my project build path. If I just access the JSP from a browser it compiles fine and shows…but it doesn’t compile within Eclipse/MyEclipse…what am I missing here?
zarazaMemberForgot to add: if I use the “Preview” tab it actually previews fine!
But…MyEclipse says it can’t compile it and shows that error in the Tasks view…
BTW, here’s the full listing for the property.jsp page (as you see it’s very simple):
<%@ page language=”java”%>
<%@ taglib uri=”/WEB-INF/struts-bean.tld” prefix=”bean” %>
<%@ taglib uri=”/WEB-INF/struts-html.tld” prefix=”html” %>
<%@ taglib uri=”/WEB-INF/struts-logic.tld” prefix=”logic” %>
<%@ taglib uri=”/WEB-INF/struts-tiles.tld” prefix=”tiles” %>
<%@ taglib uri=”/WEB-INF/struts-template.tld” prefix=”template” %>
<%@ taglib uri=”/WEB-INF/struts-nested.tld” prefix=”nested” %><html:html locale=”true”>
<HEAD>
<html:base /><TITLE>property.jsp</TITLE>
<META HTTP-EQUIV=”pragma” CONTENT=”no-cache”>
<META HTTP-EQUIV=”cache-control” CONTENT=”no-cache”>
<META HTTP-EQUIV=”expires” CONTENT=”0″><META HTTP-EQUIV=”keywords” CONTENT=”keyword1,keyword2,keyword3″>
<META HTTP-EQUIV=”description” CONTENT=”This is my page”>
</HEAD><BODY>
<span style=”color: blue;”>This a Struts Page 23232.</span> <BR>
</BODY>
</html:html>
Scott AndersonParticipantIs the tld file in your WEB-INF/lib directory?
Did you modify web.xml to map the taglib uri to the location? There’s another thread or two around here that talks about that.–Scott
MyEclipse Support
zarazaMemberThe TLD file in in /WEB-INF. the struts.jar (and all its dependencies) are in /WEB-INF/lib
The web.xml file maps all the taglib uri to the location.
Once again, I tooked the blank Struts app that is distributed with Struts 1.1 and just tried adding a JSP page to it via MyEclipse:
Here’s the section from the web.xml file…
<!– Struts Tag Library Descriptors –>
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib><taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib><taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib><taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib><taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>thanks for any help…
zarazaMemberAlso, pls notice the error isn’t that it can’t find the TLD…it’s that it can’t load the class “org.apache.struts.taglib.bean.CookieTei”
but…I can see that class in my Package Explorer within MyEclipse…it’s part of the struts.jar that is in /WEB-INF/lib
zarazaMemberI opened NetBeans 3.5 and mounted the WebRoot filesystem just to test…it compiled the JSP file with no problem, didn’t have any issues recognizing the tags…so obviously something’s not right with the JSP editor in MyEclipse…
Scott AndersonParticipantWe’ll replicate your steps and see what issues we uncover. I’ll post our findings back here.
–Scott
MyEclipse Support
Scott AndersonParticipantI found no problems whatsoever using Struts 1.1 with version 2.5.0. Here’s what I did, step by step:
-
1) Downloaded Struts 1.1 zip distribution and expanded it to file system
2) Created a new Web Project, called StrutsBlank, in MyEclipse using the Web Project Wizard
3) Selected StrutsBlank/WebRoot and chose File > Import… > Zip File
4) Navigated to jakarta-struts-1.1/webapps and typed in struts-blank.war
5) Do not select / in the import wizard, but select all contained files and directories. This ensure that everything imports to the correct location.
6) Upon import, the project builds and one XML validation error is shown on ‘validation.xml’. The file is not valid as shipped. You can turn off validation under the XML editor’s preferences and resave the file to remove the error.
7) Move /StrutsBlank/WebRoot/WEB-INF/src/java/resources/application.properties to /StrutsBlank/src/resources/application.properties
8) Deploy the project on Tomcat
9) Reference it at http://localhost:8080/StrutsBlankAll taglibs show context help and all JSP’s, in both web project and on server compile successfully. No problems encountered at all. Please see how the steps you followed differ from these or try each step, exactly as stated above to correct your configuration problem.
–Scott
MyEclipse Support
glimingMemberI encountered the exact same problem as described by the previous poster using an existing Struts (v1.1) project and Eclipse 2.1.1/MyEclipse 2.5.1. Specifically, on attempting to compile the JSP, I encountered the error:
cannot load class: org.apache.struts.taglib.bean.CookieTei
Assuming that this might somehow be due to some incorrect config on my part, I attempted to repeat the exact steps from the prior post that demonstrated success. I too saw success. However, after deleting the project (while leaving the content “undeleted”) and deleting the existing .myeclipse dir (in the project root) and related eclipse .* files, I then attempted to create a new project using the old (just created) project content. This, resulted in duplicating the error. Since I followed the exact sam–ensuring identical classpath, web-root folder, src, etc. as the successful attempt, I am speculating that their exists some flaw that doesn’t properly parse existing content (vice imported content).
Scott AndersonParticipantI then attempted to create a new project using the old (just created) project content. This, resulted in duplicating the error.
I’m not surprised this created an error as deleting the ‘dot’ files erases the project metainformation for MyEclipse as well as the classpath. Without a properly configured classpath, your taglibs won’t load.
By the way, thank you very much for at least searching the forums for answers before posting. I truly appreciate it. 🙂
–Scott
MyEclipse Support
Kev PalfreymanMember@scott wrote:
-
1) Downloaded Struts 1.1 zip distribution and expanded it to file system
…
5) Do not select / in the import wizard, but select all contained files and directories. This ensure that everything imports to the correct location.
6) Upon import, the project builds and one XML validation error is shown on ‘validation.xml’. The file is not valid as shipped. You can turn off validation under the XML editor’s preferences and resave the file to remove the error.All taglibs show context help and all JSP’s, in both web project and on server compile successfully. No problems encountered at all. Please see how the steps you followed differ from these or try each step, exactly as stated above to correct your configuration problem.
–Scott
I just tried this (with Eclipse 2.1.1, MyEclipse 2.5.1, struts1.1, j2sdk1.4.2, win xp) and I get the cannot load class error for CookieTei.
I tried this simple example that Scott posted because I’m getting exactly the same issue with one of my struts projects that I’m attempting to convert into a MyEclipse Web Project.
Any further suggestions?
BTW on other attempts, the conversion and new project wizards seemed very unstable – NullPointerExceptions in WebProjectConverter in the logs.
Kev
Scott AndersonParticipantKev,
Given this problem and the ones your posting in the other thread, you’ve got an unstable installation of either Eclipse 2.1.1, MyEclipse 2.5.1, or your JDK. We had one other case similar to this from a user named ‘sitomania’. He finally resolved the issue by uninstalling and reinstalling everything, although we never determined the exact cause. The wizards are extremely stable in the 2.5.1 release so there is something that just isn’t “meshing” properly in your system. Personally, I’d recommend doing a clean installation as the shortest path to a functional configuration.
–Scott
MyEclipse Support
Kev PalfreymanMemberThis IS a clean installation – I only built the machine 2 days ago!
The only thing that is carried over is my source, and my workspace.Kev
Kev PalfreymanMemberOK – I just tried the StrutsBlank experiment twice.
First time creating a new project in the default location – WORKS.
Second time creating a new project in a custom location – FAILS with the CookieTei error.
Useful?
Kev
Scott AndersonParticipantKev,
What’s the custom location? It’s not anywhere under your workspace is it?
Please mail us the full log file at support@…
–Scott
MyEclipse Support -
AuthorPosts