Announcement Announcement Module
Collapse
No announcement yet.
int-mail:outbound-channel-adapter - no matching editors or conversion strategy found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • int-mail:outbound-channel-adapter - no matching editors or conversion strategy found

    Hi Team,
    While trying to implement the Spring Integration Mail , I came across the below exception.

    no matching editors or conversion strategy found
    Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'handlers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type

    Stack Trace -
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.integration.handler.MessageHa ndlerChain#0': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'handlers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.endpoint.EventDriv enConsumer] to required type [org.springframework.integration.core.MessageHandle r] for property 'handlers[1]': no matching editors or conversion strategy found
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:527)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:84)
    at org.springframework.test.context.support.AbstractG enericContextLoader.loadContext(AbstractGenericCon textLoader.java:1)
    at org.springframework.test.context.TestContext.loadA pplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getAp plicationContext(TestContext.java:304)
    ... 30 more
    Caused by: org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'handlers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.endpoint.EventDriv enConsumer] to required type [org.springframework.integration.core.MessageHandle r] for property 'handlers[1]': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertI fNecessary(BeanWrapperImpl.java:462)
    at org.springframework.beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:499)
    at org.springframework.beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:493)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.convertForProperty(Abst ractAutowireCapableBeanFactory.java:1371)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1330)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
    ... 42 more
    Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.endpoint.EventDriv enConsumer] to required type [org.springframework.integration.core.MessageHandle r] for property 'handlers[1]': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:231)
    at org.springframework.beans.TypeConverterDelegate.co nvertToTypedCollection(TypeConverterDelegate.java: 520)
    at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:173)
    at org.springframework.beans.BeanWrapperImpl.convertI fNecessary(BeanWrapperImpl.java:447)


    Config File-
    Code:
    <bean id="placeholderProperties"
                    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                    <property name="location" value="classpath:int-mail.properties" />
                    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
                    <property name="ignoreUnresolvablePlaceholders" value="true" />
            </bean>
    
            <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
                    <property name="host" value="${mail.smtp.host}" />
                    <property name="port" value="${mail.smtp.port}" />
                    <property name="username" value="${mail.user}" />
                    <property name="password" value="${mail.password}" />
    
                    <property name="javaMailProperties">
                            <props>
                                    <prop key="mail.smtp.auth">${mail.smtp.userAuth}</prop>
                                    <prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop>
                            </props>
                    </property>
            </bean>
    
            <int:chain input-channel="com.hcl.mail.outbound">
                    <int-mail:header-enricher>
                            <int-mail:subject value="${mail.subject}" />
                            <int-mail:to value="${mail.to}" />
                    </int-mail:header-enricher>
                    <int-mail:outbound-channel-adapter
                            id="mailoutbound" mail-sender="mailSender" />
            </int:chain>
    
    
            <int:channel id="com.hcl.mail.outbound">
                    <int:interceptors>
                            <int:wire-tap channel="logger" />
                    </int:interceptors>
            </int:channel>
    
    
            <int:logging-channel-adapter id="logger"
                    level="DEBUG" />

    Appreciate if somebody could help me resolve the issue.

    Regards,
    PD

  • #2
    Hi!

    Your issue is about wrong version of Spring Integarion and it comes from <outbound-channel-adapter> within <chain>.
    It was fixed: https://jira.springsource.org/browse/INT-2275

    Cheers,
    Artem

    Comment


    • #3
      Hi Artem, Thanks for the reply.

      Which version of Spring Integration should i be using? I'm currently using 2.1.5.RELEASE
      I couldn't figure it out from the link you provided.

      Regards,
      PD

      Comment


      • #4
        Which version of Spring Integration should i be using?
        The latest one: http://www.springsource.org/spring-integration#maven

        I couldn't figure it out from the link you provided.
        Fix Version/s JIRA ticket attribute.

        Comment


        • #5
          Hi Artem,
          After updating spring-integration-core to 2.2.4.RELEASE , something broke.
          Not sure if there is a jar conflict happening.

          Getting the below exception -

          org.springframework.core.annotation.AnnotationUtil s.getAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/ClassLjava/lang/annotation/Annotation;

          Regards,
          PD

          Comment


          • #6
            Had faced the same issue while trying to migrate to the latest version for all Spring Integration jars.

            Code:
            <properties>
                            <maven.test.failure.ignore>true</maven.test.failure.ignore>
                            <spring.framework.version>3.0.5.RELEASE</spring.framework.version>
                            <spring.integration.version>2.1.5.RELEASE</spring.integration.version>
            </properties>
            All i do is update the version to 2.2.4.RELEASE

            Regards,
            PD

            Comment


            • #7
              After updating spring-integration-core to 2.2.4.RELEASE
              It's not enough: you have to upgrade all your Spring Integration jars, e.g. spring-integration-mail.

              Getting the below exception -
              It's not clear now. However let me guess: you have in your CLASSPATH several version of Spring Framework jars. Get rid this issue!
              Of course, you can show here more StackTrace. And maybe I can help

              Comment


              • #8
                Had faced the same issue while trying to migrate to the latest version for all Spring Integration jars.
                OK, investigate, please, your CLASSPATH. The maven might not clean it.

                Comment


                • #9
                  Hi Artem,
                  Also tried creating a new project and building, still the same issue.

                  Stack Trace-
                  [INFO] Scanning for projects...
                  [INFO]
                  [INFO] ------------------------------------------------------------------------
                  [INFO] Building MailSender 1.0.0-SNAPSHOT
                  [INFO] ------------------------------------------------------------------------
                  [INFO]
                  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ MailSender ---
                  [debug] execute contextualize
                  [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
                  [INFO] Copying 4 resources
                  [INFO]
                  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ MailSender ---
                  [INFO] Nothing to compile - all classes are up to date
                  [INFO]
                  [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ MailSender ---
                  [debug] execute contextualize
                  [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
                  [INFO] Copying 1 resource
                  [INFO]
                  [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ MailSender ---
                  [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
                  [INFO] Compiling 1 source file to H:\SpringWorkArea\MailSender\target\test-classes
                  [INFO]
                  [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ MailSender ---
                  [INFO] Surefire report directory: H:\SpringWorkArea\MailSender\target\surefire-reports

                  -------------------------------------------------------
                  T E S T S
                  -------------------------------------------------------
                  Running com.hcl.mail.sender.test.MailSenderTest
                  [23.07.2013 04:59:07] DEBUG: SpringJUnit4ClassRunner.<init>() - SpringJUnit4ClassRunner constructor called with [class com.hcl.mail.sender.test.MailSenderTest].
                  Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.448 sec <<< FAILURE!

                  Results :

                  Tests in error:
                  initializationError(com.hcl.mail.sender.test.MailS enderTest): org/springframework/core/env/EnvironmentCapable

                  Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

                  [ERROR] There are test failures.

                  Please refer to H:\SpringWorkArea\MailSender\target\surefire-reports for the individual test results.
                  [INFO]
                  [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ MailSender ---
                  [INFO] Building jar: H:\SpringWorkArea\MailSender\target\MailSender-1.0.0-SNAPSHOT.jar
                  [INFO]
                  [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ MailSender ---
                  [INFO] Installing H:\SpringWorkArea\MailSender\target\MailSender-1.0.0-SNAPSHOT.jar to H:\config\.m2\repository\com\hcl\mail\sender\MailS ender\1.0.0-SNAPSHOT\MailSender-1.0.0-SNAPSHOT.jar
                  [INFO] Installing H:\SpringWorkArea\MailSender\pom.xml to H:\config\.m2\repository\com\hcl\mail\sender\MailS ender\1.0.0-SNAPSHOT\MailSender-1.0.0-SNAPSHOT.pom
                  [INFO] ------------------------------------------------------------------------
                  [INFO] BUILD SUCCESS
                  [INFO] ------------------------------------------------------------------------
                  [INFO] Total time: 1:47.893s
                  [INFO] Finished at: Tue Jul 23 04:59:22 EDT 2013
                  [INFO] Final Memory: 16M/156M
                  [INFO] ------------------------------------------------------------------------
                  Project ClassPath-
                  Code:
                  <?xml version="1.0" encoding="UTF-8"?>
                  <classpath>
                          <classpathentry kind="src" output="target/classes" path="src/main/java">
                                  <attributes>
                                          <attribute name="optional" value="true"/>
                                          <attribute name="maven.pomderived" value="true"/>
                                  </attributes>
                          </classpathentry>
                          <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
                                  <attributes>
                                          <attribute name="maven.pomderived" value="true"/>
                                  </attributes>
                          </classpathentry>
                          <classpathentry kind="src" output="target/test-classes" path="src/test/java">
                                  <attributes>
                                          <attribute name="optional" value="true"/>
                                          <attribute name="maven.pomderived" value="true"/>
                                  </attributes>
                          </classpathentry>
                          <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
                                  <attributes>
                                          <attribute name="maven.pomderived" value="true"/>
                                  </attributes>
                          </classpathentry>
                          <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
                                  <attributes>
                                          <attribute name="maven.pomderived" value="true"/>
                                  </attributes>
                          </classpathentry>
                          <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
                                  <attributes>
                                          <attribute name="maven.pomderived" value="true"/>
                                  </attributes>
                          </classpathentry>
                          <classpathentry kind="output" path="target/classes"/>
                  </classpath>
                  Regards,
                  PD

                  Comment


                  • #10
                    I'm not well with maven test plugin.
                    But if it says that you have errors, why don't show them from surefire-report here?

                    Comment


                    • #11
                      surefire-report says - java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable

                      Stack Trace below-

                      -------------------------------------------------------------------------------
                      Test set: com.hcl.mail.sender.test.MailSenderTest
                      -------------------------------------------------------------------------------
                      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.448 sec <<< FAILURE!
                      initializationError(com.hcl.mail.sender.test.MailS enderTest) Time elapsed: 0.039 sec <<< ERROR!
                      java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable
                      at java.lang.ClassLoader.defineClass1(Native Method)
                      at java.lang.ClassLoader.defineClass(ClassLoader.java :791)
                      at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:142)
                      at java.net.URLClassLoader.defineClass(URLClassLoader .java:449)
                      at java.net.URLClassLoader.access$100(URLClassLoader. java:71)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java: 361)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java: 355)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(URLClassLoader.j ava:354)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:4 23)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:308)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:3 56)
                      at java.lang.ClassLoader.defineClass1(Native Method)
                      at java.lang.ClassLoader.defineClass(ClassLoader.java :791)
                      at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:142)
                      at java.net.URLClassLoader.defineClass(URLClassLoader .java:449)
                      at java.net.URLClassLoader.access$100(URLClassLoader. java:71)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java: 361)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java: 355)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(URLClassLoader.j ava:354)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:4 23)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:308)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:3 56)
                      at java.lang.Class.getDeclaredConstructors0(Native Method)
                      at java.lang.Class.privateGetDeclaredConstructors(Cla ss.java:2413)
                      at java.lang.Class.getConstructor0(Class.java:2723)
                      at java.lang.Class.getDeclaredConstructor(Class.java: 2004)
                      at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:104)
                      at org.springframework.test.context.TestContext.<init >(TestContext.java:123)
                      at org.springframework.test.context.TestContextManage r.<init>(TestContextManager.java:117)
                      at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.createTestContextManager(SpringJUnit 4ClassRunner.java:120)
                      at org.springframework.test.context.junit4.SpringJUni t4ClassRunner.<init>(SpringJUnit4ClassRunner.java: 108)
                      at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
                      at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:57)
                      at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:45)
                      at java.lang.reflect.Constructor.newInstance(Construc tor.java:525)
                      at org.junit.internal.builders.AnnotatedBuilder.build Runner(AnnotatedBuilder.java:31)
                      at org.junit.internal.builders.AnnotatedBuilder.runne rForClass(AnnotatedBuilder.java:24)
                      at org.junit.runners.model.RunnerBuilder.safeRunnerFo rClass(RunnerBuilder.java:57)
                      at org.junit.internal.builders.AllDefaultPossibilitie sBuilder.runnerForClass(AllDefaultPossibilitiesBui lder.java:29)
                      at org.junit.runners.model.RunnerBuilder.safeRunnerFo rClass(RunnerBuilder.java:57)
                      at org.junit.internal.requests.ClassRequest.getRunner (ClassRequest.java:24)
                      at org.apache.maven.surefire.junit4.JUnit4TestSet.exe cute(JUnit4TestSet.java:51)
                      at org.apache.maven.surefire.junit4.JUnit4Provider.ex ecuteTestSet(JUnit4Provider.java:123)
                      at org.apache.maven.surefire.junit4.JUnit4Provider.in voke(JUnit4Provider.java:104)
                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
                      at java.lang.reflect.Method.invoke(Method.java:601)
                      at org.apache.maven.surefire.util.ReflectionUtils.inv okeMethodWithArray(ReflectionUtils.java:164)
                      at org.apache.maven.surefire.booter.ProviderFactory$P roviderProxy.invoke(ProviderFactory.java:110)
                      at org.apache.maven.surefire.booter.SurefireStarter.i nvokeProvider(SurefireStarter.java:175)
                      at org.apache.maven.surefire.booter.SurefireStarter.r unSuitesInProcessWhenForked(SurefireStarter.java:1 07)
                      at org.apache.maven.surefire.booter.ForkedBooter.main (ForkedBooter.java:68)
                      Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable
                      at java.net.URLClassLoader$1.run(URLClassLoader.java: 366)
                      at java.net.URLClassLoader$1.run(URLClassLoader.java: 355)
                      at java.security.AccessController.doPrivileged(Native Method)
                      at java.net.URLClassLoader.findClass(URLClassLoader.j ava:354)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:4 23)
                      at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:308)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:3 56)
                      ... 55 more
                      Regards,
                      PD

                      Comment


                      • #12
                        Artem,
                        OK, investigate, please, your CLASSPATH. The maven might not clean it.
                        You meant the Project class path itself right? I do not see versions of jars.
                        Am i missing something?

                        Comment


                        • #13
                          java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable
                          Was introduced in Spring 3.1. So upgrade to it or event to the 3.2.
                          I see above you use 3.0.5 in your maven config, but let me guess, your IDE gets this class somwhere from its repository and allows you to use it in your sources, but maven compiler uses exectly what you configure for it. And you end up with similar issue.

                          Comment


                          • #14
                            Hi Artem,
                            Have updated both Spring Framework and Spring Integration to latest. The issue is gone.

                            But sts is showing exceptions in pom -
                            Lifecycle mapping "org.eclipse.m2e.jdt.JarLifecycleMapping" is not available. To enable full functionality, install the lifecycle mapping and run Maven->Update Project Configuration.
                            Also unable to view the jars under maven dependency package, there is no Maven Dependency package itself.

                            Appreciate if you could help resolve the issue.

                            Regards,
                            PD

                            Comment


                            • #15
                              But sts is showing exceptions in pom
                              Sorry, I'm not well with STS at all. I'm using IntelliJ IDEA. However it has its own issues and with maven, and with gradle too

                              Comment

                              Working...
                              X