Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError when running Tests or Tomcat targets #28

Closed
hoserdude opened this issue Aug 9, 2013 · 5 comments
Closed

NoClassDefFoundError when running Tests or Tomcat targets #28

hoserdude opened this issue Aug 9, 2013 · 5 comments

Comments

@hoserdude
Copy link

Ran the tomcat7 target and it crashed with the following stack. Tried running a mvn clean install and the tests failed with the same NoClassDefFoundError. I thought that I may have a bad mix of Spring components in my repo so I blew it away and started fresh, same deal.

INFO  ContextLoader - Root WebApplicationContext: initialization started
INFO  XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Fri Aug 09 08:41:44 PDT 2013]; root of context hierarchy
INFO  XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [spring/business-config.xml]
INFO  XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [spring/datasource-config.xml]
INFO  XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [spring/tools-config.xml]
ERROR ContextLoader - Context initialization failed
java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDefinitionException
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.6.0_51]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2475) ~[na:1.6.0_51]
at java.lang.Class.getDeclaredMethods(Class.java:1818) ~[na:1.6.0_51]
at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159) ~[spring-core-3.1.4.RELEASE.jar:3.1.4.RELEASE]
@hoserdude
Copy link
Author

I figured it out - added spring-core and spring-beans to the pom and that seemed to get things up and running. I've updated my fork with this change. hoserdude@c5bbd91

@michaelisvy
Copy link

Hi,
thanks for your feedback.
spring-beans and spring-core are transitive dependencies so they shouldn't be needed.
However, you're not the first one who mentions about this issue ( @cyrille-leclerc had this issue as well).
It seems like a Maven issue. Which version of Maven and which OS are you using?

Thanks,
Michael.

@cyrille-leclerc
Copy link
Contributor

Hi @michaelisvy, I created Pull Request #29. I had to support a CloudBees customer this week who had the same problem.

PR #29 may be a bit verbose but it is standard Maven and it has fixed the ClassNotFoundException in all the support cases I faced at CloudBees.

@hoserdude
Copy link
Author

☁ spring-petclinic [master] mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
Java version: 1.6.0_51
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.8.4" arch: "x86_64" Family: "mac"

I will update to 3.10, undo my changes and see if that works.

@hoserdude
Copy link
Author

Good news, that seemed to work without a hitch. Upgraded to 3.1.0, Maven re-downloaded the internet and the build/test went through.

mariusoe pushed a commit to JonasKunz/spring-petclinic that referenced this issue May 11, 2021
dwinchell pushed a commit to dwinchell/spring-petclinic that referenced this issue Sep 27, 2022
* Added section for vulnerability scanning

* Changed workflow ref back to main since PR is in for github workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants