<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Consolas}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
span.E-MailFormatvorlage17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
.MsoChpDefault
        {}
@page WordSection1
        {margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi all,</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span lang="EN-US">we face the following problem: </span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">We would like to be able to trigger a chain of events, say by JMX-Bean in on OSGi bundle [A].
</span></p>
<p class="MsoNormal"><span lang="EN-US">[A] then calls up an OSGi Service/Class located in bundle [B] using an interface exported by [B].
</span></p>
<p class="MsoNormal"><span lang="EN-US">Now [B] tries to make a remote EJB lookup into an ear [C] on an interface it imported from another OSGi Bundle [D].</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">This fails with the following stacktrace:</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,245 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110) javax.naming.NamingException: Could not load ejb proxy class steffen.experimental.remote.ejb.RemoteCalculator [Root exception is java.lang.ClassNotFoundException:
 steffen.experimental.remote.ejb.RemoteCalculator from [Module &quot;deployment.steffen.experimental.ejb-remote.twice-removed:0.0.1.SNAPSHOT&quot; from Service Module Loader]]</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,245 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:108)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,246 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:96)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,246 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:76)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,246 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:100)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,246 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:213)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,246 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,246 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at steffen.experimental.client.jmx.service.LookupImpl.internal_InitialContextService(LookupImpl.java:63)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,247 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at steffen.experimental.client.jmx.service.TriggerLookup.doAddition_InitialContextService(TriggerLookup.java:85)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,247 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at steffen.experimental.indirect.jmx.ServiceCallerWrapper.doAddition_InitialContextService(ServiceCallerWrapper.java:30)</span></p>
<p class="MsoNormal"><span lang="EN-US">[Server:server-one] 15:46:32,247 ERROR [stderr] (RMI TCP Connection(4)-10.0.103.110)&nbsp;&nbsp;&nbsp; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">Where &#8220;twice-removed&#8221; is [A] and the class TriggerLookup does reside in [B].
</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">(We have aries.jndi running in our jboss, but the behavior described here occurs also without aries.jndi &#8211; in fact we had hoped that would solve our problems)</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">It is important to note, that the same code in [B] works alright, when the initiating JMX Bean resides in [B] instead of [A], because in this case the TCCL is bundle classloader of bundle [B], whereas in the other case
 it is the bundle classloader of [A] which of course has not knowledge of the interface class.</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">Furthermore it is important to note that this behavior occurs even though the flow of control from [A] to [B] is done using:
</span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">private</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> TriggerLookupMBean getService(){</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="background:silver">ServiceReference</span> sRef = TwiceRemovedActivator.<i>getBundleContext</i>().getServiceReference(TriggerLookupMBean.</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">class</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.getName());</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">if</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">( sRef !=
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">null</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> ){</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">return</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> (TriggerLookupMBean) TwiceRemovedActivator.<i>getBundleContext</i>().getService(sRef);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">else</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> {</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">throw</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">new</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> IllegalStateException(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;Service
 TriggerLookupMBean was not found!&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp; }</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">public</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> String doAddition_InitialContextService()</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp; {</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">return</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> getService().doAddition_InitialContextService();</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;
