Hi Make sure your custom type converter do NOT throw any exception. So maybe just for starters return a new empty SampleType. And if possible you can also set a break point in your custom type converter and debug the code.
On Wed, Mar 3, 2010 at 2:59 PM, patrickds <[email protected]> wrote: > > I am using Camel 2.1.0 running in Eclipse at the moment. > > > I am getting an exception: > > DEBUG - Message exchange has failed so breaking out of pipeline: > Exchange[Message: > MSH|^~\&|SAP-ISH|HZL|||20040805152637||ADT^A01|123456|T|2.2|||ER > EVN|A01|20040805152637 > PID|1||79471||Meier^Elfriede|Meier|19400101|W|||Hauptstrasse > 23^^Essen^NW^11000^DE^H|||||S|||111-11-1111||||Essen > NK1|1|Meier^Elfriede|EMC|Hauptstrasse > 23^^Essen^NW^11000^DE|333-4444~333-5555 > PV1|1|I|ISKA|R||||823745217||||||||N|||79237645|||||||||||||||||||||||||20040805000000 > ] Exception: org.apache.camel.InvalidPayloadException: No body available of > type: xxx.yyy.zzz.SampleType but has value: [...@b950d1 of type: byte[] on: > Message: [...@b950d1. Caused by: No type converter available to convert from > type: byte[] to the required type: xxx.yyy.zzz.SampleType with value > [...@b950d1 on the exchange: Exchange[Message: [...@b950d1] > > > Even though I see that a type converter to handle this has been loaded: > > DEBUG - Loading converter class: xxx.yyy.zzz.SampleTypeConverter > > > This is my type converter: > > package xxx.yyy.zzz; > > import org.apache.camel.Converter; > > @Converter > > public class SampleTypeConverter { > > �...@converter > > public static SampleType toSampleType(byte[] body) { > > > > String msgstr = body.toString(); > > > > SampleType sampleType = new SampleType(); > > > > sampleType.setParam1(msgstr.substring(msgstr.indexOf("MSH"), > msgstr.indexOf("MSH")+5)); > > sampleType.setParam2(msgstr.substring(msgstr.indexOf("EVN"), > msgstr.indexOf("EVN")+5)); > > sampleType.setParam3(msgstr.substring(msgstr.indexOf("PID"), > msgstr.indexOf("PID")+5)); > > > > return sampleType; > > } > > } > > > > Any help would be appreciated. Thanks. > -- > View this message in context: > http://old.nabble.com/%22No-type-converter-available%22-I%27ve-defined-converter-and-see-it-is-loaded.-tp27768567p27768567.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
