2014-11-14 59 views
3

如果用戶已經通過身份驗證,我有一個Web過濾器可以從登錄頁面和索引頁面重定向。最初我有一個無效的URL模式。我定了無效模式,並試圖只能重新部署到收到此:部署到Glassfish 4.1時的URL模式無效

java.lang.IllegalArgumentException: Invalid URL Pattern: [{0}] 
at org.glassfish.web.deployment.node.WebResourceCollectionNode.setElementValue(WebResourceCollectionNode.java:136) 

我檢查圍繞在我的應用程序,看看如果我失去了一些東西或者輸入了別的東西是錯誤的。最後,我刪除了WebFilter類,從web.xml中刪除了它的映射並嘗試重新部署,並且繼續出現相同的錯誤。目前我無法重新部署應用程序。

我檢查了一些谷歌搜索,並遇到了this這似乎是一個類似的問題,但沒有解決方案。

完整的堆棧跟蹤:

Severe: Exception while deploying the app [NCW-war] 
Severe: Exception during lifecycle processing 
java.lang.IllegalArgumentException: Invalid URL Pattern: [{0}] 
at org.glassfish.web.deployment.node.WebResourceCollectionNode.setElementValue(WebResourceCollectionNode.java:136) 
at com.sun.enterprise.deployment.node.SaxParserHandler.endElement(SaxParserHandler.java:583) 
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609) 
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:863) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) 
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117) 
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) 
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) 
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) 
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) 
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) 
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649) 
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333) 
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:318) 
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:245) 
at com.sun.enterprise.deployment.archivist.Archivist.readStandardDeploymentDescriptor(Archivist.java:665) 
at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:391) 
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271) 
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280) 
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241) 
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161) 
at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:203) 
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:227) 
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:881) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:821) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:377) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) 
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535) 
at java.security.AccessController.doPrivileged(Native Method) 
at javax.security.auth.Subject.doAs(Subject.java:360) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557) 
at java.security.AccessController.doPrivileged(Native Method) 
at javax.security.auth.Subject.doAs(Subject.java:360) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722) 
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534) 
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224) 
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189) 
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) 
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) 
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) 
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) 
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) 
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) 
at java.lang.Thread.run(Thread.java:745) 

任何幫助,將不勝感激。

謝謝你, -Jarrod

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> 
<context-param> 
    <param-name>javax.faces.PROJECT_STAGE</param-name> 
    <param-value>Development</param-value> 
</context-param> 
<context-param> 
    <param-name>primefaces.THEME</param-name> 
    <param-value>trontastic</param-value> 
</context-param> 
<servlet> 
    <servlet-name>Faces Servlet</servlet-name> 
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>Faces Servlet</servlet-name> 
    <url-pattern>*.xhtml</url-pattern> 
</servlet-mapping> 
<error-page> 
    <exception-type>java.lang.SecurityException</exception-type> 
    <location>/login-error.xhtml</location> 
</error-page> 
<session-config> 
    <session-timeout> 
     30 
    </session-timeout> 
</session-config> 
<welcome-file-list> 
    <welcome-file>index.xhtml</welcome-file> 
</welcome-file-list> 
<error-page> 
    <error-code>401</error-code> 
    <location>/unauthorized-access.xhtml</location> 
</error-page> 
<error-page> 
    <error-code>403</error-code> 
    <location>/unauthorized-access.xhtml</location> 
</error-page> 
<error-page> 
    <error-code>404</error-code> 
    <location>/page-not-found.xhtml</location> 
