Announcement Announcement Module
Collapse
No announcement yet.
Target object of type [X] has no eligible methods for handling Messages Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Target object of type [X] has no eligible methods for handling Messages

    Hi,

    I'm trying to write a simple app that will use a jdbc:inbound-channel-adapter with a poller to periodically read a set of rows from a database and transform them for writing to a file for another app to ingest. I'm getting the following stack trace when I load my war file into JBoss:

    Caused by: java.lang.IllegalArgumentException: Target object of type [class com.mt.ecom.alias.transformer.AliasTransformer] has no eligible methods for handling Messages.
    at org.springframework.util.Assert.notEmpty(Assert.ja va:294) [spring-core-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.findHandlerMethodsForTarget(Messag ingMethodInvokerHelper.java:352) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.<init>(MessagingMethodInvokerHelpe r.java:169) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.<init>(MessagingMethodInvokerHelpe r.java:107) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.util.MessagingMeth odInvokerHelper.<init>(MessagingMethodInvokerHelpe r.java:111) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.handler.MethodInvo kingMessageProcessor.<init>(MethodInvokingMessageP rocessor.java:48) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.transformer.Method InvokingTransformer.<init>(MethodInvokingTransform er.java:39) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.config.Transformer FactoryBean.createMethodInvokingHandler(Transforme rFactoryBean.java:49) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.config.AbstractSta ndardMessageHandlerFactoryBean.createHandler(Abstr actStandardMessageHandlerFactoryBean.java:72) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.config.AbstractSim pleMessageHandlerFactoryBean.createHandlerInternal (AbstractSimpleMessageHandlerFactoryBean.java:99) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.config.AbstractSim pleMessageHandlerFactoryBean.getObject(AbstractSim pleMessageHandlerFactoryBean.java:81) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.integration.config.AbstractSim pleMessageHandlerFactoryBean.getObject(AbstractSim pleMessageHandlerFactoryBean.java:38) [spring-integration-core-2.2.3.RELEASE.jar:]
    at org.springframework.beans.factory.support.FactoryB eanRegistrySupport.doGetObjectFromFactoryBean(Fact oryBeanRegistrySupport.java:142) [spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
    ... 28 more
    My config looks like:

    Code:
     <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/integration"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:beans="http://www.springframework.org/schema/beans"
        xmlns:jdbc="http://www.springframework.org/schema/integration/jdbc"
        xmlns:file="http://www.springframework.org/schema/integration/file"
        xmlns:lang="http://www.springframework.org/schema/lang"
        xsi:schemaLocation="http://www.springframework.org/schema/integration
    			http://www.springframework.org/schema/integration/spring-integration.xsd
    			http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans.xsd
                http://www.springframework.org/schema/integration/jdbc
                http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd 
    			http://www.springframework.org/schema/integration/file
    			http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
    			http://www.springframework.org/schema/lang
    			http://www.springframework.org/schema/lang/spring-lang-3.0.xsd">
    			
    	<beans:import resource="classpath:alias-management-properties.xml" />
    
    	<beans:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
            
        <beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <beans:property name="driverClassName" value="${jdbc.driverClassName}" />
            <beans:property name="url" value="${jdbc.url}" />
            <beans:property name="username" value="${jdbc.username}" />
            <beans:property name="password" value="${jdbc.password}" />
        </beans:bean>    
        
        <beans:bean id="rowMapper" class="com.mt.ecom.alias.dao.AliasMapper" />           
            
        <jdbc:inbound-channel-adapter id="aliasManagementChannelAdapter" query="${aliasManagementQuery}"
            channel="inputChannel" data-source="dataSource" row-mapper="rowMapper" >
            <poller cron="0 0 0/5 * * *" />
        </jdbc:inbound-channel-adapter>
        
        <file:outbound-channel-adapter id="filesOut" directory="c:\alias\" filename-generator="filenameGenerator" />
            
        <beans:bean id="filenameGenerator" class="com.mt.ecom.alias.generator.FilenameGenerator" />
    </beans:beans>
    and

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/integration"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:beans="http://www.springframework.org/schema/beans"
        xmlns:file="http://www.springframework.org/schema/integration/file"
        xmlns:lang="http://www.springframework.org/schema/lang"
        xsi:schemaLocation="http://www.springframework.org/schema/integration
    			http://www.springframework.org/schema/integration/spring-integration.xsd
    			http://www.springframework.org/schema/beans
    			http://www.springframework.org/schema/beans/spring-beans.xsd
    			http://www.springframework.org/schema/integration/file
    			http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
    			http://www.springframework.org/schema/lang
    			http://www.springframework.org/schema/lang/spring-lang-3.0.xsd">
    			
    	<beans:import resource="classpath:alias-management-properties.xml" />
    
    	<beans:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
    
        <channel id="inputChannel" />    
    	
    	<beans:bean id="aliasTransformer" class="com.mt.ecom.alias.transformer.AliasTransformer" />
    	
    	<transformer input-channel="inputChannel" ref="aliasTransformer" method="transform" output-channel="filesOut" />
    </beans:beans>
    and my AliasTransformer.java code is:

    Code:
    package com.mt.ecom.alias.transformer;
    
    import java.util.List;
    
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.springframework.integration.annotation.Transformer;
    
    import com.mt.ecom.alias.dao.Alias;
    
    public class AliasTransformer
    {
        @Transformer
        String transform(List<Alias> inList)
        {
            Log LOG = LogFactory.getLog(AliasTransformer.class);
    
            LOG.info("Transforming the alias message.");
            
            StringBuffer retVal = new StringBuffer();
            
            return retVal.toString();
        }
    }
    My RowMapper just takes the two columsn from the SQL query and puts them in the Alias object.

    Can someone tell me what is wrong with the Transformer? What data type is it expecting?

  • #2
    The transform() method needs to be public.

    Comment


    • #3
      Thanks! That was it exactly!

      Comment

      Working...
      X