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

Stephan Siano commented on ARIES-554:
-------------------------------------

I have looked into the OSGi enterprise spec (section 126.7.3 Caller's Bundle 
Context). That described how the context is to be looked up:
1. use the environment variable I added to my previous comment as the first 
workaround.
2. use the thread context class loader which will never work without the second 
workaround (set the context class loader to the bundle class loader) because 
the thread context class loaders in exuinox and felix do not implement the 
BundleReference interface.
3. Walk the call stack until the invoker is found. The invoker can be the 
caller of the InitialContext class constructor or the NamingManager or 
DirectoryManager getObjectInstance methods.
• Get the class loader of the caller and see if it, or an ancestor, implements 
the BundleReference interface.
• If a Class Loader implementing the BundleReference interface is found call 
the getBundle method to get the clients Bundle; then call the getBundleContext 
method on the Bundle to get the clients Bundle Context.
• If the Bundle Context has been found stop, else continue with the next stack 
frame.

In the current implementation only the first two bullet points are implemented, 
the third one is missing. I attached a patch to the trunk that also includes 
support for the third bullet point and then the example will work.

> aries JNDI bundle breaks remote JMX clients via RMI
> ---------------------------------------------------
>
>                 Key: ARIES-554
>                 URL: https://issues.apache.org/jira/browse/ARIES-554
>             Project: Aries
>          Issue Type: Bug
>          Components: JNDI
>    Affects Versions: 0.2, 0.3
>            Reporter: Stephan Siano
>         Attachments: Utils.java.patch
>
>
> If the aries JNDI bundles are present in the environment, connections to 
> remote JMX agents fail. I could recreate the issue with a bundle containing 
> only the line
> JMXConnectorFactory.connect(new 
> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1717/jmxrmi"));
> in the start() method of the bundle activator (and nothing else).
> The bundle will start both on equinox and felix as long as the aries jndi 
> bundles (I tried version 0.2 and 0.3-SNAPSHOT) are not running and any java 
> application that allows remote JMX at that port is running (check with 
> jconsole if you are unsure). It will not start as soon as the jndi bundle is 
> started. As far as I got in debugging this, the JMXConnectionFactory is 
> trying to do a JNDI lookup for the RMI connection and is delegated to the 
> Aries JNDI coding, that is trying to determine a bundle context for the call.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to