0

我正在使用 WebSphere 9.0.5.8,并且正在尝试部署一个使用 Crnk 框架和版本 3.4 的 JEE 应用程序。部署很好,但是当发出请求时,看起来 init() 方法被调用了两次,导致 SRVE0271E 错误。在堆栈跟踪下方。第一个(由我转储)初始化 servlet 没有错误,第二个,其中 init() 方法由 ServletWrapper 调用。另一件事是,在 Tomcat 上,一切都像魅力一样。

[26.08.21 09:21:12:280 CEST] 00000136 SystemOut     O 2021-08-26 09:21:12,279 ERROR [WebContainer : 1] (SimpleCrnkServlet.java:29) - ****.SimpleCrnkServlet.init(SimpleCrnkServlet.java:28)
javax.servlet.GenericServlet.init(GenericServlet.java:244)
com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342)
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:169)
com.ibm.ws.webcontainer.servlet.ServletWrapper.load(ServletWrapper.java:1385)
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1039)
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4219)
com.ibm.ws.webcontainer.webapp.WebAppImpl.handleRequest(WebAppImpl.java:2210)
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1030)
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:382)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:532)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:318)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:289)
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1909)

第二个电话:

[26.08.21 09:21:12:949 CEST] 00000136 SystemOut     O 2021-08-26 09:21:12,949 ERROR [WebContainer : 1] (SimpleCrnkServlet.java:29) - *****.SimpleCrnkServlet.init(SimpleCrnkServlet.java:28)
javax.servlet.GenericServlet.init(GenericServlet.java:244)
com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342)
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:169)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:634)
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:143)
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:96)
ch.nevis.ninja.filter.NinjaAuthenticationFilter$PriviledgedChainForwarder.run(NinjaAuthenticationFilter.java:107)
java.security.AccessController.doPrivileged(AccessController.java:708)
javax.security.auth.Subject.doAs(Subject.java:490)
ch.nevis.ninja.filter.NinjaAuthenticationFilter.injectPrincipal(NinjaAuthenticationFilter.java:386)
ch.nevis.ninja.filter.NinjaAuthenticationFilter.doFilter(NinjaAuthenticationFilter.java:222)
******.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:125)
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:197)
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:90)
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:979)
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1119)
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4219)
com.ibm.ws.webcontainer.webapp.WebAppImpl.handleRequest(WebAppImpl.java:2210)
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1030)
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:382)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:532)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:318)
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:289)
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1909)

也许 WAS 配置中有一些东西可以阻止调用 Servlet.init() 两次?

4

1 回答 1

0

servlet init() 区域中没有配置。每个 servlet 包装器都有一个跟踪其初始化的内部标志。

您的 servlet 是否<load-on-startup>设置为正整数?如果是这样,加载应该是在应用程序启动期间;否则它应该在请求时间。

也许设置跟踪

=info:com.ibm.ws.webcontainer =all:com.ibm.wsspi.webcontainer*=all:HTTPChannel=all:GenericBNF=all

它将提供更多信息。

于 2021-08-30T15:05:37.903 回答