You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Decebal Suiu <de...@gmail.com> on 2007/09/13 13:07:51 UTC

Error adding ExecutorFilter in Spring

Mina from trunk and Spring 2.0.6
Config file for spring look like:

	<bean id="filterThreadPoolFactory"
class="org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean">
		<property name="corePoolSize" value="${corePoolSize}"/>
		<property name="maxPoolSize" value="${maxPoolSize}"/>
		<property name="keepAliveSeconds" value="${keepAliveSeconds}"/>
	</bean>

	<bean id="filterChainBuilder"
class="org.apache.mina.integration.spring.DefaultIoFilterChainBuilderFactoryBean">
		<property name="filters">
			<list>
				<bean class="org.apache.mina.filter.codec.ProtocolCodecFilter">
					<constructor-arg ref="protocolCodecFactory"/>
				</bean>
				<bean class="org.apache.mina.filter.executor.ExecutorFilter">
	          		<constructor-arg ref="filterThreadPoolFactory"/>
        		</bean>
				<bean class="org.apache.mina.filter.LoggingFilter"/>
			</list>
		</property>
	</bean>

The error is:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name
'org.apache.mina.filter.executor.ExecutorFilter#5d173' defined in class path
resource [serverContext.xml]: Unsatisfied dependency expressed through
constructor argument with index 0 of type
[org.apache.mina.common.IoEventType[]]: Could not convert constructor
argument value of type [java.util.concurrent.ThreadPoolExecutor] to required
type [[Lorg.apache.mina.common.IoEventType;]: Failed to convert value of
type [java.util.concurrent.ThreadPoolExecutor] to required type
[org.apache.mina.common.IoEventType[]]; nested exception is
java.lang.IllegalArgumentException: Cannot convert value of type
[java.util.concurrent.ThreadPoolExecutor] to required type
[org.apache.mina.common.IoEventType] for property 'null': no matching
editors or conversion strategy found
        at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:455)
        at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:153)


Any idea?

Thanks,
Decebal
-- 
View this message in context: http://www.nabble.com/Error-adding-ExecutorFilter-in-Spring-tf4435038s16868.html#a12652766
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Error adding ExecutorFilter in Spring

Posted by Decebal Suiu <de...@gmail.com>.
Thanks Trustin, it's ok now.
My spring config file looks like this (for example):

	<bean id="serverSessionHandler"
class="org.qserver.server.ServerSessionHandler">
		<constructor-arg ref="statelessContainer"/>
	</bean>

	<bean id="protocolCodecFactory"
class="org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory"/>

	<bean id="threadPool"
class="org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean">
		<property name="corePoolSize" value="${corePoolSize}"/>
		<property name="maxPoolSize" value="${maxPoolSize}"/>
		<property name="keepAliveSeconds" value="${keepAliveSeconds}"/>
	</bean>

	<bean id="filterChainBuilder"
class="org.apache.mina.integration.spring.DefaultIoFilterChainBuilderFactoryBean">
		<property name="filters">
			<list>
				<bean class="org.apache.mina.filter.codec.ProtocolCodecFilter">
					<constructor-arg ref="protocolCodecFactory"/>
				</bean>
				<bean class="org.apache.mina.filter.executor.ExecutorFilter">
	          		<constructor-arg ref="threadPool"/>
        		</bean>
				<bean class="org.apache.mina.filter.logging.LoggingFilter"/>
			</list>
		</property>
	</bean>

	<bean id="socketAcceptor"
class="org.apache.mina.transport.socket.nio.SocketAcceptor">
  		<property name="localAddress" value=":${port}"/>
  		<property name="handler" ref="serverSessionHandler"/>
		<property name="filterChainBuilder" ref="filterChainBuilder"/>
		<property name="reuseAddress" value="false"/>
		<property name="disconnectOnUnbind" value="true"/>
		<property name="sessionConfig.reuseAddress" value="false"/>
		<property name="sessionConfig.tcpNoDelay" value="true"/>
		<property name="sessionConfig.keepAlive" value="true"/>
		<property name="sessionConfig.sendBufferSize" value="512"/>
		<property name="sessionConfig.receiveBufferSize" value="512"/>
		<property name="sessionConfig.soLinger" value="10"/>
	    <property name="sessionConfig.oobInline" value="false"/>
	</bean>

