facebook

JSP Editing / TLDs in Jar Files

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #224724 Reply

    Norm Deane
    Member

    Does MyEclipse look for TLD files in the jar files defined in the project’s build path? It doesn’t appear to be. I just installed 3.8.4 with Eclipse 3.0.1 and it is reporting errors on pages that use tag libraries from jar files…

    Unknown tag (logic:forward).

    I tried an earlier version of MyEclipse and it seemed like it would resolve TLD files in jar files. We typically don’t bundle the TLD files for Struts, JSTL, etc in our war file. We just include the appropriate jar file with the TLD included in it.

    Thanks,

    Norm

    #224728 Reply

    Riyad Kalla
    Member

    Does MyEclipse look for TLD files in the jar files defined in the project’s build path?

    Yes, the TLDs (per the JSP spec) need to be in the ‘META-INF’ folder somewhere off the root of the JAR file.

    and it is reporting errors on pages that use tag libraries from jar files…

    Your URI is most likely wrong, read this FAQ entry first: http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-31.html#251

    Then post your <@ taglib> lines for me to look at if that doesn’t help. Please note that the default URIs changed between Struts 1.1 and 1.2, so if your URIs look like http://jakarta.apache.org/struts, that is Struts 1.1, the Struts 1.2 tags look like http://struts.apache.org/tags-bean, etc.

    #224730 Reply

    Norm Deane
    Member

    Here’s a simple page in our app that is generating an error. We’re using the standard Struts 1.2.4 distribution.

    
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
    
    <logic:forward name="GetWorkersByVunetId" /> 
    
    #224731 Reply

    Riyad Kalla
    Member

    Looks good, are you sure you are opening the JSP pages with the “MyEclipse JSP Editor”? Close the file you are working on, right click on it in the package view > Open With > MyEclipse JSP Editor. Are you sure you have struts.jar added to your Build Path? If you expand it in your package view, and look in the META-INF dir, do you see the tlds? If you double click the logic TLD, and look near the top for the default URI (<uri></uri> tags) does it match what you have in your JSP page? If you rebuild your project do the problems go away?

    #224732 Reply

    Norm Deane
    Member

    Yes. I am opening them in the MyEclipse JSP Editor (using Open With). Struts is in the build path. In struts-1.2.4.jar/META-INF/tlds/struts-logic.tld I see…

    
    <taglib>
    <tlibversion>1.2</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>logic</shortname>
    <uri>http://struts.apache.org/tags-logic</uri> 
    
    ...
    
    #224733 Reply

    Riyad Kalla
    Member

    What about the closing/reopening/rebuilding project?

    #224734 Reply

    Norm Deane
    Member

    I’ve closed the project, reopened the project, cleaned the project, closed and reopened Eclipse and no change.

    #224739 Reply

    Riyad Kalla
    Member

    deanen,
    Everything you are doing/have setup looks kosher. Can you create a small sample Struts project that exhibits this problem and email it to support@genuitec.com so I can take a look at it and see what might be going on?

    In the mean time there are more drastic things to try just for sanity-checking sake:
    1) Create a new workspace, try a new Struts project, does it work?
    2) Reinstall a fresh copy of Eclipse SDk and MyEclipse in parallel to your existing installation (just for testing) and see if it works there.

    You might want to try these out in addition to me getting your test project because if it works over here (which I’m assuming it will since this bug alone would keep me from any of the development I do with ME) these next 2 steps will be what I ask you to do.

    #224767 Reply

    Norm Deane
    Member

    I setup a simple test project and in the process I discovered something. We use Maven. With Maven all jar files are stored in a central repository rather than locally within the directory structure of each project. The jar files are resoved in Eclipse using a Classpath variable (MAVEN_REPO). So with Maven & Eclipse each jar file is defined by a .classpath entry that looks something like…

    
    <classpathentry kind="var"
                            path="MAVEN_REPO/struts/jars/struts-1.1.jar"/>
    

    Instead of the typical approach where jar file classpath entries are resolved using normal filesystem locations like…

    
    <classpathentry kind="lib" path="lib/struts-1.1.jar"/>
    

    I only get the JSP taglib error when using the Maven approach. If I change the .classpath to use the typical approach the MyEclipse JSP Editor works fine.

    Can you try to duplicate on your side? I can send my project if you can’t.

    Norm

    #224768 Reply

    Riyad Kalla
    Member

    Norm,
    This is a known issue that likely will not get fixed any time soon due to the limitations of how the Eclipse platforms handles in-project resources as opposed to external resources (a JAR in a project is not the same as a JAR outside of the project). A side effect of which you have just discovered…

    The workaround is to place all your JARs in a Java Project and then make that project a dependency of your Web Project, alternatively, you can just drop the TLDs in your WEB-INF (or subdir) and specify their locations in your web.xml file.

    Also I would add that you said you are using Struts 1.2, and all your taglib URIs are for Struts 1.2, yet the snippet above shows paths to Struts 1.1… not that it will fix the problem, but just double check that everything is kosher in your project.

    #224772 Reply

    Norm Deane
    Member

    @support-rkalla wrote:

    Norm,
    This is a known issue that likely will not get fixed any time soon due to the limitations of how the Eclipse platforms handles in-project resources as opposed to external resources (a JAR in a project is not the same as a JAR outside of the project). A side effect of which you have just discovered…

    That’s a shame. I had tried MyEclipse once last year and was very happy with it. I was going to give it one more trial and pending the success of that trial was going to recommend our group purchase it for our developers.

    I don’t understand the problem though. I’ve written an Eclipse plugin recently and am somewhat familiar with how it deals with the classpath and the types of classpath entries defined in the eclipse classpath. I don’t see how it would create a problem.

    @support-rkalla wrote:

    The workaround is to place all your JARs in a Java Project and then make that project a dependency of your Web Project, alternatively, you can just drop the TLDs in your WEB-INF (or subdir) and specify their locations in your web.xml file.

    This is not a viable option for us. We have several projects each with their own unique set of dependencies. This approach would require 2 “physical” projects for every “logical” project. The other alternative, putting the TLD files in WEB-INF, is not a very attractive option either.

    @support-rkalla wrote:

    Also I would add that you said you are using Struts 1.2, and all your taglib URIs are for Struts 1.2, yet the snippet above shows paths to Struts 1.1… not that it will fix the problem, but just double check that everything is kosher in your project.

    We’re using 1.2.4 on most projects. I used Struts 1.1 for the test project to see if it might be a problem in Struts 1.2.4.

    Is there any way I can track this issue (via a watch in Jira or whatever) so that I can give it another go when this issue is resolved?

    Norm

    #224774 Reply

    Riyad Kalla
    Member

    I don’t understand the problem though. I’ve written an Eclipse plugin recently and am somewhat familiar with how it deals with the classpath and the types of classpath entries defined in the eclipse classpath. I don’t see how it would create a problem.

    The developer that looked into this has this to say about the issue:

    External jars can’t currently be parsed for TLDs because all the lookup and
    parsing logic depends on the Eclipse resource model (IResource) and external
    files are not compatible with this model. Workaround is to use jars somewhere in the workspace on the classpath.

    The same issue affects user libraries since these are always composed of
    external jars.

    Is there any way I can track this issue (via a watch in Jira or whatever) so that I can give it another go when this issue is resolved?

    Not currently, our tracking system is internal as we don’t just use it to track MyEclipse issues.

    #225495 Reply

    mnk.dk
    Member

    @support-rkalla wrote:

    The workaround is to place all your JARs in a Java Project and then make that project a dependency of your Web Project, alternatively, you can …..

    For validation this is true, but the JSP editor does not find the TLD’s in jar-files in dependent projects. (I’m using 3.8.4+QF2)

    /Mathias

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: JSP Editing / TLDs in Jar Files

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