簡體   English   中英

web.xml中的JBoss 6.1.0 AS過濾器位置

[英]JBoss 6.1.0 AS filter position in web.xml

嘗試在JBoss 6.1.0中部署WAR時顯示以下錯誤

DEPLOYMENTS IN ERROR:
  Deployment
"vfs:///D:/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_AS_6.x1555321418499/deploy/MyProject.war" is in error due to the following reason(s): 

 org.jboss.xb.binding.JBossXBRuntimeException: filter cannot appear in this position. Expected content of web-app is unordered_sequence: error-page* welcome-file-list? servlet-mapping* login-config? mime-mapping* distributable? session-config? security-role* taglib* security-constraint* context-param* servlet* {all descriptionGroup}? {unordered_sequence jndiEnvironmentRefsGroup}?

以下是web.xml文件

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>false</param-value>
  </context-param>

 <filter>
    <filter-name>AuthenticationFilter</filter-name>
    <filter-class>mypackage.restauthentication.RestAuthenticationFilter</filter-class>
 </filter>
 <filter-mapping>
    <filter-name>AuthenticationFilter</filter-name>
    <url-pattern>/services/*</url-pattern>
 </filter-mapping>

 <servlet>
    <servlet-name>REST Service</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>

     <init-param>
      <param-name>jersey.config.server.provider.packages</param-name>
      <param-value>mypackage.restauthentication</param-value>
     </init-param>

   <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
   <servlet-name>REST Service</servlet-name>
   <url-pattern>/service/*</url-pattern>
 </servlet-mapping>
</web-app>

根據錯誤消息, <filter>被錯誤地放置在web.xml Web應用程序的預期內容是unordered_sequence:錯誤頁面*歡迎文件列表? servlet映射*登錄配置? 可分配的mime-mapping *? 會話配置? security-role * taglib * security-constraint * context-param * servlet * {all descriptionGroup}? {unordered_sequence jndiEnvironmentRefsGroup}?

正確的下單順序是什么? 這是一個Web存檔,它通過基本身份驗證部署Jersey REST Web服務。

嘗試這個 ..

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <context-param>
    <param-name>resteasy.scan</param-name>
    <param-value>false</param-value>
  </context-param>
  <servlet>
    <servlet-name>REST Service</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
     <init-param>
      <param-name>jersey.config.server.provider.packages</param-name>
      <param-value>mypackage.restauthentication</param-value>
     </init-param>
   <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
   <servlet-name>REST Service</servlet-name>
   <url-pattern>/service/*</url-pattern>
 </servlet-mapping>
 <filter>
    <filter-name>AuthenticationFilter</filter-name>
    <filter-class>mypackage.restauthentication.RestAuthenticationFilter</filter-class>
 </filter>
 <filter-mapping>
    <filter-name>AuthenticationFilter</filter-name>
    <url-pattern>/services/*</url-pattern>
 </filter-mapping>
</web-app>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM