Tomee Maven plugin deploys correctly in run mode but fails to connect to port 8080 in debug mode

91 Views Asked by At

I am using Tomee Maven plugin in NetBeans 11.3 to deploy a war project on localhost. The pom configuration is as follows:

<plugin>               
                <groupId>org.apache.tomee.maven</groupId>
                <artifactId>tomee-maven-plugin</artifactId>
                <version>7.1.4</version>
                <configuration>
                    <tomeeVersion>7.1.4</tomeeVersion>               
                    <tomeeClassifier>plume</tomeeClassifier>
                    <args>-Dfile.encoding=UTF8</args> 
                    <debug>false</debug>
                    <debugPort>5005</debugPort>
                    <args>-Dfoo=bar</args>
                    <args>-Dopenejb.system.apps=true</args>
                    <config>${project.basedir}/src/test/tomee/conf</config>
                    <libs>
                        <lib>com.oracle.database.jdbc:ojdbc6:11.2.0.4</lib>
                    </libs>
                    <webapps>
                    </webapps>
                </configuration>
            </plugin> 

When I run the goal "tomee:run", the application deploys normally with the stack:

TomEE was unzipped in 'C:\Users\...\target\apache-tomee'
Override 'conf/server.xml'
Override 'conf/tomee.xml'
Removed not mandatory default webapps
Copied 'com.oracle.database.jdbc:ojdbc6:11.2.0.4' in 'C:\Users\...\target\apache-tomee\lib\ojdbc6-11.2.0.4.jar
Installed 'C:\Users\...war' in C:\Users\...war
TomEE will run in development mode
Running 'org.apache.openejb.maven.plugin.run'. Configured TomEE in plugin is localhost:8080 (plugin shutdown port is 8053 and https port is null)
15-Aug-2023 10:51:07.400 INFO [main] org.apache.openejb.persistence.PersistenceBootstrap.getDefaultProvider Default JPA Provider changed to org.eclipse.persistence.jpa.PersistenceProvider specified by jar:file:/C:/Users/.../target/apache-tomee/lib/openejb-core-eclipselink-7.1.4.jar!/META-INF/org.apache.openejb.persistence.PersistenceBootstrap.provider
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server version name:   Apache Tomcat (TomEE)/8.5.57 (7.1.4)
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server built:          Jun 30 2020 21:49:10 UTC
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Server version number: 8.5.57.0
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke OS Name:               Windows 10
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke OS Version:            10.0
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Architecture:          amd64
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Java Home:             C:\Program Files\Java\jdk1.8.0_181\jre
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke JVM Version:           1.8.0_181-b13
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke JVM Vendor:            Oracle Corporation
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke CATALINA_BASE:         C:\Users\...\target\apache-tomee
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke CATALINA_HOME:         C:\Users\...\target\apache-tomee
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Command line argument: -XX:+HeapDumpOnOutOfMemoryError
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Command line argument: -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Command line argument: -Dopenejb.session.manager=org.apache.tomee.catalina.session.QuickSessionManager
15-Aug-2023 10:51:08.134 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Command line argument: -Dtomee.remote.support=true
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.NativeMethodAccessorImpl.invoke Command line argument: -Dopenejb.system.apps=true
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dtomee.jsp-development=true
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Djava.util.logging.config.file=C:\Users\...\target\apache-tomee\conf\logging.properties
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -javaagent:C:\Users\...\target\apache-tomee\lib\openejb-javaagent.jar
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Djava.io.tmpdir=C:\Users\...\target\apache-tomee\temp
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dcatalina.base=C:\Users\...\target\apache-tomee
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dcatalina.home=C:\Users\...\target\apache-tomee
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dcatalina.ext.dirs=C:\Users\...\target\apache-tomee\lib
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0=true
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -ea
15-Aug-2023 10:51:08.149 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_181\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\dotnet\;C;C:\Users\...\AppData\Local\Microsoft\WindowsApps;C:\Users\...\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\...\.dotnet\tools;C:\Program Files\Graphviz\bin;C:\Users\...\TortoiseSVN\bin;;.]
15-Aug-2023 10:51:10.262 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Initializing ProtocolHandler ["http-nio-8080"]
15-Aug-2023 10:51:10.563 INFO [main] sun.reflect.DelegatingMethodAccessorImpl.invoke Using a shared selector for servlet write/read

