Announcement Announcement Module
Collapse
No announcement yet.
JAXBContext bean declaration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JAXBContext bean declaration

    hello,

    i don't know if i

    i am using Jaxb:
    I declare the JaxbContext bean:
    Code:
      <bean id="jaxbContext" class="javax.xml.bind.JAXBContext" factory-method="newInstance"> 
        <constructor-arg value="iam.pagos.xml.jaxb"/>
      </bean>
    When the application init, log:
    Code:
    25 ago 2005 13&#58;15&#58;15,985 INFO org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;222&#41; Creating shared instance of singleton bean 'jaxbContext' 
    25 ago 2005 13&#58;15&#58;15,985 DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;288&#41; Creating instance of bean 'jaxbContext' with merged definition &#91;Root bean with class &#91;javax.xml.bind.JAXBContext&#93; defined in URL &#91;file&#58;C&#58;/wwwroot/PagosXML/Recursos/configContext.xml&#93;&#93; 
    25 ago 2005 13&#58;15&#58;15,985 DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation&#40;AbstractAutowireCapableBeanFactory.java&#58;216&#41; Invoking BeanPostProcessors before instantiation of bean 'jaxbContext' 
    25 ago 2005 13&#58;15&#58;16,032 DEBUG org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod&#40;AbstractAutowireCapableBeanFactory.java&#58;450&#41; Ignoring factory method &#91;public static javax.xml.bind.JAXBContext javax.xml.bind.JAXBContext.newInstance&#40;java.lang.String,java.lang.ClassLoader&#41; throws javax.xml.bind.JAXBException&#93; of bean 'jaxbContext'&#58; could not satisfy dependencies 
    org.springframework.beans.factory.UnsatisfiedDependencyException&#58; Error creating bean with name 'jaxbContext' defined in URL &#91;file&#58;C&#58;/wwwroot/PagosXML/Recursos/configContext.xml&#93;&#58; Unsatisfied dependency expressed through constructor argument with index 1 of type &#91;java.lang.ClassLoader&#93;&#58; Ambiguous constructor argument types - did you specify the correct bean references as generic constructor arguments?
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createArgumentArray&#40;AbstractAutowireCapableBeanFactory.java&#58;671&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod&#40;AbstractAutowireCapableBeanFactory.java&#58;446&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;318&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;226&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getType&#40;AbstractBeanFactory.java&#58;329&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.isBeanTypeMatch&#40;DefaultListableBeanFactory.java&#58;250&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType&#40;DefaultListableBeanFactory.java&#58;156&#41;
    	at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType&#40;AbstractApplicationContext.java&#58;585&#41;
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors&#40;AbstractApplicationContext.java&#58;353&#41;
    	at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;294&#41;
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh&#40;AbstractRefreshableWebApplicationContext.java&#58;134&#41;
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext&#40;ContextLoader.java&#58;230&#41;
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext&#40;ContextLoader.java&#58;156&#41;
    	at org.springframework.web.context.ContextLoaderServlet.init&#40;ContextLoaderServlet.java&#58;81&#41;
    	at javax.servlet.GenericServlet.init&#40;GenericServlet.java&#58;258&#41;
    	at com.ibm.servlet.engine.webapp.StrictServletInstance.doInit&#40;ServletManager.java&#58;802&#41;
    	at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._init&#40;StrictLifecycleServlet.java&#58;141&#41;
    	at com.ibm.servlet.engine.webapp.PreInitializedServletState.init&#40;StrictLifecycleServlet.java&#58;254&#41;
    	at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.init&#40;StrictLifecycleServlet.java&#58;107&#41;
    	at com.ibm.servlet.engine.webapp.ServletInstance.init&#40;ServletManager.java&#58;388&#41;
    	at javax.servlet.GenericServlet.init&#40;GenericServlet.java&#58;258&#41;
    	at com.ibm.servlet.engine.webapp.ServletManager.addServlet&#40;ServletManager.java&#58;84&#41;
    	at com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet&#40;WebAppServletManager.java&#58;211&#41;
    	at com.ibm.servlet.engine.webapp.WebAppServletManager.loadAutoLoadServlets&#40;WebAppServletManager.java&#58;350&#41;
    	at com.ibm.servlet.engine.webapp.WebApp.loadServletManager&#40;WebApp.java&#58;1217&#41;
    	at com.ibm.servlet.engine.webapp.WebApp.init&#40;WebApp.java&#58;145&#41;
    	at com.ibm.servlet.engine.srt.WebGroup.loadWebApp&#40;WebGroup.java&#58;259&#41;
    	at com.ibm.servlet.engine.srt.WebGroup.init&#40;WebGroup.java&#58;168&#41;
    	at com.ibm.servlet.engine.ServletEngine.addWebApplication&#40;ServletEngine.java&#58;857&#41;
    	at com.ibm.ws.runtime.WebContainer.install&#40;WebContainer.java&#58;43&#41;
    	at com.ibm.ws.runtime.Server.startModule&#40;Server.java&#58;618&#41;
    	at com.ibm.ejs.sm.active.ActiveModule.startModule&#40;ActiveModule.java&#58;511&#41;
    	at com.ibm.ejs.sm.active.ActiveModule.startAction&#40;ActiveModule.java&#58;355&#41;
    	at com.ibm.ejs.sm.active.ActiveObject.startObject&#40;ActiveObject.java&#58;948&#41;
    	at com.ibm.ejs.sm.active.ActiveObject.start&#40;ActiveObject.java&#58;137&#41;
    	at com.ibm.ejs.sm.active.ActiveObject.operateOnContainedObjects&#40;ActiveObject.java&#58;815&#41;
    	at com.ibm.ejs.sm.active.ActiveEJBServer.startAction&#40;ActiveEJBServer.java&#58;735&#41;
    	at com.ibm.ejs.sm.active.ActiveObject.startObject&#40;ActiveObject.java&#58;948&#41;
    	at com.ibm.ejs.sm.active.ActiveObject.start&#40;ActiveObject.java&#58;137&#41;
    	at java.lang.reflect.Method.invoke&#40;Native Method&#41;
    	at com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation&#40;AdminAgentImpl.java&#58;93&#41;
    	at com.ibm.ejs.sm.agent.AdminAgentImpl.invokeActiveObject&#40;AdminAgentImpl.java&#58;62&#41;
    	at com.ibm.ejs.sm.agent._AdminAgentImpl_Tie._invoke&#40;_AdminAgentImpl_Tie.java&#58;73&#41;
    	at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch&#40;ExtendedServerDelegate.java&#58;532&#41;
    	at com.ibm.CORBA.iiop.ORB.process&#40;ORB.java&#58;2450&#41;
    	at com.ibm.CORBA.iiop.OrbWorker.run&#40;OrbWorker.java&#58;186&#41;
    	at com.ibm.ejs.oa.pool.ThreadPool$PooledWorker.run&#40;ThreadPool.java&#58;104&#41;
    	at com.ibm.ws.util.CachedThread.run&#40;ThreadPool.java&#58;144&#41;
    it is a debug trace and the applicarion works well, but i don't know if it's important, or how to solve it.

    thanks in advance,
    CÚsar.

  • #2
    JAXBContext has two implementations of newInstance method as you can see here.
    You need to explicitely specify which one to use. Try
    Code:
    <bean id="jaxbContext" class="javax.xml.bind.JAXBContext" factory-method="newInstance"> 
      <constructor-arg index="0" value="iam.pagos.xml.jaxb"/>
    </bean>
    b/w, what Spring version are you using?

    Comment

    Working...
    X