Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java error: message Invalid tld file: see JSP 2.2 specification section 7.3.1 for more details

Tags:

java

jsp

when i visit local java tomcat page, the error is follow,please help to check what's wrong with this, thank you

jsp code

<%@ taglib prefix="p" uri="/WEB-INF/classes/tld/pagertag.tld"%>

error log:

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Invalid tld file: "/WEB-INF/classes/tld/pagertag.tld", see JSP 2.2 specification section 7.3.1 for more details

at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:347)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:154)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:419)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421)
at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
like image 817
Jonny Avatar asked Jul 26 '16 15:07

Jonny


3 Answers

as per documentation

Tag library descriptor files have names that use the extension .tld, and the extension indicates a tag library descriptor file. When deployed inside a JAR file, the tag library descriptor files must be in the META-INF directory, or a subdirectory of it. When deployed directly into a web application, the tag library descriptor files must always be in the WEB-INF directory, or some subdirectory of it. TLD files should not be placed in /WEB-INF/classes or /WEB-INF/lib, and must not be placed inside /WEB-INF/tags or a subdirectory of it, unless named implicit.tld and intended to configure an implicit tag library with its JSP version and tlib-version.

you can place your tag lib inside WEB-INF/tags with rename implicit.tld

like image 152
rinkesh Avatar answered Nov 20 '22 05:11

rinkesh


In the jsp-2_2

JSP.7.3.1 Identifying Tag Library Descriptors Tag library descriptor files have names that use the extension .tld, and the extension indicates a tag library descriptor file. When deployed inside a JAR file, the tag library descriptor files must be in the META-INF directory, or a subdirectory of it. When deployed directly into a web application, the tag library descriptor files must always be in the WEB-INF directory, or some subdirectory of it. TLD files should not be placed in /WEB-INF/classes or /WEB-INF/lib, and must not be placed inside /WEB-INF/tags or a subdirectory of it, unless named implicit.tld and intended to configure an implicit tag library with its JSP version and tlib-version.

the .tld file can't be in classes , lib ,tags folder or subfolder.

like image 27
dahuade Avatar answered Nov 20 '22 04:11

dahuade


As quick solution, you can just copy below two libraries from the lib folder of tomcat 7.0.64 and place it in your project root or if you are using maven then add these two as dependency in your pom.xml file:

jasper.jar jasper-el.jar

This will resolve your issue.

like image 1
user3734021 Avatar answered Nov 20 '22 03:11

user3734021