4 Replies Latest reply on Feb 5, 2005 5:35 PM by Scott Stark

    Invalid <url-pattern> /WEB-INF/*.tld

    John Vandale Newbie

      JBoss throws this exception when deploying my app:

      "Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> /WEB-INF/*.tld in security constraint"

      This pattern is indeed in my web.xml but so what? WLS is ok with it. Is it not a perfectly valid URL?

      This error prevents my app from deploying.

      If anyone knows why JBoss is complaining about this and/or how to resolve it please let me know.

      Thanks.

        • 1. Re: Invalid <url-pattern> /WEB-INF/*.tld
          Elaine Castle Newbie

          I have the same kind of error. I am using JBoss 4.0.1 (with embedded Tomcat/5.0.28).

          If I try this:
          <servlet-mapping>
          <servlet-name>testservlet</servlet-name>
          <url-pattern>/me/*.do</url-pattern>
          </servlet-mapping>
          OR
          <servlet-mapping>
          <servlet-name>testservlet</servlet-name>
          <url-pattern>me/*.do</url-pattern>
          </servlet-mapping>
          OR
          <servlet-mapping>
          <servlet-name>testservlet</servlet-name>
          <url-pattern>me\*.do</url-pattern>
          </servlet-mapping>
          I get the error below (note: the servlet itself exists, and I've changed the name several times and that's not what is causing the problem).


          10:41:38,265 ERROR [ContextConfig] Parse error in application web.xml
          java.lang.IllegalArgumentException: Invalid <url-pattern> /me/*.do in servlet mapping
          at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
          at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
          at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
          at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
          at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
          at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
          at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
          at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
          at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
          at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
          at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
          at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
          at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
          at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
          at org.apache.commons.digester.Digester.parse(Digester.java:1548)
          at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:263)
          at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:624)
          at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
          at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)
          at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
          at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          at org.apache.catalina.core.StandardContext.init(StandardContext.java:5441)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)
          at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
          at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:332)
          at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:85)
          at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:374)
          at org.jboss.web.WebModule.startModule(WebModule.java:62)
          at org.jboss.web.WebModule.startService(WebModule.java:40)
          at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
          at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
          at $Proxy0.start(Unknown Source)
          at org.jboss.system.ServiceController.start(ServiceController.java:416)
          at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
          at $Proxy28.start(Unknown Source)
          at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:360)
          at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
          at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
          at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
          at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
          at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
          at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
          at $Proxy8.deploy(Unknown Source)
          at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
          at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:463)
          at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
          at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
          at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
          10:41:38,265 ERROR [ContextConfig] Occurred at line 132 column 23


          However, if I try this:
          <servlet-mapping>
          <servlet-name>testservlet</servlet-name>
          <url-pattern>*.do</url-pattern>
          </servlet-mapping>
          all is well. So it appears the the "/" within the url-pattern is causing the error.

          • 2. Re: Invalid <url-pattern> /WEB-INF/*.tld
            Scott Stark Master

            Its from the servlet 2.4 spec, 11.2. The url-pattern must be one of:


            + A string beginning with a '/' character and ending with a '/*' suffix is used
            for path mapping.
            + A string beginning with a '*.' prefix is used as an extension mapping.
            + A string containing only the '/' character indicates the "default" servlet of
            the application. In this case the servlet path is the request URI minus the context
            path and the path info is null.
            + All other strings are used for exact matches only.



            • 3. Re: Invalid <url-pattern> /WEB-INF/*.tld
              Elaine Castle Newbie

              A little more research on this found me this link:

              http://www.javakb.com/Uwe/Forum.aspx/java-tools/501/Tomcat-5-0-web-xml-filter-mapping-url-pattern-content-jsp

              Guess my issue with this is that if you are running pointing to a 2.3 DTD shouldn't it work as it used to?

              • 4. Re: Invalid <url-pattern> /WEB-INF/*.tld
                Scott Stark Master

                The 2.3 servlet spec has the same mapping rules. If tomcat 4.1 did not throw an exception for an invalid url-pattern, file a bug report on the tomcat site asking if the more leniant behavior can be enabled. In general they are anal about not allowing what they view as non-spec behavior.

                http://jakarta.apache.org/site/bugs.html