You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "peter.berkman" <pe...@cornergrove.com> on 2013/01/30 21:25:08 UTC

Configuring MINA Server Endpoint

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?



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

Re: Configuring MINA Server Endpoint

Posted by "peter.berkman" <pe...@cornergrove.com>.
forgot to include the SSL configuration.   so, here it is - just swap the two
*Config beans with these:





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

Re: Configuring MINA Server Endpoint

Posted by "peter.berkman" <pe...@cornergrove.com>.
Babak,
thank you for all the pointers! It is working great and now I can easily
change between plain and SSL configurations! solution:





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

Re: Configuring MINA Server Endpoint

Posted by Babak Vahdat <ba...@swissonline.ch>.
And the defined codec of yours seems to be of type String however the
expected type is org.apache.mina.filter.codec.ProtocolCodecFactory see:

http://camel.apache.org/maven/current/camel-mina/apidocs/org/apache/camel/component/mina/MinaConfiguration.html#setCodec%28org.apache.mina.filter.codec.ProtocolCodecFactory%29

So that Camel fails to do a type conversion for it. I think the codec type
you need to define inside your Spring XML is:

http://camel.apache.org/maven/current/camel-hl7/apidocs/org/apache/camel/component/hl7/HL7MLLPCodec.html

Babak


Babak Vahdat wrote
> Am 30.01.13 21:25 schrieb "peter.berkman" unter
> &lt;

> peter.berkman@

> &gt;:
> 
>>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.





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

Re: Configuring MINA Server Endpoint

Posted by Babak Vahdat <ba...@swissonline.ch>.

Am 30.01.13 21:25 schrieb "peter.berkman" unter
<pe...@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.