title: Could not resolve matching constructor but constructor seem fine
body: <p>We currently have an application that uses a class called JmsComponentMessageDispatcher to look after putting messages on to queues here is the constructor.</p>
  
  <pre><code>public JmsComponentMessageDispatcher(ConnectionFactory cf, FileDataAccess access, 
          List&lt;Destination&gt; destinations)
  {
      if (cf == null)
          throw new NullPointerException();
      if (access == null)
          throw new NullPointerException();
      if (destinations == null)
          throw new NullPointerException();
      m_cf = cf;
      m_access = access;
      m_destinations = Collections.unmodifiableList(destinations);
  }
  
  public JmsComponentMessageDispatcher(ConnectionFactory cf, FileDataAccess access, Destination destination)
  {
      this(cf, access, Collections.singletonList(destination));
  }
  
  public JmsComponentMessageDispatcher(ConnectionFactory cf, FileDataAccess access)
  {
      this(cf, access, Collections.&lt;Destination&gt;emptyList());
  }
  </code></pre>
  
  <p>Normally this would be setup in the application context</p>
  
  <pre><code>    &lt;bean id="componentMessageDispatcher" abstract="true" 
      class="com.core.jms.JmsComponentMessageDispatcher" scope="prototype"
      c:_0-ref="jmsCF"
      c:_1-ref="fileDataAccess"/&gt; 
  </code></pre>
  
  <p>We are porting our application to weblogic and for some reason weblogic intermittently loads the wrong concrete class for the connection factory.  See here: <a href="https://stackoverflow.com/questions/33957719/a-jms-xa-connection-factory-injected-using-spring-jee-jndi-lookup-behaves-differ">A JMS XA connection factory injected using spring jee-jndi lookup behaves differently than @Resource injection on Weblogic 12c</a></p>
  
  <p>To try and work round this issue I plan to inject the connection factory using @Resource.<br>
  I created a new class WeblogicJmsComponentMessageDispatcher that extends JmsComponentMessageDispatcher.  It simply takes in a bean as parameter this bean has the connection factory loaded using @Resource.</p>
  
  <pre><code>public class WeblogicJmsComponentMessageDispatcher extends 
  
  JmsComponentMessageDispatcher
  {
      public WeblogicJmsComponentMessageDispatcher(WeblogicConnectionFactoryLocal wcf, FileDataAccess access)
      {
          super(wcf.getConnectionFactory(), access, Collections.&lt;Destination&gt;emptyList());
      }
  }
  </code></pre>
  
  <p>bean:</p>
  
  <pre><code>@Stateless(name="WeblogicConnectionFactoryBean")
  @Local(WeblogicConnectionFactoryLocal.class)
  public class WeblogicConnectionFactoryBean implements WeblogicConnectionFactoryLocal{
  
      @Resource(mappedName="jms/mf_ConnectionFactory")    
      private ConnectionFactory m_cf;
  
      public ConnectionFactory getConnectionFactory()
      {
          return m_cf;
      }
  </code></pre>
  
  <p>Application Context:</p>
  
  <pre><code>&lt;beans profile="weblogic"&gt;  
      &lt;bean id="componentMessageDispatcher" class="com.core.jms.WeblogicJmsComponentMessageDispatcher"&gt;
          &lt;constructor-arg name="wcf" ref="wlCF"/&gt;
          &lt;constructor-arg name="access" ref="fileDataAccess"/&gt;
      &lt;/bean&gt;
  
      &lt;jee:local-slsb id="wlCF" jndi-name="java:module/WeblogicConnectionFactoryBean!com.core.jms.WeblogicConnectionFactoryLocal"
          business-interface="com.core.jms.WeblogicConnectionFactoryLocal"/&gt;
  </code></pre>
  
  <p>If I step through it in debug, I can see the constructors getting hit and presenting the correct values however I'm getting the Could not resolve matching constructor error.</p>
  
  <pre><code>&lt;12-Jan-2016 11:28:58 o'clock GMT&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;WL-149265&gt; &lt;Failure occurred in the execution of deployment request with ID "701665806559063" for task "25". Error is: "weblogic.application.ModuleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'componentMessageDispatcher$child#1959023' defined in class path resource [application-context.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)"
  weblogic.application.ModuleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'componentMessageDispatcher$child#1959023' defined in class path resource [application-context.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
      at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
      at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
      at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:73)
      at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
      at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
      at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
      at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
      at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
      at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
      at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:587)
      at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
      at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
      at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
      at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
      at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
      at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
      at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
      at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
  Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'componentMessageDispatcher$child#1959023' defined in class path resource [application-context.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:250)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:110)
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
      at org.springframework.context.access.ContextSingletonBeanFactoryLocator.initializeDefinition(ContextSingletonBeanFactoryLocator.java:143)
      at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:381)
      at org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.getBeanFactoryReference(SpringBeanAutowiringInterceptor.java:156)
      at org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.getBeanFactory(SpringBeanAutowiringInterceptor.java:137)
      at org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.doAutowireBean(SpringBeanAutowiringInterceptor.java:117)
      at org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.autowireBean(SpringBeanAutowiringInterceptor.java:97)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.oracle.pitchfork.inject.Jsr250Metadata.invokeLifecycleMethod(Jsr250Metadata.java:377)
      at com.oracle.pitchfork.intercept.LifecycleEventCallbackInvocationContext.proceed(LifecycleEventCallbackInvocationContext.java:115)
      at com.oracle.pitchfork.intercept.LifecycleEventCallbackInvocationContext.proceed(LifecycleEventCallbackInvocationContext.java:144)
      at com.oracle.pitchfork.intercept.InterceptionMetadata.invokeLifecycleMethods(InterceptionMetadata.java:463)
      at weblogic.ejb.container.injection.EjbComponentCreatorImpl.invokePostConstruct(EjbComponentCreatorImpl.java:55)
      at weblogic.ejb.container.manager.SingletonSessionManager.constructAndInitBean(SingletonSessionManager.java:330)
      at weblogic.ejb.container.manager.SingletonSessionManager.access$300(SingletonSessionManager.java:62)
      at weblogic.ejb.container.manager.SingletonSessionManager$SingletonLifecycleManager.doActualInit(SingletonSessionManager.java:753)
      at weblogic.ejb.container.manager.SingletonSessionManager$SingletonLifecycleManager.initInternal(SingletonSessionManager.java:701)
      at weblogic.ejb.container.manager.SingletonSessionManager$SingletonLifecycleManager.init(SingletonSessionManager.java:588)
      at weblogic.ejb.container.manager.SingletonSessionManager.init(SingletonSessionManager.java:255)
      at weblogic.ejb.container.manager.SingletonSessionManager.perhapsInit(SingletonSessionManager.java:251)
      at weblogic.ejb.container.deployer.EJBDeployer.start(EJBDeployer.java:968)
      at weblogic.ejb.container.deployer.EJBModule.start(EJBModule.java:597)
      at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
      at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
      at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)
      at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
      at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
      at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:73)
      at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
      at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
      at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
      at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
      at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
      at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
      at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:587)
      at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
      at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
      at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
      at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
      at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
      at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
      at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
      at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
  &gt; 
  </code></pre>
  
  <p>I’ve mocked this up on a small test application and it works perfectly.  So I must have done something incorrectly but for the life of me I can't see what it is.</p>
  
  <p>Any help gratefully received.</p>