[ 
https://issues.apache.org/jira/browse/KARAF-7694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andre Flakowski updated KARAF-7694:
-----------------------------------
    Description: 
Generally environment variable usage as described 
[here|https://karaf.apache.org/manual/latest/#_environment_variables_system_properties]
 works, but it does not propagate back to the config admin system and therefore 
it seems that referencing the property in the same cfg file does not resolve to 
the overriden value:

Steps to reproduce:
 # Using clean Karaf 4.3.3 on Linux openjdk 17
 # export ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT=4242
 # bin/karaf

results in:
{code:java}
Unable to find source-code formatter for language: shell. Available languages 
are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, 
groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, 
php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, 
yamlkaraf: Enabling Java debug options: 
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
Listening for transport dt_socket at address: 5005
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:833)
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:834)
        at 
java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:481)
        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:163)
        at 
java.naming/com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:243)
        at java.naming/javax.naming.InitialContext.bind(InitialContext.java:417)
        at 
java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:693)
        at 
java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:476)
        ... 2 more
Caused by: java.rmi.NoSuchObjectException: no such object in table
        at 
java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:304)
        at 
java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:280)
        at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:381)
        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:157)
        ... 6 more
{code}
 

listing the config:
{code:java}
karaf@root()> cl org.apache.karaf.management
----------------------------------------------------------------
Pid:            org.apache.karaf.management
BundleLocation: ?
Properties:
   daemon = true
   felix.fileinstall.filename = 
file:/home/af/Desktop/apache-karaf-4.4.3/etc/org.apache.karaf.management.cfg
   jmxRealm = karaf
   jmxmpEnabled = false
   jmxmpHost = 127.0.0.1
   jmxmpObjectName = connector:name=jmxmp
   jmxmpPort = 9999
   jmxmpServiceUrl = service:jmx:jmxmp://127.0.0.1:9999
   objectName = connector:name=rmi
   rmiRegistryHost = 127.0.0.1
   rmiRegistryPort = 4242
   rmiServerHost = 127.0.0.1
   rmiServerPort = 44444
   service.pid = org.apache.karaf.management
   serviceUrl = 
service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root
   threaded = true{code}
rmiRegistryPort = 4242 is properly set.

serviceUrl = 
service:jmx:rmi://${rmiServerHost}:${rmiServerPort}/jndi/rmi://${rmiRegistryHost}:${rmiRegistryPort}/karaf-${karaf.name}

referencing rmiRegistryPort is still on 1099.

assumably this should fail on other indirect variable usages as well.

  was:
Generally environment variable usage as described 
[here|https://karaf.apache.org/manual/latest/#_environment_variables_system_properties]
 works, but it does not propagate back to the config admin system and therefore 
it seems that referencing the property in the same cfg file does not resolve to 
the overriden value:

Steps to reproduce:
 # Using clean Karaf 4.3.3 on Linux Java 17
 # export ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT=4242
 # bin/karaf

results in:
{code}
Unable to find source-code formatter for language: shell. Available languages 
are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, 
groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, 
php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, 
yamlkaraf: Enabling Java debug options: 
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
Listening for transport dt_socket at address: 5005
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:833)
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:834)
        at 
java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:481)
        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:163)
        at 
java.naming/com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:243)
        at java.naming/javax.naming.InitialContext.bind(InitialContext.java:417)
        at 
java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:693)
        at 
java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:476)
        ... 2 more
Caused by: java.rmi.NoSuchObjectException: no such object in table
        at 
java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:304)
        at 
java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:280)
        at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:381)
        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:157)
        ... 6 more
{code}
 

listing the config:
{code:java}
karaf@root()> cl org.apache.karaf.management
----------------------------------------------------------------
Pid:            org.apache.karaf.management
BundleLocation: ?
Properties:
   daemon = true
   felix.fileinstall.filename = 