But when I run the goal tomee:debug with properties jpda.listen=maven, with the "Recursive (with Modules)" box checked and others left unchecked, the stack deviates after "Running 'org.apache.openejb.maven.plugin.debug' and fails with "[] CONNECT ATTEMPT -2147483587 on port: 8080":

Running 'org.apache.openejb.maven.plugin.debug'. Configured TomEE in plugin is localhost:8080 (plugin shutdown port is 8053 and https port is null)
[] START SERVER
OPENEJB_HOME = C:\Users\...\target\apache-tomee
SYSTEM_INFO  = Java 1.8.0_181; Windows 10/10.0
C:\Program Files\Java\jdk1.8.0_181\jre\bin\java
-XX:+HeapDumpOnOutOfMemoryError
-Xdebug
-Xnoagent
-Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false
-Dopenejb.session.manager=org.apache.tomee.catalina.session.QuickSessionManager
-Dtomee.remote.support=true
-Dopenejb.system.apps=true
-Dtomee.jsp-development=true
-Djava.util.logging.config.file=C:\Users\...\target\apache-tomee\conf\logging.properties
-javaagent:C:\Users\...\target\apache-tomee\lib\openejb-javaagent.jar
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.io.tmpdir=C:\Users\...\target\apache-tomee\temp
-Dcatalina.base=C:\Users\...\target\apache-tomee
-Dcatalina.home=C:\Users\...\target\apache-tomee
-Dcatalina.ext.dirs=C:\Users\...\target\apache-tomee\lib
-Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0=true
-ea
-classpath
C:\Users\...\target\apache-tomee\bin\bootstrap.jar;C:\Users\...\target\apache-tomee\bin\tomcat-juli.jar
org.apache.catalina.startup.Bootstrap
start
[] CONNECT ATTEMPT -2147483587 on port: 8080
Listening for transport dt_socket at address: 5005

The debugger console additionally displays these messages:

Listening on 56847 User program running

The nbactions.xml looks like this:

<actions>
        <action>
            <actionName>CUSTOM-RUN</actionName>
            <displayName>RUN</displayName>
            <goals>
                <goal>tomee:run</goal>
            </goals>
        </action>
        
        <action>
            <actionName>CUSTOM-Debug</actionName>
            <displayName>Debug</displayName>
            <goals>
                <goal>tomee:debug</goal>
            </goals>
            <properties>
                <jpda.listen>maven</jpda.listen>
            </properties>
        </action>
    </actions>

The server.xml file only defines a single connector port:

<Server port="8053" shutdown="SHUTDOWN">
  <!-- TomEE plugin for Tomcat -->
  <Listener className="org.apache.tomee.catalina.ServerListener" />
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" xpoweredBy="false" server="Apache TomEE" />

The tomee.xml:

<tomee>
  <!-- see http://tomee.apache.org/containers-and-resources.html -->

  <!-- activate next line to be able to deploy applications in apps -->
  <!-- <Deployments dir="apps" /> -->
  <Resource id="db-dls" type="DataSource">
  jdbcDriver          oracle.jdbc.OracleDriver
  jdbcUrl             jdbc:oracle:thin:...
  userName            ...
  password            ...
  jtaManaged          true
  defaultAutoCommit   false
  
  testWhileIdle=true
  testOnBorrow=true
  testOnReturn=true
  validationQuery=SELECT 1 FROM DUAL
  validationInterval=5
  initialSize=1
  maxActive=20
  maxIdle=20

  
  closeMethod="close"

  </Resource>
  
</tomee>

Any idea what is preventing the connection to port 8080 in debugging mode?

I tried changing the port numbers for both the connector and the debugging port but to no avail.

0

There are 0 best solutions below