Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Getting Started with Active Objects Tutorial with Confluence - error in unit tests

Yagnesh Bhat
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2015

Hi I am trying to run this tutorial in Confluence 5.7 and sdk 5.0.13

 

https://developer.atlassian.com/docs/atlassian-platform-common-components/active-objects/getting-started-with-active-objects

 

I am using AO 0.20 which is good and the servlet in the above tutorial works fine. 

 

The problem is while running the Test Class mentioned in the last part of step 12, I get these exceptions, highlighted in bold below:

 

Running ut.com.unittest.yagnesh.TodoServiceImplTest
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 3.256 sec <<< FAILURE!
testAdd(ut.com.unittest.yagnesh.TodoServiceImplTest) Time elapsed: 0.195 sec <<< ERROR!
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.of([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;
at net.java.ao.db.HSQLDatabaseProvider.<clinit>(HSQLDatabaseProvider.java:420)
at net.java.ao.builder.SupportedDatabase$8.getDatabaseProvider(SupportedDatabase.java:82)
at net.java.ao.builder.DatabaseProviderFactory.getDatabaseProvider(DatabaseProviderFactory.java:10)
at net.java.ao.builder.EntityManagerBuilderWithDatabaseProperties.build(EntityManagerBuilderWithDatabaseProperties.java:49)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule.createEntityManager(ActiveObjectTransactionMethodRule.java:235)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule.createEntityManagerAndUpdateDatabase(ActiveObjectTransactionMethodRule.java:182)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule.before(ActiveObjectTransactionMethodRule.java:110)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule$1.evaluate(ActiveObjectTransactionMethodRule.java:76)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
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:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

testAll(ut.com.unittest.yagnesh.TodoServiceImplTest) Time elapsed: 0 sec <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class net.java.ao.db.HSQLDatabaseProvider
at net.java.ao.builder.SupportedDatabase$8.getDatabaseProvider(SupportedDatabase.java:82)
at net.java.ao.builder.DatabaseProviderFactory.getDatabaseProvider(DatabaseProviderFactory.java:10)
at net.java.ao.builder.EntityManagerBuilderWithDatabaseProperties.build(EntityManagerBuilderWithDatabaseProperties.java:49)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule.createEntityManager(ActiveObjectTransactionMethodRule.java:235)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule.createEntityManagerAndUpdateDatabase(ActiveObjectTransactionMethodRule.java:182)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule.before(ActiveObjectTransactionMethodRule.java:110)
at net.java.ao.test.junit.ActiveObjectTransactionMethodRule$1.evaluate(ActiveObjectTransactionMethodRule.java:76)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
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:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

 

Note I am using Java 8. and I found there is no need to download these dependencies as mentioned in the tutorial:

<!-- Google Collections, useful utilities for manipulating collections -->
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>

as 5.0.13 provided the new library of guava by default. 

 

And I am also using the hsqldb dependency (1.8.0.10) as mentioned in the tutorial


Is there anything I am missing? Please let me know soon.

 

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Deleted user June 26, 2019

I am also facing the same issue. Did anyone find the solution for this? For one instance, it fixed if I add the below dependency and same is not working in other places. Not sure what else is conflicting with this dependency.

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
<scope>test</scope>
</dependency>
0 votes
Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2015

It might be worth asking support or going to the appropriate dev doc page and commenting there as well.

0 votes
Yagnesh Bhat
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 20, 2015

Can someone please guide me on this? We need to make sure that we have a proper procedure to Unit Test the AO related code in our plugins.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events