</span><span style="font-size:10.0pt; font-family:Consolas; color:black">}</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">So that the OSGi framework would have a chance to change the TCCL using an interceptor hooked into the service which is returned by getService.</span></p>
<p class="MsoNormal"><span lang="EN-US">But from what I see simply an instance of the implementation class from bundle [B] is returned.</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">Am I doing something wrong here? Having aries.jndi installed, I can do a successful JNDI lookup for an OSGi Service regardless of the Bundle initiating the flow of control, while the same lookup, when done with a &#8220;ejb:&#8221;
 prefix fails.</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">This works:</span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AnOSGiService otherSvc =
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">null</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceReference sRef = Activator.<i>getBundleContext</i>()</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getServiceReference(JNDIContextManager.</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">class</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.getName());</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">if</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> (sRef !=
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">null</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">)</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;{</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JNDIContextManager contextMgr = (JNDIContextManager) Activator.<i>getBundleContext</i>().getService(sRef);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">try</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Properties props =
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">new</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> Properties();</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; props.put(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;osgi.service.jndi.bundleContext&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">,
 Activator.<i>getBundleContext</i>());</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context ctx = contextMgr.newInitialContext(props);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#0000C0">out</span></i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.println(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;doing
 JNDI lookup&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; otherSvc = (AnOSGiService) ctx.lookup(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;osgi:service/&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">
 &#43; AnOSGiService.</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">class</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.getName());</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#0000C0">out</span></i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.println(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;lookup
 succeeded, calling service&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">return</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">
</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;result:&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> &#43; otherSvc.foo();</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">This fails:</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RemoteCalculator
<u>calc</u> = </span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">null</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceReference sRef = Activator.<i>getBundleContext</i>()</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getServiceReference(JNDIContextManager.</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">class</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.getName());</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">if</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> (sRef !=
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">null</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">)</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JNDIContextManager contextMgr = (JNDIContextManager) Activator.<i>getBundleContext</i>().getService(sRef);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">try</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Properties props =
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">new</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> Properties();</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; props.put(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;osgi.service.jndi.bundleContext&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">,
 Activator.<i>getBundleContext</i>());</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; props.put(Context.</span><i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#0000C0">URL_PKG_PREFIXES</span></i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">,
</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;org.jboss.ejb.client.naming&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context ctx = contextMgr.newInitialContext(props);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#0000C0">out</span></i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.println(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;doing
 lookup&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; calc = (RemoteCalculator)ctx.lookup(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;ejb:application-ear-0.0.1-SNAPSHOT/ejb-definition-0.0.1-SNAPSHOT//CalculatorBean!steffen.experimental.remote.ejb.RemoteCalculator&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#0000C0">out</span></i><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">.println(</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;lookup
 succeeded, calling remote bean&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#7F0055">return</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">
</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:#2A00FF">&quot;result:&quot;</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black"> &#43; calc.add(1, 1);</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span lang="EN-US" style="font-size:10.0pt; font-family:Consolas"></span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">As I mentioned before when called from a JMX-Bean in the same bundle both work!</span></p>
<p class="MsoNormal"><span lang="EN-US">What am I missing? </span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">Our current workaround is an aspect that changes the TCCL in exported public methods if required &#8211; but I believe this should not be necessary.</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for your patience reading this!</span></p>
<p class="MsoNormal"><span lang="EN-US">Sincerely</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">Steffen</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
</div>
<font size="1" face="Arial" color="#808080"></font><br>
<br>
<br>
...<br>
<br>
<table border="0" width="100%" id="table1" style="border-collapse:collapse">
<tbody>
<tr>
<td width="272" style="border-bottom-style:double; border-bottom-width:3px">&nbsp;</td>
<td width="45" style="border-bottom-style:double; border-bottom-width:3px">&nbsp;</td>
<td style="border-bottom-style:double; border-bottom-width:3px">&nbsp;</td>
</tr>
</tbody>
</table>
<br>
<br>
<table border="0" width="100%" id="table1" style="border-collapse:collapse">
<tbody>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080"><b>SEEBURGER AG</b></font></td>
<td width="45">&nbsp;</td>
<td><font size="1" face="Arial" color="#808080">Vorstand/Seeburger Executive Board:</font></td>
</tr>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080">Sitz der Gesellschaft/Registered Office:</font></td>
<td width="45">&nbsp;</td>
<td><font size="1" face="Arial" color="#808080">Bernd Seeburger, Axel Haas, Michael Kleeberg</font></td>
</tr>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080">Edisonstr. 1</font></td>
<td width="45">&nbsp;</td>
<td><font size="1" face="Arial" color="#808080"></font></td>
</tr>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080">D-75015 Bretten</font></td>
<td width="45"><font size="1" face="Arial" color="#808080"></font></td>
<td><font size="1" face="Arial" color="#808080">Vorsitzender des Aufsichtsrats/Chairperson of the Seeburger Supervisory Board:</font></td>
</tr>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080">Tel.: 07252 / 96 - 0</font></td>
<td width="45"><font size="1" face="Arial" color="#808080"></font></td>
<td><font size="1" face="Arial" color="#808080">Dr. Franz Scherer</font></td>
</tr>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080">Fax: 07252 / 96 - 2222</font></td>
<td width="45"><font size="1" face="Arial" color="#808080"></font></td>
<td><font size="1" face="Arial" color="#808080"></font></td>
</tr>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080">Internet: http://www.seeburger.de</font></td>
<td width="45"><font size="1" face="Arial" color="#808080"></font></td>
<td><font size="1" face="Arial" color="#808080">Registergericht/Commercial Register:</font></td>
</tr>
<tr>
<td width="272"><font size="1" face="Arial" color="#808080">e-mail: info@seeburger.de</font></td>
<td width="45"><font size="1" face="Arial" color="#808080"></font></td>
<td><font size="1" face="Arial" color="#808080">HRB 240708 Mannheim</font></td>
</tr>
</tbody>
</table>
<p><font size="2" face="Arial"><br>
</font></p>
<p align="justify"><font size="1" face="Arial" color="#808080">Dieses E-Mail ist nur f&uuml;r den Empf&auml;nger bestimmt, an den es gerichtet ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht oder
 Meinungs&auml;u&szlig;erung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung der SEEBURGER AG dar. Sind Sie nicht der Empf&auml;nger, so haben Sie diese E-Mail irrt&uuml;mlich erhalten und jegliche Verwendung, Ver&ouml;ffentlichung, Weiterleitung, Abschrift
 oder jeglicher Druck dieser E-Mail ist strengstens untersagt. Weder die SEEBURGER AG noch der Absender ( Wollscheid. Steffen ) &uuml;bernehmen die Haftung f&uuml;r Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren Anh&auml;nge auf Viren zu pr&uuml;fen.
<br>
<br>
</p>
<p align="justify"><font size="1" face="Arial" color="#808080">The present email addresses only the addressee which it targets and may contain confidential material that may be protected by the professional secret. The opinions reflected herein are not necessarily
 the one of the SEEBURGER AG. If you are not the addressee, you have accidentally got this email and are not enabled to use, publish, forward, copy or print it in any way. Neither SEEBURGER AG , nor the sender (Wollscheid. Steffen) are liable for viruses, being
 your own responsibility to check this email and its attachments for this purpose.
<br>
<br>
</font></p>
</font>
</body>
</html>