</error-page> 
<security-constraint> 
    <display-name>Installations</display-name> 
    <web-resource-collection> 
     <web-resource-name>Installations</web-resource-name> 
     <url-pattern>/installations/*</url-pattern> 
    </web-resource-collection> 
    <web-resource-collection> 
     <web-resource-name>Resources</web-resource-name> 
     <url-pattern>/resources/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <description/> 
     <role-name>Installations</role-name> 
    </auth-constraint> 
</security-constraint> 
<security-constraint> 
    <display-name>Administrator</display-name> 
    <web-resource-collection> 
     <web-resource-name>Administrator</web-resource-name> 
     <url-pattern>/NCW-war/*</url-pattern> 
    </web-resource-collection> 
    <web-resource-collection> 
     <web-resource-name>Resources</web-resource-name> 
     <url-pattern>/resources/*</url-pattern> 
    </web-resource-collection> 
    <web-resource-collection> 
     <web-resource-name>Project Management</web-resource-name> 
     <url-pattern>project-management/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <description/> 
     <role-name>Administrator</role-name> 
    </auth-constraint> 
</security-constraint> 
<security-constraint> 
    <display-name>Analyst</display-name> 
    <web-resource-collection> 
     <web-resource-name>Analyst Pages</web-resource-name> 
     <url-pattern>/analyst/*</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>PUT</http-method> 
     <http-method>HEAD</http-method> 
     <http-method>POST</http-method> 
     <http-method>DELETE</http-method> 
    </web-resource-collection> 
    <web-resource-collection> 
     <web-resource-name>Resources</web-resource-name> 
     <url-pattern>/resources/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>Analyst</role-name> 
    </auth-constraint> 
</security-constraint> 
<security-constraint> 
    <display-name>WAN Analyst</display-name> 
    <web-resource-collection> 
     <web-resource-name>WAN Analyst Pages</web-resource-name> 
     <url-pattern>/analyst/wan/*</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>PUT</http-method> 
     <http-method>HEAD</http-method> 
     <http-method>POST</http-method> 
     <http-method>DELETE</http-method> 
    </web-resource-collection> 
    <web-resource-collection> 
     <web-resource-name>Resources</web-resource-name> 
     <url-pattern>/resources/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>WAN Analyst</role-name> 
    </auth-constraint> 
</security-constraint> 
<security-constraint> 
    <display-name>Voice Analyst</display-name> 
    <web-resource-collection> 
     <web-resource-name>Voice Analyst Pages</web-resource-name> 
     <url-pattern>/analyst/voice/*</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>PUT</http-method> 
     <http-method>HEAD</http-method> 
     <http-method>POST</http-method> 
     <http-method>DELETE</http-method> 
    </web-resource-collection> 
    <web-resource-collection> 
     <web-resource-name>Resources</web-resource-name> 
     <url-pattern>/resources/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>Voice Analyst</role-name> 
    </auth-constraint> 
</security-constraint> 
<security-constraint> 
    <display-name>Project Manager Pages</display-name> 
    <web-resource-collection> 
     <web-resource-name>Project Manager Pages</web-resource-name> 
     <url-pattern>/project-management/*</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>PUT</http-method> 
     <http-method>HEAD</http-method> 
     <http-method>POST</http-method> 
    </web-resource-collection> 
    <web-resource-collection> 
     <web-resource-name>Resources</web-resource-name> 
     <url-pattern>/resources/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <description/> 
     <role-name>Project Manager</role-name> 
    </auth-constraint> 
</security-constraint> 
<login-config> 
    <auth-method>FORM</auth-method> 
    <realm-name>LDAP</realm-name> 
    <form-login-config> 
     <form-login-page>/index.xhtml</form-login-page> 
     <form-error-page>/login-error.xhtml</form-error-page> 
    </form-login-config> 
</login-config> 
<security-role> 
    <role-name>Administrator</role-name> 
</security-role> 
<security-role> 
    <role-name>Installations</role-name> 
</security-role> 
<security-role> 
    <role-name>Analyst</role-name> 
</security-role> 
<security-role> 
    <role-name>WAN Analyst</role-name> 
</security-role> 
<security-role> 
    <role-name>Voice Analyst</role-name> 
</security-role> 
<security-role> 
    <role-name>Project Manager</role-name> 
</security-role> 

應該有在這個時候有沒有過濾器。

+0

你可以添加你'web.xml'內容的問題? – zaerymoghaddam 2014-11-14 19:41:02

+0

整個web.xml? – Dagnarus 2014-11-14 19:49:05

+0

我認爲首先要檢查的地方在那裏。如果您無法發佈其內容,請檢查其中的任何網址或映射地址。像歡迎頁面,servlet映射等 – zaerymoghaddam 2014-11-14 19:57:20

回答

4

名爲Administrator的網絡資源集合有一個<url-pattern>標記,表明它的內容沒有前導斜槓。這意味着,而不是/project-management/*它只是project-management/*。看來,一個網址模式已經開始了一個主要的斜線。除了Administrator之外,web.xml中的所有其他url模式都以/開頭。也許這是你問題的根源。但是我不確定這是Glassfish問題還是Java EE規範的一部分。

+0

這絕對有效。我必須查看grepcode堆棧跟蹤中的第一個類,並且如果缺少「setElementValue(XMLElement元素,String值)」方法,它應該預先加上「/」,但僅適用於Servlet 2.2 Web應用程序。這很奇怪,但是這個錯誤並沒有早日出現,因爲那個url模式已經在那裏呆了幾天了。感謝您的幫助。 – Dagnarus 2014-11-14 21:25:42

-1

**

<servlet-mapping> 
     <servlet-name>dispatcher</servlet-name> 
     <url-pattern>/</url-pattern> 
     <url-pattern>*.png</url-pattern> 
     <url-pattern>*.jpg</url-pattern> 
     <url-pattern>*.css</url-pattern> 
     <url-pattern>*.js</url-pattern> 
    </servlet-mapping> 
+2

爲什麼這是一個很好的答案或者它如何解決問題,添加一些更詳細的信息可能會有所幫助。這樣,遇到這個答案的其他人可以有更多的上下文,並可能upvote你的答案。 – greyseal96 2017-11-11 02:46:11