[GRADLE-2184] Regression: Spring application context creation fails with org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer$AmbiguousBindingException: Still 2 unbound args at this(),target(),args( ) binding stage, with no way to determine between them Created: 20/Mar/12  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-9
Fix Version/s: None

Type: Bug
Reporter: mech Assignee: Unassigned
Resolution: Won't Fix Votes: 1


 Description   

After upgrading from Gradle 1.0 milestone 8 to milestone 9 our web application (started via tomcat-gradle-plugin) or any Junit test case requiring Spring fails with the following exception:

reason: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springDataSourceB
eanPostProcessor' defined in class path resource [net/bull/javamelody/monitoring-spring.xml]: BeanPostProcessor before instantiation of bean failed; nested exce
ption is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'monitoringAdvisor' defined in class path resource [net/bull/jav
amelody/monitoring-spring.xml]: Cannot create inner bean 'net.bull.javamelody.MonitoredWithAnnotationPointcut#b85c3e6' of type [net.bull.javamelody.MonitoredWit
hAnnotationPointcut] while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean wi
th name 'net.bull.javamelody.MonitoredWithAnnotationPointcut#b85c3e6' defined in class path resource [net/bull/javamelody/monitoring-spring.xml]: BeanPostProces
sor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springf
ramework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttri
buteSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creat
ing bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': BeanPostProcessor before instantiation of bean failed; n
ested exception is org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer$AmbiguousBindingException: Still 2 unbound args at this(),target(),args(
) binding stage, with no way to determine between them, StackTrace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spri
ngDataSourceBeanPostProcessor' defined in class path resource [net/bull/javamelody/monitoring-spring.xml]: BeanPostProcessor before instantiation of bean failed
; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'monitoringAdvisor' defined in class path resource
[net/bull/javamelody/monitoring-spring.xml]: Cannot create inner bean 'net.bull.javamelody.MonitoredWithAnnotationPointcut#b85c3e6' of type [net.bull.javamelody
.MonitoredWithAnnotationPointcut] while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error cre
ating bean with name 'net.bull.javamelody.MonitoredWithAnnotationPointcut#b85c3e6' defined in class path resource [net/bull/javamelody/monitoring-spring.xml]: B
eanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTra
nsactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException
: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': BeanPostProcessor before instantiation of b
ean failed; nested exception is org.springframework.aop.aspectj.AspectJAdviceParameterNameDiscoverer$AmbiguousBindingException: Still 2 unbound args at this(),t
arget(),args() binding stage, with no way to determine between them
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:452)
        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:197)
        at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:740)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:449)

Note that this issue does not appear for Milestone 8 (8a appears fine, too).
It is not related to Javamelody (removing it from the project will render the same exception for some other arbitrary bean).

Probably it is some new form of classpath issue recently introduced causing this abiguity.

Please note that we had to use the following to get around JPA2 classpath/entity scanning issues (GRADLE-1960) introduced since Milestone 6 coming from Milestone 3/4:

buildDir = 'target'
sourceSets.main.output.classesDir = "${buildDir}/classes"
sourceSets.test.output.classesDir = "${buildDir}/test-classes"
sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir
sourceSets.test.output.resourcesDir = sourceSets.test.output.classesDir

Please let me know if I can add more details to diagnose this. Currently I have no good idea how to track this down. Workaround: stick to milestone 8.



 Comments   
Comment by mech [ 31/May/12 ]

Not sure what was changed recently. But upgrading to GRADLE 1.0rc3 solves the problem for us, also rc2 appears to work. Hence you may close this Jira issue, if you like, and set fix version to rc2.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:15:00 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.