tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: tld files inside jars are not auto discovered
Date Sun, 27 Nov 2005 06:15:20 GMT
You need to install your tld in /META-INF/.  Paths in jar files are 
case-sensitive.

"Aaron Loucks" <loucks@cofront.net> wrote in message 
news:4387F654.4090200@cofront.net...
>I can't get TLD auto discovery to work for any custom taglibs i write
> when I package them as jars. It works fine for the standard taglibs
> (core, fmt, etc..). The tld file is packaged inside the jar as
> '/meta-inf/breadcrumbs_1_0.tld', and breadcrumbs-1.0.jar is located in
> /WEB-INF/lib. If i put a copy of the tld in the WEB-INF directory and
> add a <taglib/> entry for it in web.xml, I'm able to use the tags. I
> don't understand why Tomcat (5.0.28) is auto detecting the TLD files
> inside the standard taglibs (standard.jar), but it won't autodetect them
> in jar files i produce. Any help would be greatly appreciated.
>
> -Aaron
>
> test.jsp:
>
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>    pageEncoding="ISO-8859-1" %>
>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> <%@ taglib prefix="bc"
> uri="http://projects.cofront.net/tablibs/breadcrumbs" %>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>Breadcrumb Test</title>
> </head>
> <body>
>    <bc:breadcrumbs separator=" &#187; " style="color:red;">
>        <bc:breadcrumb href="page1.htm">page1</bc:breadcrumb>
>        <bc:breadcrumb href="page2.htm">page2</bc:breadcrumb>
>        <bc:breadcrumb href="page3.htm">page3</bc:breadcrumb>
>    </bc:breadcrumbs>
>
> </body>
> </html>
>
> Produces the following error:
>
> org.apache.jasper.JasperException: The absolute uri:
> http://projects.cofront.net/tablibs/breadcrumbs         cannot be
> resolved in either web.xml or the jar files deployed with this application
>
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
>
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:411)
>
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:118)
>
> org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:316)
>
> org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:147)
>    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
>    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
>    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
>    org.apache.jasper.compiler.Parser.parse(Parser.java:126)
>
> org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
>
> org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
>    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
>    org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
>
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
> 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> *note* _The full stack trace of the root cause is available in the
> Apache Tomcat/5.0.28 logs.
>
>
>
> _breadcrumbs_1_0.tld:
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
>    version="2.0">
>
>  <description>Breadcrumbs library</description>
>  <display-name>Breadcrumbs</display-name>
>  <tlib-version>1.1</tlib-version>
>  <short-name>bc</short-name>
>  <uri>http://projects.cofront.net/tablibs/breadcrumbs</uri>
>  <tag>
>    <description>Creates Breadcrumbs.</description>
>    <name>breadcrumbs</name>
>    <tag-class>net.cofront.taglibs.breadcrumbs.BreadCrumbsTag</tag-class>
>    <body-content>JSP</body-content>
>    <attribute>
>        <description>Separator string.</description>
>        <name>separator</name>
>        <required>yes</required>
>        <rtexprvalue>true</rtexprvalue>
>    </attribute>
>    <attribute>
>        <description>CSS style to be applied to all breadcrumb
> links.</description>
>        <name>style</name>
>        <required>no</required>
>        <rtexprvalue>true</rtexprvalue>
>    </attribute>
>    <attribute>
>        <description>CSS style class to be applied to all breadcrumb
> links.</description>
>        <name>styleClass</name>
>        <required>no</required>
>        <rtexprvalue>true</rtexprvalue>
>    </attribute>
>  </tag>
>  <tag>
>    <description>A Breadcrumb.</description>
>    <name>breadcrumb</name>
>    <tag-class>net.cofront.taglibs.breadcrumbs.BreadCrumbTag</tag-class>
>    <body-content>JSP</body-content>
>    <attribute>
>        <description>URL</description>
>        <name>href</name>
>        <required>true</required>
>        <rtexprvalue>false</rtexprvalue>
>    </attribute>
>  </tag>
> </taglib>
>
>
> web.xml:
>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>  version="2.4">
>
>    <display-name>ROOT</display-name>
>
>    <servlet>
>        <servlet-name>action</servlet-name>
>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>        <init-param>
>            <param-name>config</param-name>
>            <param-value>/WEB-INF/config/struts-config.xml</param-value>
>        </init-param>
>        <load-on-startup>1</load-on-startup>
>    </servlet>
>
>    @maven.tomcat.generated@
>
>    <servlet-mapping>
>        <servlet-name>action</servlet-name>
>        <url-pattern>*.do</url-pattern>
>    </servlet-mapping>
>
>    <jsp-config>
>    <!--
>        <taglib>
>
> <taglib-uri>http://projects.cofront.net/taglibs/breadcrumbs</taglib-uri>
>            <taglib-location>/WEB-INF/breadcrumbs_1_0.tld</taglib-location>
>        </taglib>
>    -->
>    </jsp-config>
>
>    <welcome-file-list>
>        <welcome-file>index.html</welcome-file>
>        <welcome-file>index.htm</welcome-file>
>        <welcome-file>index.jsp</welcome-file>
>    </welcome-file-list>
>
> </web-app>
>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message