file:/home/af/Desktop/apache-karaf-4.4.3/etc/org.apache.karaf.management.cfg
   jmxRealm = karaf
   jmxmpEnabled = false
   jmxmpHost = 127.0.0.1
   jmxmpObjectName = connector:name=jmxmp
   jmxmpPort = 9999
   jmxmpServiceUrl = service:jmx:jmxmp://127.0.0.1:9999
   objectName = connector:name=rmi
   rmiRegistryHost = 127.0.0.1
   rmiRegistryPort = 4242
   rmiServerHost = 127.0.0.1
   rmiServerPort = 44444
   service.pid = org.apache.karaf.management
   serviceUrl = 
service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root
   threaded = true{code}
rmiRegistryPort = 4242 is properly set.

serviceUrl = 
service:jmx:rmi://${rmiServerHost}:${rmiServerPort}/jndi/rmi://${rmiRegistryHost}:${rmiRegistryPort}/karaf-${karaf.name}

referencing rmiRegistryPort is still on 1099.

assumably this should fail on other indirect variable usages as well.


> Using system environment variables does not propagate to property usage in 
> same cfg file
> ----------------------------------------------------------------------------------------
>
>                 Key: KARAF-7694
>                 URL: https://issues.apache.org/jira/browse/KARAF-7694
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>    Affects Versions: 4.3.3
>         Environment: Karaf 4.3.3 on Linux openjdk-17
>            Reporter: Andre Flakowski
>            Priority: Major
>
> Generally environment variable usage as described 
> [here|https://karaf.apache.org/manual/latest/#_environment_variables_system_properties]
>  works, but it does not propagate back to the config admin system and 
> therefore it seems that referencing the property in the same cfg file does 
> not resolve to the overriden value:
> Steps to reproduce:
>  # Using clean Karaf 4.3.3 on Linux openjdk 17
>  # export ORG_APACHE_KARAF_MANAGEMENT_RMIREGISTRYPORT=4242
>  # bin/karaf
> results in:
> {code:java}
> Unable to find source-code formatter for language: shell. Available languages 
> are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, 
> groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, 
> perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, 
> yamlkaraf: Enabling Java debug options: 
> -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
> Listening for transport dt_socket at address: 5005
> 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:833)
> 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:834)
>       at 
> java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:481)
>       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:163)
>       at 
> java.naming/com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:243)
>       at java.naming/javax.naming.InitialContext.bind(InitialContext.java:417)
>       at 
> java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:693)
>       at 
> java.management.rmi/javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:476)
>       ... 2 more
> Caused by: java.rmi.NoSuchObjectException: no such object in table
>       at 
> java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:304)
>       at 
> java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:280)
>       at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:381)
>       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:157)
>       ... 6 more
> {code}
>  
> listing the config:
> {code:java}
> karaf@root()> cl org.apache.karaf.management
> ----------------------------------------------------------------
> Pid:            org.apache.karaf.management
> BundleLocation: ?
> Properties:
>    daemon = true
>    felix.fileinstall.filename = 
> file:/home/af/Desktop/apache-karaf-4.4.3/etc/org.apache.karaf.management.cfg
>    jmxRealm = karaf
>    jmxmpEnabled = false
>    jmxmpHost = 127.0.0.1
>    jmxmpObjectName = connector:name=jmxmp
>    jmxmpPort = 9999
>    jmxmpServiceUrl = service:jmx:jmxmp://127.0.0.1:9999
>    objectName = connector:name=rmi
>    rmiRegistryHost = 127.0.0.1
>    rmiRegistryPort = 4242
>    rmiServerHost = 127.0.0.1
>    rmiServerPort = 44444
>    service.pid = org.apache.karaf.management
>    serviceUrl = 
> service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root
>    threaded = true{code}
> rmiRegistryPort = 4242 is properly set.
> serviceUrl = 
> service:jmx:rmi://${rmiServerHost}:${rmiServerPort}/jndi/rmi://${rmiRegistryHost}:${rmiRegistryPort}/karaf-${karaf.name}
> referencing rmiRegistryPort is still on 1099.
> assumably this should fail on other indirect variable usages as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to