[ 
https://issues.apache.org/jira/browse/TUSCANY-3418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798116#action_12798116
 ] 

Scott Kurz commented on TUSCANY-3418:
-------------------------------------

I can see in the code we don't have an equals() impl for WireFormatJMSText, 
which means in  JMSBindingReferenceBindingProvider.configureBindingChain()  our 
check to ensure that we don't add the interceptor twice is failing.  Since we 
are adding it twice, it's already a JMSMessage after the 1st interceptor, which 
explains the ClassCastExc.

Sorry my machine is tied up and I can't try the patch right now though... but 
we could do something like WireFormatJMSTextXML does with equals().

> <wireFormat.jmsText>  is broken in some use cases
> -------------------------------------------------
>
>                 Key: TUSCANY-3418
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3418
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA JMS Binding Extension
>    Affects Versions: Java-SCA-1.5
>            Reporter: Dan Hatfield
>            Assignee: Simon Laws
>
> From Simon Laws:
> Hi Dan
> Yes, I'm seeing it here also. In this case the 
> WireFormatJMSTextReferenceInterceptor is being added to the wire twice for 
> some reason and that's causing the problem. Don't know why yet but can you 
> raise a JIRA [1] for the problem and I'll look at making a fix for it.
> ------------------------
> Basically, I modified the composite files to the have tuscany name space and 
> placed the <ts:wireFormat.jmsText/> in the appropriate locations.
> So the hello world service example now looks like this:
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
>         xmlns:sca="http://www.osoa.org/xmlns/sca/1.0";
>         xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0";
>         targetNamespace="http://helloworld";
>         xmlns:hw="http://helloworld";
>     name="helloworld">
>     <component name="HelloWorldServiceComponent">
>         <implementation.java class="helloworld.HelloWorldImpl" />
>             <service name="HelloWorldService">
>                 <interface.java interface="helloworld.HelloWorldService"/>
>                 <binding.jms 
> initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
>                              jndiURL="tcp://localhost:61619">
>                     <destination name="RequestQueue" create="ifnotexist"/>
>                     <response>
>                         <destination name="ResponseQueue" 
> create="ifnotexist"/>
>                                 <ts:wireFormat.jmsText/>
>                     </response>
>                           <ts:wireFormat.jmsText/>
>                 </binding.jms>
>         </service>
>     </component>
> </composite>
> And the hello world reference jms example now looks like this:
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
>         targetNamespace="http://helloworld";
>       xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0";
>         xmlns:hw="http://helloworld";
>         name="helloworldjmsreference">
>    
>     <!-- A component with a reference promoted as a composite reference -->
>     <component name="HelloWorldServiceComponent">
>       <implementation.java class="helloworld.HelloWorldServiceComponent"/>
>       <reference name="helloWorldService">
>           <interface.java interface="helloworld.HelloWorldService"/>
>           <binding.jms 
> initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
>                        jndiURL="tcp://localhost:61619">
>               <destination name="RequestQueue" create="always"/>
>               <response>
>                   <destination name="ResponseQueue" create="always"/>
>                         <ts:wireFormat.jmsText/>
>               </response>
>                   <ts:wireFormat.jmsText/>
>           </binding.jms>
>       </reference>
>     </component>
>    
> </composite>
> I expected this to work based on the fact that the HelloWorld interface is:
> public String getGreetings(String s)
> And my understanding of wireFormat.jmsText is this:
> "The data in the JMS message is the string representation of data coming 
> from/going to the service operation. The service operation signature is 
> expected to have a single String parameter"
> However, when I run this, I get the following error:
> d helloworld-reference-jms
> C:\Documents and 
> Settings\hatfieda\workspace\Tuscany\tuscany-sca-1.5.1\samples\h
> elloworld-reference-jms>ant run
> Buildfile: build.xml
>      [java] INFO: Starting node: helloworldjmsreference.composite
>      [java] Injected helloWorldService
>      [java] Called getGreetings
>      [java] Exception in thread "main" java.lang.ClassCastException: 
> org.apache.
> activemq.command.ActiveMQTextMessage
>      [java]     at 
> org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime
> .WireFormatJMSTextReferenceInterceptor.invokeRequest(WireFormatJMSTextReferenceI
> nterceptor.java:83)
>      [java]     at 
> org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime
> .WireFormatJMSTextReferenceInterceptor.invoke(WireFormatJMSTextReferenceIntercep
> tor.java:65)
>      [java]     at 
> org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime
> .WireFormatJMSTextReferenceInterceptor.invoke(WireFormatJMSTextReferenceIntercep
> tor.java:68)
>      [java]     at 
> org.apache.tuscany.sca.binding.jms.provider.RRBJMSBindingInvo
> ker.invoke(RRBJMSBindingInvoker.java:203)
>      [java]     at 
> org.apache.tuscany.sca.core.databinding.wire.PassByValueInter
> ceptor.invoke(PassByValueInterceptor.java:55)
>      [java]     at 
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
> nvoke(JDKInvocationHandler.java:346)
>      [java]     at 
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
> nvoke(JDKInvocationHandler.java:193)
>      [java]     at $Proxy5.getGreetings(Unknown Source)
>      [java]     at 
> helloworld.HelloWorldServiceComponent.getGreetings(HelloWorld
> ServiceComponent.java:30)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [java]     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
> sorImpl.java:39)
>      [java]     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
> hodAccessorImpl.java:25)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]     at 
> org.apache.tuscany.sca.implementation.java.invocation.JavaImp
> lementationInvoker.invoke(JavaImplementationInvoker.java:156)
>      [java]     at 
> org.apache.tuscany.sca.core.databinding.wire.PassByValueInter
> ceptor.invoke(PassByValueInterceptor.java:60)
>      [java]     at 
> org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.inv
> oke(SCABindingInvoker.java:61)
>      [java]     at 
> org.apache.tuscany.sca.core.databinding.wire.PassByValueInter
> ceptor.invoke(PassByValueInterceptor.java:60)
>      [java]     at 
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
> nvoke(JDKInvocationHandler.java:346)
>      [java]     at 
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
> nvoke(JDKInvocationHandler.java:193)
>      [java]     at $Proxy5.getGreetings(Unknown Source)
>      [java]     at 
> helloworld.HelloWorldJmsClient.main(HelloWorldJmsClient.java:
> 36) 
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to