Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-5054

Default rmiRegistryPort 1099 is used always besides different configuration

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.1.0
    • Fix Version/s: None
    • Component/s: karaf
    • Labels:
      None
    • Environment:

      Windows 7 64bit, karaf 4.1.0 binary distribution, java 1.8.0_121, clean start

      Description

      When starting a clean karaf instance (either very first first start or with clean command line parameter) the karaf management feature always tries to open the default port 1099 before opening the configured port resulting in a confusing exception in the karaf.log:

      2017-03-22T08:08:51,523 | WARN  | pool-23-thread-1 | Activator                        | 38 - org.apache.karaf.management.server - 4.1.0 | Error starting activator
      java.rmi.server.ExportException: Port already in use: 1099; nested exception is: 
      	java.net.BindException: Address already in use: JVM_Bind
      	at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:341) [?:?]
      	at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:249) [?:?]
      	at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:411) [?:?]
      	at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147) [?:?]
      	at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:234) [?:?]
      	at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:195) [?:?]
      	at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:180) [?:?]
      	at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:203) [?:?]
      	at org.apache.karaf.management.RmiRegistryFactory.init(RmiRegistryFactory.java:128) [38:org.apache.karaf.management.server:4.1.0]
      	at org.apache.karaf.management.internal.Activator.doStart(Activator.java:104) [38:org.apache.karaf.management.server:4.1.0]
      	at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:242) [38:org.apache.karaf.management.server:4.1.0]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
      	at java.lang.Thread.run(Thread.java:745) [?:?]
      Caused by: java.net.BindException: Address already in use: JVM_Bind
      	at java.net.DualStackPlainSocketImpl.bind0(Native Method) ~[?:?]
      	at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106) ~[?:?]
      	at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) ~[?:?]
      	at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190) ~[?:?]
      	at java.net.ServerSocket.bind(ServerSocket.java:375) ~[?:?]
      	at java.net.ServerSocket.<init>(ServerSocket.java:237) ~[?:?]
      	at java.net.ServerSocket.<init>(ServerSocket.java:128) ~[?:?]
      	at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:45) ~[?:?]
      	at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:345) ~[?:?]
      	at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:666) ~[?:?]
      	at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:330) ~[?:?]
      	... 15 more
      

      if the port is already used by another process (e.g. another karaf instance).

      The configured port rmiRegistryPort = 1100 in the config file org.apache.karaf.management.cfg will be nevertheless applied afterwards.
      This can easily reproduced by creating two instances of the standard karaf 4.1.0 binary distributions and applying above configuration to the second instance.

      This occurs on Windows (7 64 bit tested) only, and can not be reproduced on Linux OS!
      The same behavior (of using the default port before the differently configured one) has been observed for other ports as of: rmi server port (rmiServerPort in org.apache.karaf.management.cfg) and ssh (sshPort in org.apache.karaf.shell.cfg. Depending on the logging configuration the failing usage of the default ports can be seen before the configured ports are taken into account.
      Re-configuring the ports at runtime via the configuration properties works fine!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jbonofre Jean-Baptiste Onofré
                Reporter:
                vagtsi Jens Vagts
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: