6 Replies Latest reply on Oct 6, 2014 9:48 AM by deepaksingla

    JBoss not parsing TLD file

    martsecurit

      Hello I am having issues with a WAR containing a custom TLD. This works fine under WebSphere and my tld file validates against these schemas:

      this http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd

      and this https://github.com/jboss/metadata/blob/master/web/src/main/resources/schema/web-jsptaglibrary_2_0.xsd

       

      Despite passing this validation JBoss refuses to parse the tld file. The tld file is stored in the root of the WEB-INF directory.

      Here is the error that I receive when deploying in JBoss and the tld is attached.

      Any idea what I can do? As I say no worries with WebSphere.

       

      Thanks for reading

       

      --------------------------- start error ---------------------------

      14:53:10,755 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.u

      nit."my.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."trustbuilder-admin

      .war".PARSE: Failed to process phase PARSE of deployment "my.war"

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-ser

      ver-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0

      .2.GA.jar:1.0.2.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar

      :1.0.2.GA]

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_24]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_24]

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

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018014: Failed to parse XML descriptor "/C:/

      jboss-7.1.1/bin/content/my.war/WEB-INF/tbagTag.tld" at [11,9]

              at org.jboss.as.web.deployment.TldParsingDeploymentProcessor.parseTLD(TldParsingDeploymentProcessor.java:128)

              at org.jboss.as.web.deployment.TldParsingDeploymentProcessor.deploy(TldParsingDeploymentProcessor.java:91)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-ser

      ver-7.1.1.Final.jar:7.1.1.Final]

              ... 5 more

      --------------------------- end error ---------------------------

        • 1. Re: JBoss not parsing TLD file
          martsecurit

          This is ridiculous. Why does JBoss not recognise the WEB-INF directory.

          If I place the tld file into WEB-INF/classes and make the refererence in my web.xml directly to the tld file with no preceeding web-inf so like this:

          <jsp-config>

             <taglib>

                <taglib-uri>http://myUri/tbagTag</taglib-uri>

                <taglib-location>/tbagTag.tld</taglib-location>

             </taglib>

          </jsp-config>

          • 2. Re: JBoss not parsing TLD file
            martsecurit

            OK I can now start the application but the first call to the tag gives this issue:

             

            org.apache.jasper.JasperException: The absolute uri: http://myUri/tbagTag cannot be resolved in either web.xml or the jar files deployed with this application

            org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)

             

            Again this all works fine in WebSphere. What is it that I need to do especially for JBoss?

             

            Thanks for reading.

            • 3. Re: JBoss not parsing TLD file
              sfcoy

              Have you tried:

              {code:xml}<taglib-location>tbagTag.tld</taglib-location>{code}

              ?

               

              This should be found if tbagTag.tld is in the WEB-INF directory. Your leading "/" makes it an absolute URI according to the spec. Presumably that is relative to the application context.

               

              I agree the structure of your tld file looks OK.

              • 4. Re: JBoss not parsing TLD file
                martsecurit

                In the end I got this working.

                JBoss will not accept the <info> element in the tld.  despite the fact that it validates agains both the Jboss and Oracle xsd.

                 

                So once I removed the info element which follows the body-content tag it works fine.

                 

                    <tag>

                        <name>acl</name>

                        <tag-class>be.securit.trustbuilder.admin.gui.jstl.AclTag</tag-class>

                        <body-content>JSP</body-content>

                        <info>clear description of the tag</info>

                        <attribute>

                 

                So now I have a .tld file stored in the WEB-INF root with no <info> tags and I reference this from the web.xml thus:

                <jsp-config>

                  <taglib>

                     <taglib-uri>http://myUri/jstl/mytag</taglib-uri>

                     <taglib-location>/WEB-INF/myTag.tld</taglib-location>    

                </taglib>

                </jsp-config>

                 

                And it all works fine.  Bit of a long way round to getting what works in WebSphere waste of a day really.

                • 5. Re: JBoss not parsing TLD file
                  sfcoy

                  There is no <info>...</info> tag in the schema. I should have spotted that before.

                   

                  You should perhaps be using <description>...</description> or <example>...</example>.

                  • 6. Re: JBoss not parsing TLD file
                    deepaksingla

                    Removing <info> tag from tag file didn't work for me :-(

                     

                    My tld file doesn't have following tags. so when I added below tags (given in bold letter was missing), After adding below tags, my tld (given below) was successfully parsed by Jboss deployment and was able to deploy successful with Jboss EAP 6.2 version.

                     

                    See the tablib (.tld file) file given below:

                     

                    <?xml version="1.0" encoding="ISO-8859-1" ?>

                    <!DOCTYPE taglib

                        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"

                        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">

                     

                    <taglib xmlns="http://java.sun.com/xml/ns/javaee" version="2.0"> 

                      <tlibversion>1.2</tlibversion>

                        <shortname>abcName</shortname>

                       <uri>http://abc.tags/cont</uri>

                       <tag>

                            <name>params</name>

                            <tagclass>com.abc.example.ExampleTag</tagclass>

                            <bodycontent>JSP</bodycontent>       

                        </tag>

                    </taglib>