<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Please take this to the <a
        href="https://community.jboss.org/community/jbossosgi?view=discussions">jbosgi
        user forum</a><br>
      <br>
      -thomas<br>
    </tt><br>
    On 03/09/2012 05:19 PM, Wollscheid. Steffen wrote:
    <blockquote
cite="mid:B3374F15414C7045990D8918E117147B2256DB26@dedcexch02.seeburger.de"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <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>
      <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
            "deployment.steffen.experimental.ejb-remote.twice-removed:0.0.1.SNAPSHOT"
            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
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;</span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">private</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> TriggerLookupMBean getService(){</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <span style="background:silver">ServiceReference</span> sRef
            = TwiceRemovedActivator.<i>getBundleContext</i>().getServiceReference(TriggerLookupMBean.</span><b><span
              style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">class</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.getName());</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">if</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">( sRef !=
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">null</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> ){</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">return</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> (TriggerLookupMBean) TwiceRemovedActivator.<i>getBundleContext</i>().getService(sRef);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">else</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> {</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">throw</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">new</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> IllegalStateException(</span><span
            style="font-size:10.0pt; font-family:Consolas;
            color:#2A00FF" lang="EN-US">"Service TriggerLookupMBean was
            not found!"</span><span style="font-size:10.0pt;
            font-family:Consolas; color:black" lang="EN-US">);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp; }</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US">&nbsp;</span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">public</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> String doAddition_InitialContextService()</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp; {</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">return</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">
            getService().doAddition_InitialContextService();</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal"><span style="font-size:10.0pt;
            font-family:Consolas; color:black" lang="EN-US">&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
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AnOSGiService otherSvc =
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">null</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">;</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceReference sRef = Activator.<i>getBundleContext</i>()</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&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
              style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">class</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.getName());</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">if</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> (sRef !=
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">null</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">)</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;{</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JNDIContextManager contextMgr =
            (JNDIContextManager) Activator.<i>getBundleContext</i>().getService(sRef);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US">&nbsp;</span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">try</span></b><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Properties props =
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">new</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> Properties();</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; props.put(</span><span
            style="font-size:10.0pt; font-family:Consolas;
            color:#2A00FF" lang="EN-US">"osgi.service.jndi.bundleContext"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">, Activator.<i>getBundleContext</i>());</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context ctx =
            contextMgr.newInitialContext(props);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span
              style="font-size:10.0pt; font-family:Consolas;
              color:#0000C0" lang="EN-US">out</span></i><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.println(</span><span style="font-size:10.0pt;
            font-family:Consolas; color:#2A00FF" lang="EN-US">"doing
            JNDI lookup"</span><span style="font-size:10.0pt;
            font-family:Consolas; color:black" lang="EN-US">);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; otherSvc = (AnOSGiService)
            ctx.lookup(</span><span style="font-size:10.0pt;
            font-family:Consolas; color:#2A00FF" lang="EN-US">"osgi:service/"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> + AnOSGiService.</span><b><span
              style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">class</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.getName());</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span
              style="font-size:10.0pt; font-family:Consolas;
              color:#0000C0" lang="EN-US">out</span></i><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.println(</span><span style="font-size:10.0pt;
            font-family:Consolas; color:#2A00FF" lang="EN-US">"lookup
            succeeded, calling service"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">);</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">return</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">
          </span><span style="font-size:10.0pt; font-family:Consolas;
            color:#2A00FF" lang="EN-US">"result:"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> + otherSvc.foo();</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></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
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RemoteCalculator
            <u>calc</u> = </span><b><span style="font-size:10.0pt;
              font-family:Consolas; color:#7F0055" lang="EN-US">null</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">;</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceReference sRef = Activator.<i>getBundleContext</i>()</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&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
              style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">class</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.getName());</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">if</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> (sRef !=
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">null</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">)</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JNDIContextManager contextMgr =
            (JNDIContextManager) Activator.<i>getBundleContext</i>().getService(sRef);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US">&nbsp;</span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">try</span></b><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Properties props =
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">new</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> Properties();</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; props.put(</span><span
            style="font-size:10.0pt; font-family:Consolas;
            color:#2A00FF" lang="EN-US">"osgi.service.jndi.bundleContext"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">, Activator.<i>getBundleContext</i>());</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; props.put(Context.</span><i><span
              style="font-size:10.0pt; font-family:Consolas;
              color:#0000C0" lang="EN-US">URL_PKG_PREFIXES</span></i><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">,
          </span><span style="font-size:10.0pt; font-family:Consolas;
            color:#2A00FF" lang="EN-US">"org.jboss.ejb.client.naming"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">);</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Context ctx =
            contextMgr.newInitialContext(props);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span
              style="font-size:10.0pt; font-family:Consolas;
              color:#0000C0" lang="EN-US">out</span></i><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.println(</span><span style="font-size:10.0pt;
            font-family:Consolas; color:#2A00FF" lang="EN-US">"doing
            lookup"</span><span style="font-size:10.0pt;
            font-family:Consolas; color:black" lang="EN-US">);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; calc =
            (RemoteCalculator)ctx.lookup(</span><span
            style="font-size:10.0pt; font-family:Consolas;
            color:#2A00FF" lang="EN-US">"ejb:application-ear-0.0.1-SNAPSHOT/ejb-definition-0.0.1-SNAPSHOT//CalculatorBean!steffen.experimental.remote.ejb.RemoteCalculator"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">);</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.</span><i><span
              style="font-size:10.0pt; font-family:Consolas;
              color:#0000C0" lang="EN-US">out</span></i><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">.println(</span><span style="font-size:10.0pt;
            font-family:Consolas; color:#2A00FF" lang="EN-US">"lookup
            succeeded, calling remote bean"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">);</span><span style="font-size:10.0pt;
            font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          </span><b><span style="font-size:10.0pt; font-family:Consolas;
              color:#7F0055" lang="EN-US">return</span></b><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">
          </span><span style="font-size:10.0pt; font-family:Consolas;
            color:#2A00FF" lang="EN-US">"result:"</span><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US"> + calc.add(1, 1);</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></span></p>
        <p class="MsoNormal" style="text-autospace:none"><span
            style="font-size:10.0pt; font-family:Consolas; color:black"
            lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span
            style="font-size:10.0pt; font-family:Consolas" lang="EN-US"></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>
      <br>
      <br>
      <br>
      ...<br>
      <br>
      <table id="table1" style="border-collapse:collapse" border="0"
        width="100%">
        <tbody>
          <tr>
            <td style="border-bottom-style:double;
              border-bottom-width:3px" width="272">&nbsp;</td>
            <td style="border-bottom-style:double;
              border-bottom-width:3px" width="45">&nbsp;</td>
            <td style="border-bottom-style:double;
              border-bottom-width:3px">&nbsp;</td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <table id="table1" style="border-collapse:collapse" border="0"
        width="100%">
        <tbody>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1"><b>SEEBURGER
                  AG</b></font></td>
            <td width="45">&nbsp;</td>
            <td><font color="#808080" face="Arial" size="1">Vorstand/Seeburger
                Executive Board:</font></td>
          </tr>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1">Sitz
                der Gesellschaft/Registered Office:</font></td>
            <td width="45">&nbsp;</td>
            <td><font color="#808080" face="Arial" size="1">Bernd
                Seeburger, Axel Haas, Michael Kleeberg</font></td>
          </tr>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1">Edisonstr.
                1</font></td>
            <td width="45">&nbsp;</td>
            <td><br>
            </td>
          </tr>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1">D-75015
                Bretten</font></td>
            <td width="45"><br>
            </td>
            <td><font color="#808080" face="Arial" size="1">Vorsitzender
                des Aufsichtsrats/Chairperson of the Seeburger
                Supervisory Board:</font></td>
          </tr>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1">Tel.:
                07252 / 96 - 0</font></td>
            <td width="45"><br>
            </td>
            <td><font color="#808080" face="Arial" size="1">Dr. Franz
                Scherer</font></td>
          </tr>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1">Fax:
                07252 / 96 - 2222</font></td>
            <td width="45"><br>
            </td>
            <td><br>
            </td>
          </tr>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1">Internet:
                <a class="moz-txt-link-freetext" href="http://www.seeburger.de">http://www.seeburger.de</a></font></td>
            <td width="45"><br>
            </td>
            <td><font color="#808080" face="Arial" size="1">Registergericht/Commercial
                Register:</font></td>
          </tr>
          <tr>
            <td width="272"><font color="#808080" face="Arial" size="1">e-mail:
                <a class="moz-txt-link-abbreviated" href="mailto:info@seeburger.de">info@seeburger.de</a></font></td>
            <td width="45"><br>
            </td>
            <td><font color="#808080" face="Arial" size="1">HRB 240708
                Mannheim</font></td>
          </tr>
        </tbody>
      </table>
      <p><font face="Arial" size="2"><br>
        </font></p>
      <p align="justify"><font color="#808080" face="Arial" size="1">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>
        </font></p>
      <font color="#808080" face="Arial" size="1">
        <p align="justify"><font color="#808080" face="Arial" size="1">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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
jboss-as7-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:jboss-as7-dev@lists.jboss.org">jboss-as7-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/jboss-as7-dev">https://lists.jboss.org/mailman/listinfo/jboss-as7-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
JBoss OSGi Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx 
</pre>
  </body>
</html>