- This topic has 24 replies, 7 voices, and was last updated 20 years, 10 months ago by Riyad Kalla.
-
AuthorPosts
-
Chris KovacsMemberHello, I’m evaluating MyEclipse for my company. If we like Eclipse and it works, we could switch over all of our Java development to Eclipse and use MyEclipse enterprise workbench.
A major requirement is that we must be able to use Eclipse with our existing project structures without any major modifications. We’re using a CVS repository and having to change structure is out of the question.
Our current project works with JBuilder, but I can’t get it to work in MyEclipse. All of the Java classes compile nicely, but none of our JSP pages can load our custom taglib java classes. I searched the forums and found a thread that suggested jar-ing these classes and including them, but that did not help.
Here are some of the project details:
Web-root folder: /webapp
In the web-root, there are jsp files (example foo.jsp) with includes like:
<%@ include file=”includes/menu.jsp” %>But in MyEclipse, there is an error reported in foo.jsp:
“in included file ../webapp/includes/menu.jsp (2): cannot load class: <custom tag class name>”
The class that cannot be loaded is indeed compiled and in the /webapp/WEB-INF/classes folder.
Thanks for your help,
Chris Kovacs.
mdichiMemberYou may want to check your Java build path, so that MyEclipse can locate the JARs in order to build. You can do this by looking at the project properties (right click on the project), click on Java Build Path (on the left) and then click on the Libraries tab. You can add JARs there.
Mike
Chris KovacsMemberThanks, but that’s been taken care of.
Riyad KallaMemberChris,
I’m a little confused, in your question you ask about using custom taglibs, but in your example code you provide a standard inline-include statement. So let me focus first on the include statement:1) what you have looks to be a correct well-formed include statement. Can you try right-clicking on the root of your web project and going down to the MyEclipse menu item and clicking “Recompile all JSPs” and see if that gets rid of the error?
2) (OPTIONAL) Per the JSP tutorial (spec too I believe), it is suggested that if you are creating JSP pages intended solely for inclusion into other pages (via some include mechanism) that you name these pages “.jspf” for JSP-Fragment. This helps to tell the compiler to not to try and compile these pages on their own, to help avoid any errors that might arise.
3) Does your menu.jsp file compile properly? If you open it up, and make some changes and hit save, does it list any errors or warnings?
4) If you are having TAGLIB issues, make sure to define your taglib URIs in your web.xml file. Also make sure your TLDs are in your WEB-INF directory (although I think its valid to have them in any subdir as well for some containers).
5) Relating to your taglib issue: when you are editing a JSP page that you have a @taglib directive using one of your custom libs, does the MyEclipse JSP editor provide completion for your tag libs correctly?And last but not least, don’t forget when you are replying to hit the “Insert” button right above the message body and fill out the system info so we know what version of what software you are using (to help us troubleshoot).
hbombMember– System Setup ——————————-
Operating System and version: Windows XP Professional
Eclipse version: 2.1.2
Eclipse build id: 200311030802
MyEclipse version: 2.6.200
Eclipse JDK version: 1.4
Application Server JDK version: 1.4– Message Body ——————————-
Hi there,
I’m having a problem similar to Chris. I have a Web project that uses some custom tags. The classes are located in the WEB-INF/classes folder
and the TLD is in WEB-INF/ . I have the followind entry in my web.xml<taglib>
<taglib-uri>/WEB-INF/xyz.tld</taglib-uri>
<taglib-location>/WEB-INF/xyz.tld</taglib-location>
</taglib>In my jsp pages I have a taglib declaration statement that reads
<%@ taglib uri=”/WEB-INF/xyz.tld” prefix=”app” %>The error I get when trying to compile the JSPs is
“cannot load class: <classname>”This error occurs for every tag in the TLD.
The funny thing is that I didn’t have a problem with this before and yesterday I added a new class to the package and updated the TLD. After that I started seeing this error. I have also tried bundling the classes into a jar and including it in my build path but it still doesn’t work.
Also, when I type the tag prefix and hit ctrl <space> I do see the tags in this library. In other words, code completion works.
Finally, not sure if this has any relevance but the jsp files I am having problems with are Struts Tile jsp’s. They are the body tiles.
I’m totally baffled by this. Any ideas would be greatly appreciated.
TIA
-Hector
Chris KovacsMemberThank you for your help, Riyad, this is what did the trick:
“Can you try right-clicking on the root of your web project and going down to the MyEclipse menu item and clicking “Recompile all JSPs” and see if that gets rid of the error? ”
And Hector, this may fix your problem.
One more question for Riyad: Do I have to recompile all the JSPs whenever I add a new class that’s referenced by one of my JSP pages? That’s a little bit of a pain because this project has many pages. It’s not a big deal though.
– Chris Kovacs.
Riyad KallaMemberChris,
I’m glad to hear that fixed it. In answer to your question, I believe this solved your problem because of a slight issue with the syncronization of pages getting out of whack. I reported this issue a while ago and believe the dev team is well aware of it. Please keep us posted if it keeps happening though, it is frustrating.
No OperationMemberThe funny thing is that I didn’t have a problem with this before and yesterday I added a new class to the package and updated the TLD.
maybe you have some not yet detected error in your TLD file?
NOP
hbombMember@nop wrote:
The funny thing is that I didn’t have a problem with this before and yesterday I added a new class to the package and updated the TLD.
maybe you have some not yet detected error in your TLD file?
NOP
Hello again,
I did try recompiling all my JSP’s and unfortunately still got the same error. I also checked my TLD again
and it did look fine. I even tried removing my latest entry and the errors still appeared for the remaining classes (tags)
in my TLD.Any other ideas?
Thanks again
-Hector
No OperationMembermore thinkin:
“in included file ../webapp/includes/menu.jsp (2): cannot load class: <custom tag class name>”
If this is the class name which is specified ins the TLD file, your TLD file seems to be ok (sorry for asking).
What happens if you create a Java file in that project, lookin like:
public class Test { public static void main(String[]args) { try { TagClassName tag = new TagClassName(); } catch (Exception ex) { ex.printStackTrace(); } } }
Does it run fine, or throw an exception?
NOP
hbombMemberHi there,
I tried creating a Test.class which simply instantiates a class in my TLD and it workerd fine. ME doesn’t seem to be having any problems finding my classes in most situations except when I try to use them in JSP’s
Wow, this is really frustrating. I’ve been on this for about 3 days now and no luck. I’m really a big fan of MyEclipse but this could really be a deal breaker.
Thanks to everyone who tried to help.
-Hector
Riyad KallaMemberhbomb,
We really want to get you up and running. Is it possible to package up a 3-file test project that exhibits the beahvior you are seeing (Java file, JSP file, TLD file) and send it to support@genuitec.com with a description of the problem that it exhibits so Scott/Michael can pass it off the dev team so they have something concrete to work with?
hbombMember– System Setup ——————————-
Operating System and version: Windows 2000 Professional Service Pack 4
Eclipse version: 2.1.2
Eclipse build id: 200311030802
MyEclipse version: 2.6.4
Eclipse JDK version: 1.4.1
Application Server JDK version: 1.4.1– Message Body ——————————-
Hi Riyad,
I have created a test project and have it sent it off.
After creating the test project, I decided to try a little test. I have another machine here with the above setup. I imported the test project into this version of ME and everything worked fine. I also imported my original project and it too worked fine.
I’ve looked around and can’t find any difference between the setups besides the OS version and the version of ME.
Thanks again for your help.
Best Regards
-Hector
Riyad KallaMemberHector,
Hmm ok atleast we are getting somewhere now.Some things we can try:
-
1) Upgrade the JDK you are using to 1.4.2_03
2) Make sure that when you restart Eclipse that the new JDK/JRE are picked up in Window->Preferences->Java->Installed JREs
3) Make sure that under “Installed JREs” you don’t just use the default JRE (e.g. C:\Program Files\Java\…) but change it to point to your JDK installation (e.g. C:\j2sdk1.4.2_03)
4) (OPTIONAL) Upgrade the version of MyEclipse to 2.7RC2 to see if that fixes the problem temporarily so you can get your work done using ME.
5) Double check the log file (<eclipse install dir>\workspace\.metadata\.log to make sure that when you try and autocomplete in the file that is having trouble, Eclipse isn’t throwing exceptions that might help us track down the problem
6) Always a good idea to double check file permissions if you are working in a non-administrative environment (aka work domain, not local administrator on your box)
7) Try deleting the project locally, closing eclipse, restarting eclipse and recreating the project with the proper “Web Capabilities” and/or “Struts Capabilities” if necessary. Then try and edit that JSP file with the include file. Its possible something got corrupt, and when you went and tried this one the new machine everything works because it was created from scratch.Please anyone pitch in anything I’ve forgotten (NOP any ideas?).
hbombMemberHi Riyad,
Thanks for all the suggestions but unfortunately I still have the problem. I updated my jdk to 1.4.2_03 and also updated ME to 2.7 RC2. I checked the log file but it doesn’t generate any kind of exception when I code complete any of the tags. I also tried recompiling all the JSP’s again but still no luck.
By the way, did you all receive the test project I sent?
Thanks
best regards
-Hector -
AuthorPosts