Websphere Liberty中的Web.xml错误,而不是Tomcat中的错误

时间:2016-09-08 17:46:48

标签: websphere-liberty

我正在尝试在我的web.xml文件中添加此过滤器并在Liberty服务器上运行它。此配置在Tomcat上运行。但是在Liberty上我收到错误Exception thrown by application class 'java.lang.String.substring:1339'

Liberty有一些长度限制吗?

<filter>
     <filter-name>jersey</filter-name>
     <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
     <init-param>
       <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
       <param-value>/(flex|images|js|css|jsp)/.*</param-value>
     </init-param>
          <init-param>
       <param-name>com.sun.jersey.config.property.packages</param-name>
       <param-value>com.sun.jersey;com.netflix</param-value>
     </init-param>
  </filter>

堆栈追踪:

Exception thrown by application class 'java.lang.String.substring:1339'
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.substring(String.java:1339)
at com.sun.jersey.spi.container.ContainerRequest.getEncodedPath(ContainerRequest.java:377)
at com.sun.jersey.spi.container.ContainerRequest.getPath(ContainerRequest.java:370)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1463)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:895)
at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:843)
at com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:804)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
at [internal classes]
at com.netflix.eureka.ServerRequestAuthFilter.doFilter(ServerRequestAuthFilter.java:34)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
at [internal classes]
at com.netflix.eureka.StatusFilter.doFilter(StatusFilter.java:68)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
at [internal classes]

1 个答案:

答案 0 :(得分:1)

不清楚错误与web.xml中的值有关。从ContainerRequest.getPath API的读取,其中“获取当前请求相对于基本URI的路径作为字符串”,要查看的是请求URI以及在com.sun类中完成的处理,堆栈中列出的几个。由于API正在计算相对路径,因此有几种可能性表明:com.ibm Web容器请求处理代码提供的路径值不一致或不正确;提供给com.sun类的意外但有效的路径值;相对路径计算代码中的错误。我不确定你会如何得到这些,但起点是找出正在处理的两个URI:请求URI和基URI。