You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Andre Schlegel-Tylla (Jira)" <ji...@apache.org> on 2022/01/28 10:29:00 UTC

[jira] [Created] (KARAF-7362) Override of shellPort by environment variable sometime failed during clean start

Andre Schlegel-Tylla created KARAF-7362:
-------------------------------------------

             Summary: Override of shellPort by environment variable sometime failed during clean start
                 Key: KARAF-7362
                 URL: https://issues.apache.org/jira/browse/KARAF-7362
             Project: Karaf
          Issue Type: Bug
          Components: karaf
    Affects Versions: 4.3.6, 4.3.3
            Reporter: Andre Schlegel-Tylla


We are using environment variables to override the karaf ports ([https://karaf.apache.org/manual/latest/#_environment_variables_system_properties]). We have some tests where we make a fresh installation with some changed ports. In this case we have seen port conflicts with a parallel vanilla installation on the same machine (ssh port and http port). It seems that the override by the environment variables didn't work. After a restart of the installation all was fine.
 
I can reproduce the problem on my machine. With the current 4.3.6 vanilla release. Set these env vars:
 
 
{code:java}
export ORG_APACHE_KARAF_SHELL_SSHPORT=18101 export ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT=11099 export ORG_APACHE_KARAF_MANAGEMENT_RMISERVERPORT=14444 export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_PORT=18181 export ORG_OPS4J_PAX_WEB_ORG_OSGI_SERVICE_HTTP_PORT_SECURE=18282{code}
 
 
When I start the fresh karaf (bin/karaf) the ssh port is open on 8101 and not on 18101. When I stop the karaf and start again the ssh port is open on 18101.
 
I have repeated it again and got different results (now with deleting the whole karaf and unpack the vanilla tar.gz again).
 
I had used this:
 
export ORG_APACHE_KARAF_SHELL_SSHPORT=18101
tar -xzf apache-karaf-4.3.6.tar.gz
apache-karaf-4.3.6/bin/karaf
  * First time all went as expected; ports have been changed
 * Second time I got this:  

{code:java}
karaf-env-test tar -xzf apache-karaf-4.3.6.tar.gz
  karaf-env-test apache-karaf-4.3.6/bin/karaf
        __ __                  ____
       / //_/____ __________ _/ __/
      / ,<  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (4.3.6)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> Exception in thread "JMX Connector Thread [service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root]" java.lang.RuntimeException: Could not start JMX connector server
at org.apache.karaf.management.ConnectorServerFactory.lambda$init$0(ConnectorServerFactory.java:438)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: Cannot bind to URL [rmi://127.0.0.1:1099/karaf-root]: javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]
at java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:854)
at java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:501)
at org.apache.karaf.management.ConnectorServerFactory.lambda$init$0(ConnectorServerFactory.java:421)
... 1 more
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]
at jdk.naming.rmi/com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:162)
at java.naming/com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:230)
at java.naming/javax.naming.InitialContext.bind(InitialContext.java:417)
at java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:713)
at java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:496)
... 2 more
Caused by: java.rmi.NoSuchObjectException: no such object in table
at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303)
at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279)
at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:380)
at java.rmi/sun.rmi.registry.RegistryImpl_Stub.bind(RegistryImpl_Stub.java:73)
at jdk.naming.rmi/com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:156)
... 6 more{code}
  * Third time there was no JMX error, ssh port was open on 8101 not on 18101 as expected. And the config result is this:

{code:java}
karaf@root()> config:list | grep Port
   jmxmpPort = 9999
   rmiRegistryPort = 11099
   rmiServerPort = 14444
   sshPort = 18101{code}
 
It seems to me that there are some timing issues.
 
On our test installation which is done by a script in Jenkins we always got the problem with the httpPort and sometimes also with the sshPort.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)