facebook

Taglib problem : Cannot load class [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #197980 Reply

    waybck
    Member

    Hi.

    Before I installed MyEclipse I had another web-project where my custom taglib worked perfectly. I have moved the code and structure over to a new MyEclipse J2EE Web Module Project, and it now gives me an error on the jsp that uses the taglib.

    Here is my setup :
    ——————————-
    Under the ‘Java Source’ folder, there is a class that implements TagSupport in the package no.ekonsult.cms.taglib

    public class PresentContent extends TagSupport
    ———————————–
    In this folder Web Root/WEB-INF/tlds, there is a taglib definintion, customtaglibs.tld :
    <?xml version=”1.0″ encoding=”ISO-8859-1″ ?>

    <!DOCTYPE taglib PUBLIC “-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN”
    http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd”&gt;

    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>cms</shortname>
    <uri></uri>
    <info>Custom tag library</info>

    <tag>
    <name>presentContent</name>
    <tagclass>no.ekonsult.cms.tagblib.PresentContent</tagclass>
    <bodycontent>empty</bodycontent>
    <info>This tag looks for content to present in current position and prints it if any</info>
    <attribute>
    <name>contentPosition</name>
    <required>true</required>
    </attribute>
    <attribute>
    <name>contentHolder</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>

    ——————————–
    In web.xml, there is a reference to the taglib :
    <taglib>
    <taglib-uri>/WEB-INF/tlds/customtaglib.tld</taglib-uri>
    <taglib-location>/WEB-INF/tlds/customtaglib.tld</taglib-location>
    </taglib>

    —————————————–
    And finally, in the jsp, it is included :
    <%@ taglib prefix=”cms” uri=”/WEB-INF/tlds/customtaglib.tld” %>

    This gives me full code completion for the tag <cms:, so it seems to find the class/definition, but I get the following error listet in tasks in Eclipse, and also when running the jsp file :

    cannot load class:no.ekonsult.cms.taglib.PresentContent

    What am I doing wrong ? As mentioned, it worked in the other web project, but not in the MyEclipse Web module.

    Best Regards
    Eirik Kjølsrud

    #197982 Reply

    Scott Anderson
    Participant

    Eirik,

    It appears that everything you have is configured correctly. Is your project located in the default location under the workspace diretory, or did you create it somewhere else on your file system?

    Also, please verify that the build output folder for your Java source directory is set to <webroot>/WEB-INF/classes and that this directory contains your taglibs class file in an appropriate directory structure.

    –Scott
    MyEclipse Support

    #197983 Reply

    waybck
    Member

    Hi,
    and thanks for superfast supprt 🙂

    Let’s see…

    @scott wrote:

    Is your project located in the default location under the workspace diretory, or did you create it somewhere else on your file system?

    Yes, I created the project directly under my workspace (default) location, so that should be ok.

    @scott wrote:

    Also, please verify that the build output folder for your Java source directory is set to <webroot>/WEB-INF/classes and that this directory contains your taglibs class file in an appropriate directory structure.

    Where do I check the output folder setup ?

    I looked in the ‘WEB-INF’ catalog, and in classes, in the following subdirectory structure, ‘no/ekonsult/cms/taglib/’, the file PresentContent.class was located.

    Eirik

    #197988 Reply

    Scott Anderson
    Participant

    Eirik,

    and thanks for superfast supprt 🙂

    You’re welcome. That’s just what we do here. 🙂

    Where do I check the output folder setup ?

    It’s located at <project> > Properties > Java Build Path > Source

    I know there was an issue in the current build regarding recognizing taglibs, but it was related to external projects or Linux installations. Could you provide the installation information requested in the “Posting Guidelines” announcement at the top of the forum? That will give me more to go on to determine the issue. In addition, please check the Eclipse log file, which is located at <workspace>/.metadata/.log, and see if there are any stacktraces that look relevant. With some more context I should be about to get you straightened out.

    –Scott
    MyEclipse Support

    #197999 Reply

    waybck
    Member

    Hi.

    I’ve had a look at the output folder setup, and that is set appropriately. The class files in the folder structure also suggested that.

    For my installation info, it is as follows :
    Window XP SP1
    Eclipse 2.1.1 Build id 200306271545
    – Eclipse was installed about to weeks ago
    – The other plugin installed is the Sysdeo Tomcat plugin
    – No. of org.eclipse.pde.* plugins : 7
    MyEclipse version 2.5.1
    Java version : j2sdk1.4.2 – b28
    Same sdk for Application server
    Application server Tomcat 4.1.27

    Steps :
    I had a Sysdeo Tomcat project that ran ok with the taglib.
    Created a MyEclipse j2ee web module
    Created the similar package structure as in my other project and moved my classes (the .java source), jsps and taglib def to the new project. I also copy-pasted the part from my old web.xml file in order to reference the taglib.

    Please refer to my first post for details about the contents of the taglib. tld, the web.xml.

    Is there anything else you need me to clarify or test ?

    – Eirik

    #198004 Reply

    Scott Anderson
    Participant

    Eirik,

    At this point it looks like this is a bug in version 2.5.1. Good news though; version 2.6.0 has a couple of fixes for classloading for taglibs that should address this issue and it will be available sometime on 8/22. That is, 8/22 in Dallas Texas USA; you’re local time may vary. 😉

    –Scott
    MyEclipse Support

    #198005 Reply

    waybck
    Member

    Great,

    I will try that on monday, and post the results here.

    Luckily, I’m way ahead of you into the friday, and am now about to leave work for the week-end 😉

    Have a nice one !

    Eirik

    #198018 Reply

    jw08816
    Member

    Scott,

    I have the same problem with Tablib and jsp:include. I upgraded my membership in order to download the latest version. But the file is not available yet. Today is already 8/22.

    Plz keep us posted about the status of the new release.

    Thanks,
    Jerry

    #198019 Reply

    Scott Anderson
    Participant

    Jerry,

    To be notified when new releases become available, please subscribe to the MyEclipse Newsletter. It’s available on the left navigation bar.

    –Scott
    MyEclipse Support

    #198028 Reply

    jw08816
    Member

    Scott,

    I subscribed to the newsletter. But nothing has been sent to me yet. In case I missed something, plz send me an email or post the link here when the new release is ready for download.

    I really need the taglib and jsp:include fixed. Both work fine with other plugins and JBuilder. But I like myeclipse better and I want to switch.

    Thanks,
    Jerry

    #198031 Reply

    Scott Anderson
    Participant

    Jerry,

    You haven’t received an email because the new release has not been posted yet. 🙂

    It’s going through final QA and should be posted during the night of 8/24, at which point a newsletter email will be sent out.

    –Scott
    MyEclipse Support

    #198033 Reply

    waybck
    Member

    Hi Scott.

    Upgraded to the 2.6.0 MyEclipse version today, but I still get the : “cannot load class: ” error on the taglibs, and it is still recognized by the code completion…
    You have about all of my details in the posts above. Are there any obvious mistakes I have made that can make my taglib use fail ?

    Could you perhaps point me to a step-by-step guide to a simple taglib, so that I can do that and verify that what work for others work for me ?

    Best Regards
    Eirik Kjølsrud, Norway

    #198035 Reply

    support-michael
    Keymaster

    0) Have you tried a full rebuild on the troubled project since the upgrade? We have seen a few cases where the navigator/package explorer views don’t accurately reflect the marker state on a project or resource. Also try closing the project and reopening it to see if that corrects any possible display sync problems.

    1) For a simple test project you can try creating a web-project on the struts sample code. That is one of our test cases.

    2) If #0 & #1 do not provide resolution or additional insight can you send us a copy of your project to support@genuitec.com for further investigation?

    Michael
    MyEclipse Support

    #198040 Reply

    waybck
    Member

    Hi Michael.

    I’ve tried both rebuilding and a combination of that with closing Eclipse and closing the project. I still get the error.

    I couldn’t get the code from the Struts site, I don’t know whether it is down or what, so I mailed you my projects. Please have a look at it and see if you can see the problems.

    Thanks
    Eirik

    #198069 Reply

    Scott Anderson
    Participant

    Eirik,

    The problem was a typographical error in your customtaglib.tld file. You mistyped the package name for your tag as:

    
        <tag>
            <name>presentContent</name>
            <tagclass>no.ekonsult.cms.tagblib.PresentContent</tagclass>
    

    Changing ‘tagblib’ to ‘taglib’ and recompiling the JSPs fixed the problem. You know, debugging your applications is not included in the “free support” thing. 😉

    –Scott
    MyEclipse Support

Viewing 15 posts - 1 through 15 (of 16 total)
Reply To: Taglib problem : Cannot load class [Closed]

You must be logged in to post in the forum log in