Eclipse “cannot find the tag library descriptor” for custom tags (not JSTL!)

前端 未结 22 1570
情书的邮戳
情书的邮戳 2020-12-12 16:33

I have a Java EE project which build fine with Ant, deploys perfectly to JBoss, and runs without any trouble. This project includes a few custom tag librari

相关标签:
22条回答
  • 2020-12-12 16:40

    In Eclipse Helios "Java EE Module Dependencies" in the project properties has been replaced with "Deployment Assembly".

    So for solving this problem with Eclipse Helios, the way I did it is the following:

    • Right click on the project in package explorer and choose "Import..."
    • Accept the default selection "File System" and press "Next"
    • Press "Browse" in the From directory line, go to your tomcat installation and locate the file webapps/examples/WEB-INF/lib (I have tomcat 6, other versions of Tomcat may have the path webapps/jsp-examples/WEB-INF/lib). Once in the path press OK.
    • Click besides jstl.jar and standard.jar to activate the check boxes
    • On the line Into folder click on Browse and choose the library folder. I use /lib inside the project.
    • Click "Finish"
    • Right click on the project in Package Explorer view and choose properties (or press Alt + Enter)
    • Click on "Java Build Path"
    • Click "Add Jar", click on your project, folder lib, select jstl.jar, press OK
    • Click "Add Jar", click on your project, folder lib, select standard.jar, press OK
    • Press OK to dismiss the properties dialog
    • Click on the Problems view and select the message "Classpath entry .../jstl.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.".
    • Right click on it and select "Quick Fix".
    • Accept the default "Mark the associated raw classpath entry as a publish/export dependency" and press Finish.
    • Do the same for standard.jar

    This solves the problem, but if you want to check what has happened in "Deployment Assembly", open the project properties again, select "Deployment Assembly" and you'll see that standard.jar and jstl.jar have been added to WEB-INF/lib folder.

    0 讨论(0)
  • 2020-12-12 16:42

    This error can arise from several different sources. One case (not mentioned in other answers to this question) occurs when Eclipse does not implement the version of the JSP specification set in the TLD document. Eclipse releases typically lag behind up to a year in implementing newer servlet and JSP specifications. See this Eclipse bug for example.

    In this case, your web application may run fine in the latest version of Tomcat, but Eclipse may still complain about a missing TLD. The short term solution (short of ignoring the error in Eclipse) is to bump down the JSP version to the one that your version of Eclipse supports.

    Also, keep in mind the TLD version you are implementing. The tag names have changed slightly from v1.1 to v2.0 (i.e., info is now description on taglib and is not a valid element under tag, many of the element names now contain a hyphen). Eclipse has no tolerance for misspelled TLD tag names.

    TLD 2.0 (jsp-version 2.0) Reference

    TLD 2.1 (jsp-version 2.3) Reference

    0 讨论(0)
  • 2020-12-12 16:42

    I also faced the same problem. Make sure you have same versions of JSTL in Eclipse and in the Tomcat work directory, i.e in \webapps\examples\WEB-INF\lib and in lib folder.

    0 讨论(0)
  • 2020-12-12 16:44

    I faced same problem. This is what I did to resolve the issue.

    1. Select Project and right click.
    2. Click on properties.
    3. Click on libraries tab.
    4. Click on 'Add Jars'.
    5. Add relevant jar for your error.
    0 讨论(0)
  • 2020-12-12 16:44

    On the other hand, if you are only working on java source and are getting these errors from stuff you don't touch in a large project that is working, you can just turn off the validations in Eclipse. The settings are under Preferences->Web->JSP Files->Validation

    0 讨论(0)
  • 2020-12-12 16:49

    This was my problem and how I fixed it...

    I had done everything everyone had mentioned above etc. but was still getting this error. Turns out I was using the uri's of http://java.sun.com/jsp/jstl/fmt and http://java.sun.com/jsp/jstl/core which were incorrect.

    Try switching the uris from above to:

    http://java.sun.com/jstl/fmt
    http://java.sun.com/jstl/core
    

    Also, make sure you have the correct jars referenced in your class path.

    0 讨论(0)
提交回复
热议问题