You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by dougly <dm...@gmail.com> on 2009/01/30 15:54:17 UTC

Re: openwire CSharpGeneratorTask fails to create C# classes from java src

Hello,
I don't know if you figure out the solution or not. So here is what my fix
for your issue:



> /**
> * @openwire:marshaller code="9"
> */
> public class Person implements Serializable
> {
>     private String firstName;
>     
>     private String lastName;
>     
>     public void setFirstName(String fn)
>     {
>         this.firstName = fn;
>     }
>     
>     public void setLastName(String ln)
>     {
>         this.lastName = ln;
>     }
>     
>     /**
>     * @openwire:property
>     */
>     public String getFirstName()
>     {
>         return this.firstName;
>     }
>     
>     /**
>     * @openwire:property
>     */
>     public String getLastName()
>     {
>         return this.lastName;
>     }
> }
> 

But I still get the same error though. Did you finally make this to work?
Thanks


george mullen wrote:
> 
> 
> I am trying to user  org.apache.activemq.openwire.tool.CSharpGeneratorTask 
> to generate C# classes  for communication between ActiveMQ NMS C# client
> application and  ActiveMQ JMS java server-side apps using openwire
> protocol
> 
> I can send simple ITextMessage messages fine however when I send
> IObjectMessage  I get the followling exception
> 
> WARN 
> [org.springframework.jms.listener.DefaultMessageListenerContainer#0-1hread]
> listener.DefaultMessageListenerContainer - Execution of JMS message
> listener failed
> javax.jms.JMSException: Failed to build body from bytes. Reason:
> java.io.StreamCorruptedException: invalid stream header: 00010000
> 	at
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:33)
> 	at
> org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:172)
> 	at
> org.springframework.jms.support.converter.SimpleMessageConverter.extractSerializableFromMessage(SimpleMessageConverter.java:222)
> 	at
> org.springframework.jms.support.converter.SimpleMessageConverter.fromMessage(SimpleMessageConverter.java:109)
> 	at
> org.springframework.jms.listener.adapter.MessageListenerAdapter.extractMessage(MessageListenerAdapter.java:396)
> 	at
> org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:327)
> 	at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:485)
> 	at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:442)
> 	at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:414)
> 	at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:309)
> 	at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:254)
> 	at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:870)
> 	at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:810)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: java.io.StreamCorruptedException: invalid stream header:
> 00010000
> 	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
> 	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
> 	at
> org.apache.activemq.util.ClassLoadingAwareObjectInputStream.<init>(ClassLoadingAwareObjectInputStream.java:32)
> 	at
> org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:164)
> 	... 12 more
> 
> 
> 
> 
> 
> I guess this is to do with mismatch between the C# and Java classes
> representing the object to be serialized 
>  http://www.nabble.com/file/p15267214/CSharpCodeGen.zip CSharpCodeGen.zip 
> 
> 
> I have tried using the openwire ant task to generate the c# classes  but
> it only produces a single class MarshallerFactory.cs which dosent seem to
> do much.
> 
> 
> Drilling into the openwire generator classes I not that there is a  method
> in  org.apache.activemq.openwire.tool.MultiSourceGenerator called 
> isValidClass(JClass jclass) which seems to look for and annotation     
> 
> jclass.getAnnotation("openwire:marshaller")
> 
> 
> 
> Does this mean  I have to annotate the classes that I am planning to
> serialize between NMS and JMS ?
> If so how do I do this - are there any examples I could look at?
> 
> I am using Java  1.6.0_02-b06 on Windows XP 
> I have tried both ActiveMQ-4.1.1 and  ActiveMQ-5.0.0 
> attached is  mvn2 project with code and ant build.xml to call
> CSharpGeneratorTask
> 
> 
> Many thanks 
> George.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/openwire-CSharpGeneratorTask-fails-to-create-C--classes-from-java-src-tp15267214p21748573.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.