You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2017/07/27 08:43:00 UTC

[jira] [Commented] (KARAF-5054) Default rmiRegistryPort 1099 is used always besides different configuration

    [ https://issues.apache.org/jira/browse/KARAF-5054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16102939#comment-16102939 ] 

Jean-Baptiste Onofré commented on KARAF-5054:
---------------------------------------------

It sounds like a race condition where the configuration is loaded after the activator start. Let me try to reproduce.

> Default rmiRegistryPort 1099 is used always besides different configuration
> ---------------------------------------------------------------------------
>
>                 Key: KARAF-5054
>                 URL: https://issues.apache.org/jira/browse/KARAF-5054
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-management
>    Affects Versions: 4.1.0
>         Environment: Windows 7 64bit, karaf 4.1.0 binary distribution, java 1.8.0_121, clean start
>            Reporter: Jens Vagts
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 4.1.2
>
>
> 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}}:
> {noformat}
> 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
> {noformat}
> 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!
>  



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)