zengkid / SmartTomcat

The Tomcat plugin for Intellij IDEA
Apache License 2.0
125 stars 56 forks source link

java.lang.NullPointerException: Cannot invoke "org.w3c.dom.Element.setAttribute(String, String)" because "portE" is null #103

Closed mumaxiaozi closed 1 year ago

mumaxiaozi commented 1 year ago

Describe the bug A clear and concise description of what the bug is. when i use idea ce 2023.1 or 2022.3.3 , and run the webapp with Smart Tomcat 4.5. there is some error:java.lang.NullPointerException: Cannot invoke "org.w3c.dom.Element.setAttribute(String, String)" because "portE" is null

Screenshots If applicable, add screenshots to help explain your problem.

image image image

Intellij & SmartTomcat Version (Help -> About copy & paste below) Intellij: IntelliJ IDEA 2023.1 (Community Edition) Build #IC-231.8109.175, built on March 28, 2023 Runtime version: 17.0.6+10-b829.5 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.4 GC: G1 Young Generation, G1 Old Generation Memory: 1024M Cores: 4 Metal Rendering is ON Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true

Non-Bundled Plugins: de.netnexus.camelcaseplugin (3.0.12) VisualVMLauncher (1.21.211.6085.0) com.poratu.idea.plugins.tomcat (4.5.0) com.nnthink.aixcoder (4.1.17-2020) ru.artyushov (1.3.0) dev.flikas.idea.spring.boot.assistant.plugin (222.17.2) com.github.beansoft.devkit.helper (2.2) com.baomidou.plugin.idea.mybatisx (1.5.5) JProfiler (19.9) MavenRunHelper (4.23.222.2964.0)

Kotlin: 231-1.8.20-IJ8109.175 SmartTomcat: 4.5.0

yuezk commented 1 year ago

I'm using Tomcat 9.x and it works fine with the latest IDEA (2023.1). It could be a problem with Tomcat 8.5.x, will check it.

mumaxiaozi commented 1 year ago

I'm using Tomcat 9.x and it works fine with the latest IDEA (2023.1). It could be a problem with Tomcat 8.5.x, will check it.

Yes, it worked when i use Tomcat 8.5.87 or Tomcat 9.x. It's possible that there could be a bug with Tomcat 8.5.35 . Thanks.

yuezk commented 1 year ago

@mumaxiaozi You could check the conf/server.xml of the Tomcat 8.5.35, to see if the following element existing.

<Server>
   <Service name='Catalina'>
     <Connector protocol='HTTP/1.1'>
mumaxiaozi commented 1 year ago

@mumaxiaozi You could check the conf/server.xml of the Tomcat 8.5.35, to see if the following element existing.

<Server>
   <Service name='Catalina'>
     <Connector protocol='HTTP/1.1'>

Oh my god , the server.xml existing this configuration.

    <Connector port="8080" protocol="org.apache.coyote.http11.Http11AprProtocol"
               connectionTimeout="20000"
               redirectPort="8443"
           acceptCount="2000" />

It worked when I modify this config like this.

     <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
           acceptCount="2000" />    

Thanks a million.