I try for this,a new connector was made to try to support h2c,whent i try to use the curl send http2 request,An error occurred on the server; environment: springboot 2.1.4 tomcat 9 jdk 1.8
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addAdditionalTomcatConnectors(createH2cConnector());
tomcat.addConnectorCustomizers();
return tomcat;
}
private Connector createH2cConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
Http2Protocol upgradeProtocol = new Http2Protocol();
connector.addUpgradeProtocol(upgradeProtocol);
connector.setPort(5080);
return connector;
}
Error :
java.lang.NullPointerException: null
at org.apache.coyote.Request.doRead(Request.java:551)
at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:336)