Have a good day,
Decebal


Trustin Lee wrote:
> 
> On 9/13/07, Decebal Suiu <de...@gmail.com> wrote:
>>
>> It's works, thanks. It's strange that spring doesn't understand varargs.
>> Is it possible to have a setSessionConfig() method in SocketAcceptor?
>> (for
>> IoC - now I use a factory in Spring)
> 
> You don't need setSessionConfig() to set session properties:
> 
> <property name="sessionConfig.reuseAddress" value="true"/>
> 
> That's why we removed setSessionConfig().  :)
> 
> HTH,
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/Error-adding-ExecutorFilter-in-Spring-tf4435038s16868.html#a12670014
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Error adding ExecutorFilter in Spring

Posted by Trustin Lee <tr...@gmail.com>.
On 9/13/07, Decebal Suiu <de...@gmail.com> wrote:
>
> It's works, thanks. It's strange that spring doesn't understand varargs.
> Is it possible to have a setSessionConfig() method in SocketAcceptor? (for
> IoC - now I use a factory in Spring)

You don't need setSessionConfig() to set session properties:

<property name="sessionConfig.reuseAddress" value="true"/>

That's why we removed setSessionConfig().  :)

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: Error adding ExecutorFilter in Spring

Posted by Decebal Suiu <de...@gmail.com>.
It's works, thanks. It's strange that spring doesn't understand varargs.
Is it possible to have a setSessionConfig() method in SocketAcceptor? (for
IoC - now I use a factory in Spring)


