title: SpringXD: ClassCastException of same class between modules in a stream
body: <p>I have a custom Spring XD source module that uses Spring Social for Twitter and outputs Tweet objects. This is working just fine. I can log the output of the source and see the Tweet objects listed. I can change the output type of the source for that stream to application/json to see the output at JSON. This works as expected.</p>
  
  <p>I then created a processor module that will create a new object from that Tweet and output it. The transform message expects a GenericMessage containing a Tweet object as its payload (I've also tried having the method argument be just the Tweet, but that also didnt work).</p>
  
  <pre><code>@Transformer
  public OtherThing&lt;Tweet&gt; transform(GenericMessage&lt;Tweet&gt; message) {
      // ... snip ...
  }
  </code></pre>
  
  <p>However, when i link the two modules together</p>
  
  <pre><code>stream create --name test --definition 'my-tweet-source-module | my-tweet-processor | log' --deploy
  </code></pre>
  
  <p>and a Tweet is output from the source module, i get a class cast exception:</p>
  
  <pre><code>java.lang.ClassCastException: org.springframework.social.twitter.api.Tweet cannot be cast to org.springframework.social.twitter.api.Tweet
  </code></pre>
  
  <p>I've verified that both modules are using the same version of Spring Social Twitter so there should be no problem there. Currently, the modules are communicating over local transport, so this shouldn't be any class loading problem either (they will eventually need to communicate over non-local transport).</p>
  
  <p>I've tried workarounds as well such as defining in the stream that the output type for the source module should be <code>application/json</code> and then try to read the JSON from the input string payload but due to the nature of the Spring Social Tweet object, Jackson doesnt comply.</p>
  
  <p>I'm wondering why this is happening and how i should resolve this? I feel that i'm undoubtedly doing something wrong. If i'm not allowed to do this, i'd like to know why that is and what the appropriate thing to do is.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thank you</p>
  
  <p><strong>EDIT</strong>: I'm using Spring XD 1.2.1.RELEASE</p>