gpt4 book ai didi

java - Liberty 空指针异常

转载 作者:行者123 更新时间:2023-12-02 02:06:08 24 4
gpt4 key购买 nike

我使用了 open-liberty 19.0.0.6 。但是此应用程序服务器无法在 docker 容器上使用 ssl 端口 (https) 。

收到这个 nullPointerException :

java.lang.NullPointerException
at com.ibm.ws.http.channel.h2internal.hpack.H2HeaderTable.getHeaderEntry(H2HeaderTable.java:41)
at com.ibm.ws.http.channel.h2internal.hpack.H2Headers.encodeHeader(H2Headers.java:353)
at com.ibm.ws.http.channel.h2internal.hpack.H2Headers.encodeHeader(H2Headers.java:320)
at com.ibm.ws.http.channel.internal.HttpRequestMessageImpl.pushNewRequest(HttpRequestMessageImpl.java:2066)
at com.ibm.ws.http.dispatcher.internal.channel.HttpRequestImpl.pushNewRequest(HttpRequestImpl.java:214)
at com.ibm.ws.webcontainer40.srt.http.HttpPushBuilder.push(HttpPushBuilder.java:289)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.pushResource(ServletExternalContextImpl.java:434)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.encodeResourceURL(ServletExternalContextImpl.java:381)
at javax.faces.context.ExternalContextWrapper.encodeResourceURL(ExternalContextWrapper.java:110)
at org.apache.myfaces.renderkit.html.HtmlStylesheetRenderer.encodeEnd(HtmlStylesheetRenderer.java:232)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:675)
at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:555)
at org.primefaces.renderkit.HeadRenderer.encodeBegin(HeadRenderer.java:106)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:597)
at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:527)
at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:551)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1897)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:315)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:73)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:117)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:266)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:206)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1255)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:743)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:440)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:182)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:93)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:90)
at com.ibm.ws.security.jaspi.JaspiServletFilter.doFilter(JaspiServletFilter.java:56)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:90)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:996)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1134)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4975)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:314)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:279)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:1061)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:417)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:376)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:532)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:466)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:331)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:302)
at com.ibm.ws.http.channel.h2internal.H2StreamProcessor$Http2Ready.run(H2StreamProcessor.java:1597)
at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:239)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.lang.Thread.run(Thread.java:818)

这是我的 server.xml :

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<featureManager>
<feature>javaee-8.0</feature>
<feature>localConnector-1.0</feature>
<feature>appSecurity-3.0</feature>
</featureManager>
<library id="MySQLLib">
<fileset dir="${shared.resource.dir}/mysql" includes="*.jar" />
</library>
<dataSource jndiName="JTA-Connection" transactional="true">
<jdbcDriver libraryRef="MySQLLib" />
<properties databaseName="${database.name}"
serverName="${database.hostname}"
portNumber="${database.port}"
user="${database.username}"
password="${database.password}" />
</dataSource>
<basicRegistry id="basic" realm="BasicRealm" />
<httpSession securityIntegrationEnabled="false" />
<httpEndpoint id="defaultHttpEndpoint"
httpPort="8080"
httpsPort="9443"
host="0.0.0.0"
protocolVersion="http/2">
<httpOptions http2="enabled" />
</httpEndpoint>
<webContainer disableXPoweredBy="true" />
<applicationManager autoExpand="true" />
<applicationMonitor updateTrigger="mbean" />
<logging consoleLogLevel="ERROR" />
</server>

这是我的 bootstrap.properties 文件:

### Server Configuration ###
default.http.port=8080
default.https.port=9443
default.hostname=localhost

### Database Configuration ###
database.name=logmug
database.hostname=mysql.docker.io
database.port=3306
database.username=root
database.password=rootpass

注意:我的应用程序在http(端口80)连接上工作没有任何问题,只有https(端口443)有这个问题。
注意:这个问题仅在 docker 容器上解决,我在本地机器(容器外部)上测试我的应用程序,所有端口都工作没有任何问题。

这是应用服务器空指针异常

最佳答案

据我所知,出现此 NPE 是因为未设置任何值的 HTTP header 被传递到 PushBuilder。从堆栈来看,错误 header 似乎源自 Open Liberty 的 Servlet 4 实现。我已经打开了一个问题来跟踪此问题 - 您可以添加您的反馈吗? https://github.com/OpenLiberty/open-liberty/issues/8474

至于您的应用程序在本地运行的原因,我会检查以验证 HTTP/2 是否确实在使用中。如果您使用 Java 8,则需要特定环境才能通过 ALPN 通过 SSL 运行 HTTP/2 - 请参阅 https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/cwlp_alpnsupport.html

关于java - Liberty 空指针异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57356717/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com