日期:2014-05-18  浏览次数:20852 次

mina socket。。配置remoteAddress报错。。
[code=Java]
[2011-12-27 17:41:28][Server][DEBUG]Field [remoteAddress] isn't an enum value
java.lang.NoSuchFieldException: remoteAddress

[2011-12-27 17:41:28][Server][DEBUG]Ignoring constructor [public org.apache.mina.filter.logging.MdcInjectionFilter(java.util.EnumSet)] of bean 'mdcInjectionFilter': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mdcInjectionFilter' defined in file [D:\MyeclipseSpace\socket_server\apache-tomcat-6.0.20-wks\webapps\appserver\WEB-INF\classes\spring-application-mina.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.EnumSet]: Could not convert constructor argument value of type [java.lang.String] to required type [java.util.EnumSet]: Failed to convert value of type [java.lang.String] to required type [java.util.EnumSet]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [java.util.EnumSet]: no matching editors or conversion strategy found

配置文件如下:
<!-- The IoHandler implementation -->
<bean id="minaHandler"
class="com.app.services.socket.SocketServerHandler" // 我的socket实现服务类
scope="prototype">
<property name="readerIdleTime" value="60000" />
<property name="writerIdleTime" value="0" />
<property name="writeTimeout" value="0" />
</bean>

<!-- executorFilter多线程处理  -->
<bean id="executorFilter"
class="org.apache.mina.filter.executor.ExecutorFilter" />
<bean id="mdcInjectionFilter"
class="org.apache.mina.filter.logging.MdcInjectionFilter">
<constructor-arg value="remoteAddress" /> //这里报错无法将string转换为Enum的值类型。。为什么?
</bean>
<bean id="codecFilter"
class="org.apache.mina.filter.codec.ProtocolCodecFilter">
<constructor-arg>
        <!-- 处理对象流时候用ObjectSerializationCodecFactory -->  
        <!-- <bean class="org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory" /> -->  
<ref bean="textCodeFactory" />
</constructor-arg>
</bean>
<bean id="textCodeFactory"
class="org.apache.mina.filter.codec.textline.TextLineCodecFactory">
<property name="decoderMaxLineLength" value="1024000" />
</bean>
<bean id="loggingFilter"
class="org.apache.mina.filter.logging.LoggingFilter" />

<!-- The non-SSL filter chain. -->
<bean id="filterChainBuilder"
class="org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder">
<property name="filters">
<map>
<entry key="executor" value-ref="e