tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph, Roshan IN BLR SISL" <Roshan.Jos...@siemens.com>
Subject RE: binding.jms in SCA Java 2.0 M4
Date Thu, 26 Nov 2009 05:06:58 GMT
Hi ant,

 Thank you for the replies; I have made some small changes to have my service exposed via
binding.jms. I don't think this is the right way, but it works for me atleast for the time
being. What I have done is added another bundle which will register an ActiveMQConnection
factory object in the osgi service registry and made changes in the JMSREsourceFactoryImpl
in org.apache.t.s.b.jms.provider bundle to access this same connection factory. This helped
me to get my service part working.



The following method is modified in the JMSResourceFActoryImpl class...



protected void createConnection() throws NamingException, JMSException {

        ConnectionFactory connectionFactory =(ConnectionFactory)jndiLookUp(connectionFactoryName);

        if (connectionFactory == null) {

            // TODO: connection factory name may be a non-jndi name OSGi complaint lookup.

            BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass())

            .getBundleContext();

            ServiceReference sr  =  bundleContext.getServiceReference(ConnectionFactory.class.getName());

            if(sr != null) {

                  connectionFactory = (ConnectionFactory)bundleContext.getService(sr);

            }

            else{

                 throw new JMSBindingException("connection factory not found: " + connectionFactoryName);

            }

        }

        connection = connectionFactory.createConnection();

    }







Also I have implemented the lookupPhysical(String jndiName) method in the same JMSResourceFactoryImpl
using the same ConnectionFactory object registered in the service registry of the OSGi runtime.

On starting the service bundle I get the console output as



----------------Console O/P---------------------------

Nov 26, 2009 10:22:42 AM org.apache.tuscany.sca.binding.jms.host.DefaultJMSServiceListener
registerListerner

INFO: JMS service 'HelloWorldService' listening on destination DestQueueA

Nov 26, 2009 10:22:42 AM org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryImpl addEndpoint

INFO: Add endpoint - (@19275957)Endpoint:  URI = HelloWorldComponent#service-binding(HelloWorldService/HelloWorldService)

------------------------------------------------------------------





Currently I am looking at how to make a client use this service. The client reference running
in another osgi runtime is not able to use this exposed service. I get error here as referenced
service not found.



My client composite is somewhat like as shown below.



<component name="HelloWorldClientComponent">

        <tuscany:implementation.osgi bundleSymbolicName="HelloWorldClient" bundleVersion="1.0.0"
/>

        <service name="HelloWorldClientProcessor">

            <binding.ws/>

        </service>

        <reference name="serviceA">

           <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
jndiURL="tcp://localhost:61616">

               <destination jndiName="DestQueueA"/>

               <response>

                  <destination jndiName="RespQueueA"/>

               </response>

           </binding.jms>

        </reference>

    </component>



If I start my client I get the following error...



Nov 26, 2009 10:30:52 AM org.apache.tuscany.sca.builder.impl.ComponentBuilderImpl [Composite:
{http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: HelloWorldClientComponent]
(ReferenceNotFoundForComponentReference)

SEVERE: Component type reference not found for component reference: Component = HelloWorldClientComponent
Reference = serviceA

Nov 26, 2009 10:30:54 AM org.apache.tuscany.sca.node.osgi.impl.NodeManager bundleStarted

SEVERE: org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903},
Component: HelloWorldClientComponent] - Component type reference not found for component reference:
Component = HelloWorldClientComponent Reference = serviceA

java.lang.IllegalStateException: org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903},
Component: HelloWorldClientComponent] - Component type reference not found for component reference:
Component = HelloWorldClientComponent Reference = serviceA

      at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:176)

      at org.apache.tuscany.sca.node.osgi.impl.NodeManager.bundleStarted(NodeManager.java:117)

      at org.apache.tuscany.sca.node.osgi.impl.NodeManager.bundleChanged(NodeManager.java:139)

      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:916)

      at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:220)

      at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)

      at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1350)

      at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1301)

      at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:362)

      at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)

      at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:557)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:464)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:248)

      at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:445)

      at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:220)

      at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:330)

Caused by: org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903},
Component: HelloWorldClientComponent] - Component type reference not found for component reference:
Component = HelloWorldClientComponent Reference = serviceA

      at org.apache.tuscany.sca.node.impl.NodeFactoryImpl.analyzeProblems(NodeFactoryImpl.java:174)

      at org.apache.tuscany.sca.node.impl.NodeFactoryImpl.configureNode(NodeFactoryImpl.java:275)

      at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:135)

      ... 16 more





Would you able to comment on what is creating the problem? Thank you and appreciate very much
your comments and support.



Regards

Roshan













-----Original Message-----
From: ant.elder@gmail.com [mailto:ant.elder@gmail.com] On Behalf Of ant elder
Sent: Tuesday, November 24, 2009 2:52 PM
To: Joseph, Roshan IN BLR SISL
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




Mime
View raw message