camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patrickds <patrick.d.ste...@ieee.org>
Subject "No type converter available" I've defined converter and see it is loaded.
Date Wed, 03 Mar 2010 13:59:48 GMT

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: [B@b950d1 of type: byte[] on:
Message: [B@b950d1. Caused by: No type converter available to convert from
type: byte[] to the required type: xxx.yyy.zzz.SampleType with value
[B@b950d1 on the exchange: Exchange[Message: [B@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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message