You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vincentytran <vi...@gmail.com> on 2009/08/03 18:12:44 UTC

must be of type org.apache.mina.filter.codec.ProtocolCodecFactory error

Hello. I need some help with using camel-hl7. I'm new to servicemix and I've
been doing my best following all the tutorials and samples.

The error I am getting is:

Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException:
Bean named 'hl7codec' must be of type
[org.apache.mina.filter.codec.ProtocolCodecFactory], but was actually of
type [org.apache.camel.component.hl7.HL7MLLPCodec]

My camel-context.xml file contains...
<camelContext id="camel"
		xmlns="http://activemq.apache.org/camel/schema/spring">
		<package>ca.blah</package>
	</camelContext>
<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec"> 
        <property name="charset" value="iso-8859-1"/> 
</bean> 


And I have a class that extends RouteBuilder in the ca.blah package...

from("mina:tcp://localhost:8888?sync=true&codec=hl7codec") 
        .process(new Processor() { 
            public void process(Exchange exchange) throws Exception { 
                // use plain String as message format 
                String body = exchange.getIn().getBody(String.class); 
                // return the response as plain string 
                exchange.getOut().setBody("Bye World"); 
            } 
        }) 
        .to("mock:result");
-- 
View this message in context: http://www.nabble.com/must-be-of-type-org.apache.mina.filter.codec.ProtocolCodecFactory-error-tp24793496p24793496.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: must be of type org.apache.mina.filter.codec.ProtocolCodecFactory error

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Could you try adding camel-mina to the dependency as well.


On Mon, Aug 3, 2009 at 7:43 PM, vincentytran<vi...@gmail.com> wrote:
>
> This is my dependancies and properties with version of ServiceMix and Camel.
> I downloaded ServiceMix 3.3.1 binary from the site which is where I copy the
> SA into the hotdeploy folder.
>
> <dependencies>
>    <dependency>
>      <groupId>org.apache.servicemix</groupId>
>      <artifactId>servicemix-camel</artifactId>
>      <version>${servicemix-version}</version>
>    </dependency>
>    <dependency>
>      <groupId>org.apache.servicemix</groupId>
>      <artifactId>servicemix-core</artifactId>
>      <version>${servicemix-version}</version>
>      <scope>provided</scope>
>    </dependency>
>        <dependency>
>      <groupId>org.apache.camel</groupId>
>      <artifactId>camel-hl7</artifactId>
>      <version>${camel-version}</version>
>    </dependency>
>  </dependencies>
>  <properties>
>    <servicemix-version>3.2.3</servicemix-version>
>    <camel-version>1.6.1</camel-version>
>  </properties>
>
> I tried the routeBuilderRef but it resulted in the same error...
>      <camelContext id="camel"
>                xmlns="http://activemq.apache.org/camel/schema/spring">
>                <routeBuilderRef ref="blah"></routeBuilderRef>
>        </camelContext>
>        <bean id="blah" class="ca.imt.BlahRouteBuilder"></bean>
>        <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
>        <property name="charset" value="iso-8859-1"/>
>    </bean>
>
> --
> View this message in context: http://www.nabble.com/must-be-of-type-org.apache.mina.filter.codec.ProtocolCodecFactory-error-tp24793496p24795068.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: must be of type org.apache.mina.filter.codec.ProtocolCodecFactory error

Posted by vincentytran <vi...@gmail.com>.
This is my dependancies and properties with version of ServiceMix and Camel.
I downloaded ServiceMix 3.3.1 binary from the site which is where I copy the
SA into the hotdeploy folder.

<dependencies>
    <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-camel</artifactId>
      <version>${servicemix-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-core</artifactId>
      <version>${servicemix-version}</version>
      <scope>provided</scope>
    </dependency>
	<dependency> 
      <groupId>org.apache.camel</groupId> 
      <artifactId>camel-hl7</artifactId> 
      <version>${camel-version}</version> 
    </dependency> 
  </dependencies>
  <properties>
    <servicemix-version>3.2.3</servicemix-version>
    <camel-version>1.6.1</camel-version>
  </properties>

I tried the routeBuilderRef but it resulted in the same error...
      <camelContext id="camel"
		xmlns="http://activemq.apache.org/camel/schema/spring">
		<routeBuilderRef ref="blah"></routeBuilderRef>
	</camelContext>
	<bean id="blah" class="ca.imt.BlahRouteBuilder"></bean>
	<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec"> 
        <property name="charset" value="iso-8859-1"/> 
    </bean> 

-- 
View this message in context: http://www.nabble.com/must-be-of-type-org.apache.mina.filter.codec.ProtocolCodecFactory-error-tp24793496p24795068.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: must be of type org.apache.mina.filter.codec.ProtocolCodecFactory error

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of SMX and/or Camel are you using?

Its a bit strange as HL7MLLPCodec is implementing the
ProtocolCodecFactory interface.

Could you try with a route builder not define using <package> as there
was an issue with Spring not being able to IoC and do all its stuff in
Camel 1.6.0 or older.

So you can use a <routeBuilderRef> to refer to a spring bean that is
your route builder class, instead of using <package>.



On Mon, Aug 3, 2009 at 6:12 PM, vincentytran<vi...@gmail.com> wrote:
>
> Hello. I need some help with using camel-hl7. I'm new to servicemix and I've
> been doing my best following all the tutorials and samples.
>
> The error I am getting is:
>
> Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException:
> Bean named 'hl7codec' must be of type
> [org.apache.mina.filter.codec.ProtocolCodecFactory], but was actually of
> type [org.apache.camel.component.hl7.HL7MLLPCodec]
>
> My camel-context.xml file contains...
> <camelContext id="camel"
>                xmlns="http://activemq.apache.org/camel/schema/spring">
>                <package>ca.blah</package>
>        </camelContext>
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
>        <property name="charset" value="iso-8859-1"/>
> </bean>
>
>
> And I have a class that extends RouteBuilder in the ca.blah package...
>
> from("mina:tcp://localhost:8888?sync=true&codec=hl7codec")
>        .process(new Processor() {
>            public void process(Exchange exchange) throws Exception {
>                // use plain String as message format
>                String body = exchange.getIn().getBody(String.class);
>                // return the response as plain string
>                exchange.getOut().setBody("Bye World");
>            }
>        })
>        .to("mock:result");
> --
> View this message in context: http://www.nabble.com/must-be-of-type-org.apache.mina.filter.codec.ProtocolCodecFactory-error-tp24793496p24793496.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus