5 Replies Latest reply on Dec 20, 2012 4:38 PM by Nico Nico

    Servlet cannot find taglib

    Naeem Ally Newbie

      I got my application successfully deployed but when I got to my web page I get the following error.

      I'm using jboss 7.0.10.Final

       

      {quote}

      16:49:00,137 INFO  [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /sim-web

      16:49:00,224 INFO  [org.jboss.as.server] (management-handler-threads - 1) JBAS018559: Deployed "sim-web.war"

      16:49:18,996 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/sim-web].[jsp]] (http--0.0.0.0-8080-1) Servlet.service() for servlet jsp threw exception: org.apache.jasper.JasperException: The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application

                at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:239) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:448) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1398) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Parser.parse(Parser.java:130) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:194) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:360) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.10.Final.jar:]

                at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.10.Final.jar:]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

                at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:162) [spring-security-web.jar:3.0.6.RELEASE]

                at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) [spring-web.jar:3.0.6.RELEASE]

                at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) [spring-web.jar:3.0.6.RELEASE]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]

                at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]

                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29]

       

      {quote}

       

      The taglib is found in the spring-mvc jar and that jar is present in my spring module

      {code:xml}

      <module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">

       

       

          <resources>

              <resource-root path="spring-context.jar"/>

              <resource-root path="spring-context-support.jar"/>

              <resource-root path="spring-beans.jar"/>

              <resource-root path="spring-aop.jar"/>

              <resource-root path="spring-asm.jar"/>

              <resource-root path="spring-core.jar"/>

              <resource-root path="spring-jdbc.jar"/>

              <resource-root path="spring-expression.jar"/>

              <resource-root path="spring-tx.jar"/>

              <resource-root path="spring-jms.jar"/>

              <resource-root path="spring-orm.jar"/> 

              <resource-root path="spring-security-acl.jar"/>

              <resource-root path="spring-security-config.jar"/>

              <resource-root path="spring-security-core.jar"/>

              <resource-root path="spring-security-taglibs.jar"/>

              <resource-root path="spring-security-web.jar"/>

              <resource-root path="spring-web.jar"/>

              <resource-root path="spring-webmvc.jar"/>

              <resource-root path="aopalliance-1.0.jar"/>

          </resources>

       

       

          <dependencies>

              <module name="javax.api" />

              <module name="javax.jms.api" />

              <module name="javax.annotation.api" />

              <module name="org.apache.commons.logging" />

              <module name="org.jboss.vfs" />

              <module name="javax.servlet.api" />

              <module name="javax.servlet.jsp.api" />       

              <module name="javax.xml.ws.api" />

              <module name="javax.jws.api" />

              <module name="javax.persistence.api" />

              <module name="javax.validation.api"></module>

              <module name="org.apache.tiles"></module>

              <module name="org.hibernate.validator" services="import">

                  <imports>

                      <include path="META-INF**" />

                      <include path="org**" />

                  </imports>

              </module>

          </dependencies>

      </module>

       

      {code}

       

      I also added the spring module in jboss-deployment-structure

       

      {code:xml}

                  <module name="org.springframework.spring" services="import" export="true">

                     <imports>

                          <include path="**" />

                      </imports>

                  </module>

       

      {code}

       

      and I added the spring module in my manifest

       

      Manifest-Version: 1.0

      Dependencies: org.slf4j, org.apache.cxf services, org.springframework.spring services, org.hibernate, org.hibernate.validator services, org.apache.ws.security

      Class-Path:

       

       

      How else do I get my app to recognise the spring.tld?

        • 1. Re: Spring MVC cannot find taglib
          Naeem Ally Newbie

          I added spring-webmvc.jar to my WEB-INF/lib folder and the jsp page now compiles successfully.

          This however does not make sense as I have this jar referenced twice in application,

          1. in the WEB-INF/lib and

          2. in the module dependencies

          1 of 1 people found this helpful
          • 2. Re: Spring MVC cannot find taglib
            Nico Nico Newbie

            Hi Naeem, did you solve this issue?

             

            I'm having the same problem but with spring-security (not working with module, working with jar inside lib).

             

            Jboss is 7.1 and the error says that uri http://www.springframework.org/security/tags can't be found in web.xml or in the jars included in lib folder (of course because they're in the module, not in web.xml or jars bundled in war app).

             

            Here is my spring-security module definition.

            {code}<module xmlns="urn:jboss:module:1.0" name="org.springframework.security">

                <resources>

                            <resource-root path="spring-security-acl-3.1.2.RELEASE.jar"/>

                            <resource-root path="spring-security-config-3.1.2.RELEASE.jar"/>

                            <resource-root path="spring-security-core-3.1.2.RELEASE.jar"/>

                            <resource-root path="spring-security-taglibs-3.1.2.RELEASE.jar"/>

                            <resource-root path="spring-security-web-3.1.2.RELEASE.jar"/>

                </resources>

                <dependencies>

                    <module name="javax.api"/>

                    <module name="javax.annotation.api"/>

                    <module name="javax.el.api"/>

                    <module name="javax.enterprise.api"/>

                    <module name="javax.ejb.api"/>

                    <module name="javax.faces.api"/>

                    <module name="javax.interceptor.api"/>

                    <module name="javax.mail.api"/>

                    <module name="javax.persistence.api"/>

                    <module name="javax.servlet.api"/>

                    <module name="javax.servlet.jsp.api"/>

                    <module name="javax.transaction.api"/>

                        <module name="net.sf.ehcache"/>

                        <module name="org.springframework.spring" export="true"/>

                 </dependencies>

            </module>{code}

             

            Here my jboss-deployment-structure.xml

             

            {code}<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

             

              <deployment>

                <exclude-subsystems>

                  <subsystem name="jpa" />

                  <subsystem name="ejb3" />

                </exclude-subsystems>

                <dependencies>

                  <module name="org.springframework.spring" export="true">

                    <imports>

                      <include path="META-INF**"/>

                      <include path="org**"/>

                    </imports>

                  </module>

                  <module name="org.springframework.security" export="true">

                    <imports>

                      <include path="**"/>

                    </imports>

                  </module>

             

                  <module name="org.hibernate" export="true"/>

                </dependencies>

              </deployment>

             

            </jboss-deployment-structure>{code}

             

            Thanks in advance!

            • 3. Re: Spring MVC cannot find taglib
              Naeem Ally Newbie

              Sorry, I didn't look into this further.

              • 4. Re: Spring MVC cannot find taglib
                Stephen Coy Master

                Right now JBoss conforms to the spec, in that taglib tlds are only automatically found in jars in the WEB-INF/lib directory.

                 

                You could extract the various Spring tlds and add them to each webapp in your build process.

                 

                Check the spec or a JSP book on where to put them.

                • 5. Re: Spring MVC cannot find taglib
                  Nico Nico Newbie

                  Thanks Stephen, although not ideal, putting tlds inside WEB-INF folder resolve the issue in my case.