Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » greenpages failing unit tests(java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory)
greenpages failing unit tests [message #885704] Wed, 13 June 2012 13:07 Go to next message
Jay Flowers is currently offline Jay FlowersFriend
Messages: 9
Registered: June 2012
Junior Member
For both the unit tests in the greenpages sample application the unit tests fail with this message:

greenpages.jpa.JpaDirectorySpringContextTests.initializationError
greenpages.web.GreenPagesSpringContextTests.initializationError

Error Message

org/apache/commons/logging/LogFactory
Stacktrace

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<clinit>(SpringJUnit4ClassRunner.java:90)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:234)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
Re: greenpages failing unit tests [message #885731 is a reply to message #885704] Wed, 13 June 2012 13:50 Go to previous messageGo to next message
Jay Flowers is currently offline Jay FlowersFriend
Messages: 9
Registered: June 2012
Junior Member
I found that this was caused by a missing dep in both projects:


<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>com.springsource.org.apache.commons.logging</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>


I also found that I had to correct the path to the sql file in both project's test context to:

<constructor-arg value="file:../db/db.sql"/>

it was:

<constructor-arg value="file:../../db/db.sql"/>
Re: greenpages failing unit tests [message #885737 is a reply to message #885731] Wed, 13 June 2012 14:08 Go to previous messageGo to next message
Jay Flowers is currently offline Jay FlowersFriend
Messages: 9
Registered: June 2012
Junior Member
I also found that the web tests where failing cause they could not find the servlet config. I had to correct the path to the config in this test:

greenpages.web\src\test\java\greenpages\web\GreenPagesSpringContextTests.java

corrected to this:

@ContextConfiguration(locations = { "classpath*:/META-INF/spring/module-context.xml", "file:src/main/resources/WEB-INF/greenpages-servlet.xml", "classpath:/META-INF/spring/test-context.xml" })

it was:

@ContextConfiguration(locations = { "classpath*:/META-INF/spring/module-context.xml", "file:src/main/webapp/WEB-INF/greenpages-servlet.xml", "classpath:/META-INF/spring/test-context.xml" })
Re: greenpages failing unit tests [message #885759 is a reply to message #885737] Wed, 13 June 2012 14:41 Go to previous messageGo to next message
Jay Flowers is currently offline Jay FlowersFriend
Messages: 9
Registered: June 2012
Junior Member
Okay all the tests are working after this last change.

I had to add a missing test dependency to the web project:

<dependency>
<groupId>javax.persistence</groupId>
<artifactId>com.springsource.javax.persistence</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>


I was getting:

error can't determine implemented interfaces of missing type javax.persistence.spi.PersistenceUnitTransactionType
Re: greenpages failing unit tests [message #886252 is a reply to message #885759] Thu, 14 June 2012 14:49 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Hmmm. Firstly, please could you confirm that you are trying to build from a Greenpages zip downloaded from the Virgo site. (Building the git repository directly is not intended for users - see IMPORTANT-INFORMATION-FOR-USERS.txt.)

Secondly, what version are you trying with what version of Virgo?
Re: greenpages failing unit tests [message #1089909 is a reply to message #885704] Mon, 19 August 2013 12:22 Go to previous messageGo to next message
Stijn Lambert is currently offline Stijn LambertFriend
Messages: 2
Registered: August 2013
Junior Member
I had to make the same modifications to make the unit tests work, except the last one (com.springsource.javax.persistence dependency).

I'm using Greenpages 3.0.0.RELEASE with Virgo 3.6.2.RELEASE.
Re: greenpages failing unit tests [message #1089931 is a reply to message #886252] Mon, 19 August 2013 13:07 Go to previous message
Stijn Lambert is currently offline Stijn LambertFriend
Messages: 2
Registered: August 2013
Junior Member
To run them from Maven though, I also had to add the com.springsource.javax.persistence dependency.
Previous Topic:Too low performance of legacy WAR-application
Next Topic:can not deploy CXF 1.3.1 on Virgo 3.5
Goto Forum:
  


Current Time: Fri Mar 29 14:21:13 GMT 2024

Powered by FUDForum. Page generated in 0.02596 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top