camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Babak Vahdat <babak.vah...@swissonline.ch>
Subject Re: Configuring MINA Server Endpoint
Date Wed, 30 Jan 2013 21:10:29 GMT


Am 30.01.13 21:25 schrieb "peter.berkman" unter
<peter.berkman@cornergrove.com>:

>I am configuring MINA via bean configuration, but the codec reference
>keeps
>throwing an excption:
>
>{code}
>	<bean id="pixpdqv2MinaFactory"
>class="org.apache.camel.component.mina.MinaComponent">
>	    <constructor-arg index="0" ref="nextgate-context-pixpdq-hl7v2"/>
>	</bean>
>
>	<bean id="hl7v2querylistenerEndpoint"
>	      factory-bean="pixpdqv2MinaFactory"
>	      factory-method="createEndpoint">
>	    <constructor-arg index="0" ref="hl7v2querylistenerConfig"/>
>	</bean>
>
>	<bean id="hl7v2feedlistenerEndpoint"
>	      factory-bean="pixpdqv2MinaFactory"
>	      factory-method="createEndpoint">
>	    <constructor-arg index="0" ref="hl7v2feedlistenerConfig"/>
>	</bean>
>
>	<bean id="hl7v2querylistenerConfig"
>class="org.apache.camel.component.mina.MinaConfiguration">
>	    <property name="protocol" value="tcp"/>
>	    <property name="host"
>value="${nextgate.ms.hl7v2.pixpdqquery.listenaddr}"/>
>	    <property name="port"
>value="${nextgate.ms.hl7v2.pixpdqquery.listenport}"/>
>	    <property name="sync" value="true"/>
>	    <property name="codec" ref="hl7codec" />
>	</bean>
>
>	<bean id="hl7v2feedlistenerConfig"
>class="org.apache.camel.component.mina.MinaConfiguration">
>	    <property name="protocol" value="tcp"/>
>	    <property name="host"
>value="${nextgate.ms.hl7v2.pixfeed.listenaddr}"/>
>	    <property name="port"
>value="${nextgate.ms.hl7v2.pixfeed.listenport}"/>
>	    <property name="sync" value="true"/>
>	    <property name="codec" ref="hl7codec" />
>	</bean>
>
>	<camelContext id="nextgate-context-pixpdq-hl7v2"
>xmlns="http://camel.apache.org/schema/spring">
>  
>  		<route id="nextgate-route-pixpdq-hl7v2query">
>			
>			
>			
>  			<from ref="hl7v2querylistenerEndpoint" />
>. . .
>
>{code}
>
>
>the exception: 
>{code}
>[#|2013-01-30T11:55:20.281-0800|SEVERE|glassfish3.1.2|org.apache.catalina.
>core.ContainerBase|_ThreadID=154;_ThreadName=admin-thread-pool-4848(100);|
>ContainerBase.addChild:
>start:
>org.apache.catalina.LifecycleException:
>org.springframework.beans.factory.BeanCreationException: Error creating
>bean
>with name 'hl7v2querylistenerEndpoint' defined in ServletContext resource
>[/WEB-INF/spring/nextgate-context-pixpdqv2.xml]: Cannot resolve reference
>to
>b
>ean 'hl7v2querylistenerConfig' while setting constructor argument; nested
>exception is org.springframework.beans.factory.BeanCreationException:
>Error
>creating bean with name 'hl7v2querylistenerConfig' defined in
>ServletContext
>resource [/WEB-INF/spring/nextgate-import-
>pixpdqv2-unsecure.xml]: Initialization of bean failed; nested exception is
>org.springframework.beans.ConversionNotSupportedException: Failed to
>convert
>property value of type 'java.lang.String' to required type
>'org.apache.mina.filter.codec.ProtocolCodecFactory' for pr
>operty 'codec'; nested exception is java.lang.IllegalStateException:
>Cannot
>convert value of type [java.lang.String] to required type
>[org.apache.mina.filter.codec.ProtocolCodecFactory] for property 'codec':
>no
>matching editors or conversion strategy found
>        at
>org.apache.catalina.core.StandardContext.start(StandardContext.java:5389)
>        at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
>        at
>org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java
>:917)
>        at
>org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
>        at
>org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
>        at
>com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
>        at
>com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
>        at
>com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
>. . .
>{code}
>
>
>any ideas?
>

Hi

I don't see any definition of your codec 'hl7codec' inside the Spring XML
which you reference to using ref="hl7codec".

You could also easily make use of the codec option inside the endpoint URI
itself which you should bind into the Registery first, see the codec
option here:

http://camel.apache.org/mina.html

There's also a Test here, however in Java and not XML but the idea is the
same:

https://svn.apache.org/repos/asf/camel/trunk/components/camel-mina/src/test
/java/org/apache/camel/component/mina/MinaCustomCodecTest.java

For example in Spring XML you would define your codec like:

<bean id="hl7codec"
class="org.apache.mina.filter.codec.textline.TextLineCodecFactory" />

And then inside your route:

<from uri="mina:tcp://localhost:5555?codec=#hl7codec"/>

 

Babak


>
>
>--
>View this message in context:
>http://camel.465427.n5.nabble.com/Configuring-MINA-Server-Endpoint-tp57265
>82.html
>Sent from the Camel - Users mailing list archive at Nabble.com.



Mime
View raw message