Announcement Announcement Module
Collapse
No announcement yet.
spring OXM multiple JAXB interfaces problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring OXM multiple JAXB interfaces problem

    Hi,

    we have large application and there is a need to create and send XML to external systems. so we have Spring OXM with JAXB configuration in our spring integration module.

    we have 2 different schemas and there is no relationship between them. we configured 2 different JAXB marshallers/unMarsahllers accordingly. The configuration looks like this.

    <oxm:jaxb2-marshaller id="MarshallerForSchema1">
    <oxm:class-to-be-bound name ="com.abc..ClassA"/>
    <oxm:class-to-be-bound name="com.abc.ClassB"/>
    </oxm:jaxb2-marshaller>

    <oxm:jaxb2-marshaller id="MarshallerForSchema2">
    <oxm:class-to-be-bound name="com.XYZ.ClassX"/>
    </oxm:jaxb2-marshaller>


    <bean id="MessageAdapterForSchema1"
    class="com.schemaone.TestAdapterForSchema1">
    <property name="marshaller" ref="MarshallerForSchema1"/>
    <property name="unmarshaller" ref="MarshallerForSchema1"/>
    </bean>

    <bean id="MessageAdapterForSchema2"
    class="com.schematwo.TestAdapterForSchema2">
    <property name="marshaller" ref="MarshallerForSchema2"/>
    <property name="unmarshaller" ref="MarshallerForSchema2"/>
    </bean>


    TestAdapterForSchema1 and TestAdapterForSchema2 are integration transformers which uses marshaller to generate xml.

    when i compile and run my server, I get following exceptions:

    INFO: Initializing Spring root WebApplicationContext
    Dec 22 10:15:16,808 ERROR ContextLoader - Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.integration.handler.MessageHa ndlerChain#1': Cannot resolve reference to bean 'org.springframework.integration.config.Transforme rFactoryBean#14d8840' while setting bean property 'handlers' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.integration.config.Transforme rFactoryBean#14d8840': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Target object of type [class com.schemaone.TestAdapterForSchema1] has no eligible methods for handling Messages.
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:106)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveManagedList(BeanDefinit ionValueResolver.java:353)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:153)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1325)
    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)
    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.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3934)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4429)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:526)
    at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:630)
    at org.apache.catalina.startup.HostConfig.deployDescr iptors(HostConfig.java:556)
    at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:491)
    at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1206)
    at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:314)
    at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:722)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:583)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:413)
Working...
X