Maarten Bosteels-4 wrote:
> 
> Please run svn up and let us know if the problem is fixed.
> 
> Thanks
> Maarten
> 
> On 9/13/07, Maarten Bosteels <mb...@gmail.com> wrote:
>>
>> Hi Decebal,
>>
>> ExecutorFilter has no constructor that takes only an Executor
>>
>> and Spring doesn't understand that it could use this constructor:
>>
>> public ExecutorFilter(Executor executor, IoEventType... eventTypes)
>>
>> I will add a constructor that takes only an Executor
>>
>> Maarten
>>
>>
>> On 9/13/07, Decebal Suiu <decebal.suiu@gmail.com > wrote:
>> >
>> >
>> > Mina from trunk and Spring 2.0.6
>> > Config file for spring look like:
>> >
>> >         <bean id="filterThreadPoolFactory"
>> > class="org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean
>> > ">
>> >                 <property name="corePoolSize" value="${corePoolSize}"/>
>> >                 <property name="maxPoolSize" value="${maxPoolSize}"/>
>> >                 <property name="keepAliveSeconds"
>> > value="${keepAliveSeconds}"/>
>> >         </bean>
>> >
>> >         <bean id="filterChainBuilder"
>> > class="
>> >
>> org.apache.mina.integration.spring.DefaultIoFilterChainBuilderFactoryBean
>> > ">
>> >                 <property name="filters">
>> >                         <list>
>> >                                 <bean class="
>> > org.apache.mina.filter.codec.ProtocolCodecFilter">
>> >                                         <constructor-arg
>> > ref="protocolCodecFactory"/>
>> >                                 </bean>
>> >                                 <bean class="
>> > org.apache.mina.filter.executor.ExecutorFilter">
>> >                                 <constructor-arg
>> > ref="filterThreadPoolFactory"/>
>> >                         </bean>
>> >                                 <bean class="
>> > org.apache.mina.filter.LoggingFilter"/>
>> >                         </list>
>> >                 </property>
>> >         </bean>
>> >
>> > The error is:
>> > Caused by:
>> > org.springframework.beans.factory.UnsatisfiedDependencyException:
>> > Error creating bean with name
>> > 'org.apache.mina.filter.executor.ExecutorFilter#5d173' defined in class
>> > path
>> > resource [serverContext.xml]: Unsatisfied dependency expressed through
>> > constructor argument with index 0 of type
>> > [org.apache.mina.common.IoEventType[]]: Could not convert constructor
>> > argument value of type [java.util.concurrent.ThreadPoolExecutor ] to
>> > required
>> > type [[Lorg.apache.mina.common.IoEventType;]: Failed to convert value
>> of
>> > type [java.util.concurrent.ThreadPoolExecutor] to required type
>> > [org.apache.mina.common.IoEventType[]]; nested exception is
>> > java.lang.IllegalArgumentException: Cannot convert value of type
>> > [java.util.concurrent.ThreadPoolExecutor] to required type
>> > [org.apache.mina.common.IoEventType] for property 'null': no matching
>> > editors or conversion strategy found
>> >         at
>> >
>> >
>> org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray
>> > (ConstructorResolver.java:455)
>> >         at
>> >
>> >
>> org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(
>> > ConstructorResolver.java:153)
>> >
>> >
>> > Any idea?
>> >
>> > Thanks,
>> > Decebal
>> > --
>> > View this message in context:
>> http://www.nabble.com/Error-adding-ExecutorFilter-in-Spring-tf4435038s16868.html#a12652766
>> >
>> > Sent from the Apache MINA Support Forum mailing list archive at
>> > Nabble.com.
>> >
>> >
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Error-adding-ExecutorFilter-in-Spring-tf4435038s16868.html#a12654468
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Error adding ExecutorFilter in Spring

Posted by Maarten Bosteels <mb...@gmail.com>.
Please run svn up and let us know if the problem is fixed.

Thanks
Maarten

On 9/13/07, Maarten Bosteels <mb...@gmail.com> wrote:
>
> Hi Decebal,
>
> ExecutorFilter has no constructor that takes only an Executor
>
> and Spring doesn't understand that it could use this constructor:
>
> public ExecutorFilter(Executor executor, IoEventType... eventTypes)
>
> I will add a constructor that takes only an Executor
>
> Maarten
>
>
> On 9/13/07, Decebal Suiu <decebal.suiu@gmail.com > wrote:
> >
> >
> > Mina from trunk and Spring 2.0.6
> > Config file for spring look like:
> >
> >         <bean id="filterThreadPoolFactory"
> > class="org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean
> > ">
> >                 <property name="corePoolSize" value="${corePoolSize}"/>
> >                 <property name="maxPoolSize" value="${maxPoolSize}"/>
> >                 <property name="keepAliveSeconds"
> > value="${keepAliveSeconds}"/>
> >         </bean>
> >
> >         <bean id="filterChainBuilder"
> > class="
> > org.apache.mina.integration.spring.DefaultIoFilterChainBuilderFactoryBean
> > ">
> >                 <property name="filters">
> >                         <list>
> >                                 <bean class="
> > org.apache.mina.filter.codec.ProtocolCodecFilter">
> >                                         <constructor-arg
> > ref="protocolCodecFactory"/>
> >                                 </bean>
> >                                 <bean class="
> > org.apache.mina.filter.executor.ExecutorFilter">
> >                                 <constructor-arg
> > ref="filterThreadPoolFactory"/>
> >                         </bean>
> >                                 <bean class="
> > org.apache.mina.filter.LoggingFilter"/>
> >                         </list>
> >                 </property>
> >         </bean>
> >
> > The error is:
> > Caused by:
> > org.springframework.beans.factory.UnsatisfiedDependencyException:
> > Error creating bean with name
> > 'org.apache.mina.filter.executor.ExecutorFilter#5d173' defined in class
> > path
> > resource [serverContext.xml]: Unsatisfied dependency expressed through
> > constructor argument with index 0 of type
> > [org.apache.mina.common.IoEventType[]]: Could not convert constructor
> > argument value of type [java.util.concurrent.ThreadPoolExecutor ] to
> > required
> > type [[Lorg.apache.mina.common.IoEventType;]: Failed to convert value of
> > type [java.util.concurrent.ThreadPoolExecutor] to required type
> > [org.apache.mina.common.IoEventType[]]; nested exception is
> > java.lang.IllegalArgumentException: Cannot convert value of type
> > [java.util.concurrent.ThreadPoolExecutor] to required type
> > [org.apache.mina.common.IoEventType] for property 'null': no matching
> > editors or conversion strategy found
> >         at
> >
> > org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray
> > (ConstructorResolver.java:455)
> >         at
> >
> > org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(
> > ConstructorResolver.java:153)
> >
> >
> > Any idea?
> >
> > Thanks,
> > Decebal
> > --
> > View this message in context: http://www.nabble.com/Error-adding-ExecutorFilter-in-Spring-tf4435038s16868.html#a12652766
> >
> > Sent from the Apache MINA Support Forum mailing list archive at
> > Nabble.com.
> >
> >
>

Re: Error adding ExecutorFilter in Spring

Posted by Maarten Bosteels <mb...@gmail.com>.
Hi Decebal,

ExecutorFilter has no constructor that takes only an Executor

and Spring doesn't understand that it could use this constructor:

public ExecutorFilter(Executor executor, IoEventType... eventTypes)

I will add a constructor that takes only an Executor

Maarten


On 9/13/07, Decebal Suiu <de...@gmail.com> wrote:
>
>
> Mina from trunk and Spring 2.0.6
> Config file for spring look like:
>
>         <bean id="filterThreadPoolFactory"
> class="org.apache.mina.integration.spring.ThreadPoolExecutorFactoryBean">
>                 <property name="corePoolSize" value="${corePoolSize}"/>
>                 <property name="maxPoolSize" value="${maxPoolSize}"/>
>                 <property name="keepAliveSeconds"
> value="${keepAliveSeconds}"/>
>         </bean>
>
>         <bean id="filterChainBuilder"
> class="
> org.apache.mina.integration.spring.DefaultIoFilterChainBuilderFactoryBean
> ">
>                 <property name="filters">
>                         <list>
>                                 <bean class="
> org.apache.mina.filter.codec.ProtocolCodecFilter">
>                                         <constructor-arg
> ref="protocolCodecFactory"/>
>                                 </bean>
>                                 <bean class="
> org.apache.mina.filter.executor.ExecutorFilter">
>                                 <constructor-arg
> ref="filterThreadPoolFactory"/>
>                         </bean>
>                                 <bean class="
> org.apache.mina.filter.LoggingFilter"/>
>                         </list>
>                 </property>
>         </bean>
>
> The error is:
> Caused by:
> org.springframework.beans.factory.UnsatisfiedDependencyException:
> Error creating bean with name
> 'org.apache.mina.filter.executor.ExecutorFilter#5d173' defined in class
> path
> resource [serverContext.xml]: Unsatisfied dependency expressed through
> constructor argument with index 0 of type
> [org.apache.mina.common.IoEventType[]]: Could not convert constructor
> argument value of type [java.util.concurrent.ThreadPoolExecutor] to
> required
> type [[Lorg.apache.mina.common.IoEventType;]: Failed to convert value of
> type [java.util.concurrent.ThreadPoolExecutor] to required type
> [org.apache.mina.common.IoEventType[]]; nested exception is
> java.lang.IllegalArgumentException: Cannot convert value of type
> [java.util.concurrent.ThreadPoolExecutor] to required type
> [org.apache.mina.common.IoEventType] for property 'null': no matching
> editors or conversion strategy found
>         at
>
> org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray
> (ConstructorResolver.java:455)
>         at
>
> org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor
> (ConstructorResolver.java:153)
>
>
> Any idea?
>
> Thanks,
> Decebal
> --
> View this message in context:
> http://www.nabble.com/Error-adding-ExecutorFilter-in-Spring-tf4435038s16868.html#a12652766
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>