The root cause here is that the default package cannot be exported in OSGi.
As a result, the jndi.properties file cannot be seen on the classpath unless
it is directly within the bundle that packages the file.
Taking an example, you have a bundle A that has a jndi.properties file. When
you the new InitialContext() is called (by Tuscany, I assume), it tries to
use TCCL to find the jndi.properties. TCCL is not defined in OSGi. Unless
the Tuscany code explicitly set TCCL (for example, an aggregated classloader
that see all bundles that have jndi.properties entries), it is not possible
to find the jndi.properites.
There may be a few workarounds:
1. Use system properties to define the JNDI properties
2. Enhance Tuscany code to look for a Tuscany-defined resource (such as
org/apache/tuscany/sca/jndi/jndi.properites) and use it to set up the
InitialContext.
AFAIK, the OSGi EEG group is working on JNDI spec that works for OSGi.
Apache Aries might implement it.
[1] http://java.sun.com/products/jndi%2Ftutorial/beyond/env/source.html
Thanks,
Raymond
--------------------------------------------------
From: "ant elder" <[email protected]>
Sent: Tuesday, November 24, 2009 1:23 AM
To: <[email protected]>
Subject: Re: binding.jms in SCA Java 2.0 M4
Hi Roshan, sorry I've been snowed under and not had much of a chance
to look at this yet so dont have much to add here. I'll try to look at
it more shortly and maybe try to get one of the other Tuscany OSGi
experts to have a look too as its more of an OSGi runtime thing than a
JMS binding issue.
...ant
On Thu, Nov 19, 2009 at 4:27 AM, Joseph, Roshan IN BLR SISL
<[email protected]> wrote:
Hi Ant,
Could you please comment on what approach will be ideal to get this JMS
problem resolved in OSGi runtime/SCA Java 2.X.
I understand that accessing JNDI resources in OSGi is not possible at
present and hence the current way of using the jndi.properties will not
be a solution for Tuscany in osgi runtime.
I have looked at the servicemix-jndi integration and they have a simple
implementation (based on RFC142) which helps to get jndi lookup enabled
via the osgi registry.
(http://servicemix.apache.org/SMX4NMR/7-jndi-integration.html) They use
javax.naming.spi.InitialContextFactoryBuilder for lookup and the lookup
will return a proxy to the filtered osgi service in the registry.
Will a similar implementation resolve the jndi problem with the current
code base of Tuscany binding.jms implementation? Since the
JMSREsourceFactoryImpl in o.a.t.s.b.jms.provider uses jndilookup
everywhere, I see another method
lookupPhysical(String jndiName) being not implemented, the comment says
this for non jndi complaint destination names. Is there any specific
approach planned for this implementation, if so would be happy to
contribute from my side to get it working.
Also the servicemix activemq integration talks about pooled
connectionFactory for activemq and here I believe they use spring and
Jencks (http://docs.codehaus.org/display/JCA/Home) to achieve this. I
have not looked into this in much detail, but do you think, something
similar to this will be a possible solution for achieving JMS capability
in Tuscany in 2.X
Please feel free to correct me, if my findings are wrong or misleading
and I do appreciate any feedback from Tuscany dev community.
Regards,
Roshan
-----Original Message-----
From: Konradi, Philipp
Sent: Monday, November 16, 2009 5:12 PM
To: [email protected]; [email protected]
Cc: Joseph, Roshan IN BLR SISL
Subject: RE: binding.jms in SCA Java 2.0 M4
Yes something like that is definitely needed, but i'm not sure that
alone would be enough to get it working. The JMS samples we have use
the jndi.properties file to configure the JMS resources and I suspect
that wont work as-is in OSGi.
AFAIK according to the binding spec JNDi is only one of two possible ways
to configure JMS bindings.
Is the alternative way of configuring it supported in Tuscany 2.x M4? Or
put it in other words would it be worth to try this out before looking
for JNDi solutions / workarounds?
Thanks,
Philipp
-----Original Message-----
From: ant elder [mailto:[email protected]]
Sent: Friday, November 13, 2009 12:30 PM
To: [email protected]
Cc: Joseph, Roshan IN BLR SISL
Subject: Re: binding.jms in SCA Java 2.0 M4
On Fri, Nov 13, 2009 at 10:55 AM, Joseph, Roshan IN BLR SISL
<[email protected]> wrote:
> Hi Raymond,
>
> Do you think the activemq bundles need to be included as well in the
> modules folder? I am using the SCA 2.0 M4 release and I don't see the
> activemq bundles there. Is that could be the problem.
>
>
>
> Please let me know if so. Thank you and appreciate your help.
>
>
>
> Regards
>
> Roshan
>
>
Yes something like that is definitely needed, but i'm not sure that
alone would be enough to get it working. The JMS samples we have use
the jndi.properties file to configure the JMS resources and I suspect
that wont work as-is in OSGi. There is some ActiveMQ doc on running in
OSGi at http://activemq.apache.org/osgi-integration.html, so you could
try that and using the web console to configure the resources and see
how that goes. We've just not had a chance to work through this for
M4, I'd hope we can by M5 and have a sample demonstrating how to do
it, but if you or anyone else can help work out whats needed in the
meantime that would be great.
...ant