I suspect datanucleus-jpa-1.1.5.jar isn't on your classpath. Is that possible?
On Fri, Dec 11, 2009 at 4:29 AM, Thierry Golvanig <[email protected]>wrote: > Hi All, > > I am trying to write a bunch of tests with JUNIT for my JDO classes. > > The package works when integrated in a appengine web application, but > I get a RunTimeException when testing in a Junit 'environment'. > > > I started with the JDODataSourceConfigTest source file in the > appengine test directory. > and It's ok with nothing included. > > Then I tried to store some data within the two methods implemented: > > public void testTransactionalPMF() { > JDOPersistenceManagerFactory pmf = (JDOPersistenceManagerFactory) > JDOHelper > .getPersistenceManagerFactory("transactional"); > DatastoreManager storeMgr = (DatastoreManager) pmf.getStoreManager > (); > JDOPersistenceManager pm = (JDOPersistenceManager) > pmf.getPersistenceManager(); > // assertTrue(storeMgr.connectionFactoryIsTransactional()); > > DomainGAE domain = new DomainGAE("Name", "Description"); > > Transaction tx = pm.currentTransaction(); > try { > tx.begin(); > pm.makePersistent(domain); > tx.commit(); > } catch (Exception e) { > System.out.println("Exception e: " + e); > e.printStackTrace(); > > if (tx != null) { > tx.rollback(); > } > } > > pm.close(); > pmf.close(); > } > > ------------------------------- > > DomainGAE is a simple Class > > import javax.jdo.annotations.IdGeneratorStrategy; > import javax.jdo.annotations.PersistenceCapable; > import javax.jdo.annotations.Persistent; > import javax.jdo.annotations.PrimaryKey; > import com.google.appengine.api.datastore.Key; > import com.google.appengine.api.datastore.KeyFactory; > import .... > > @PersistenceCapable(table = "domain", detachable = "true") > public class DomainGAE implements Domain { > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key id; > > protected String name = null; > protected String description = null; > > public DomainGAE(String name, String description) { > this.name = name; > this.description = description; > } > > ..... > } > > > Here is the error and the stackTrace: > Exception e: java.lang.RuntimeException: Unable to replace > JPACallbackHandler. > java.lang.RuntimeException: Unable to replace JPACallbackHandler. > at > org.datanucleus.store.appengine.DatastorePluginRegistry.getExtensionPoint > (DatastorePluginRegistry.java:67) > at org.datanucleus.plugin.PluginManager.getExtensionPoint > (PluginManager.java:65) > at > org.datanucleus.plugin.PluginManager.getConfigurationElementForExtension > (PluginManager.java:113) > at > org.datanucleus.plugin.PluginManager.getAttributeValueForExtension > (PluginManager.java:230) > at org.datanucleus.ObjectManagerImpl.getCallbackHandler > (ObjectManagerImpl.java:3804) > at org.datanucleus.state.AbstractStateManager.getCallbackHandler > (AbstractStateManager.java:160) > at > org.datanucleus.state.JDOStateManagerImpl.initialiseForPersistentNew > (JDOStateManagerImpl.java:466) > at > org.datanucleus.state.StateManagerFactory.newStateManagerForPersistentNew > (StateManagerFactory.java:151) > at org.datanucleus.ObjectManagerImpl.persistObjectInternal > (ObjectManagerImpl.java:1297) > at org.datanucleus.ObjectManagerImpl.persistObject > (ObjectManagerImpl.java:1175) > at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent > (JDOPersistenceManager.java:669) > at org.datanucleus.jdo.JDOPersistenceManager.makePersistent > (JDOPersistenceManager.java:694) > at > com.golvanig.projteam.JDODataSourceConfigTest.testNonTransactionalPMF > (JDODataSourceConfigTest.java:65) > 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 junit.framework.TestCase.runTest(TestCase.java:168) > at junit.framework.TestCase.runBare(TestCase.java:134) > at junit.framework.TestResult$1.protect(TestResult.java:110) > at junit.framework.TestResult.runProtected(TestResult.java:128) > at junit.framework.TestResult.run(TestResult.java:113) > at junit.framework.TestCase.run(TestCase.java:124) > at junit.framework.TestSuite.runTest(TestSuite.java:232) > at junit.framework.TestSuite.run(TestSuite.java:227) > at org.junit.internal.runners.JUnit38ClassRunner.run > (JUnit38ClassRunner.java:83) > at org.apache.maven.surefire.junit4.JUnit4TestSet.execute > (JUnit4TestSet.java:62) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet > (AbstractDirectoryTestSuite.java:140) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute > (AbstractDirectoryTestSuite.java:127) > at org.apache.maven.surefire.Surefire.run(Surefire.java:177) > 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.booter.SurefireBooter.runSuitesInProcess > (SurefireBooter.java:345) > at org.apache.maven.surefire.booter.SurefireBooter.main > (SurefireBooter.java:1009) > Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.104 > sec <<< FAILURE! > > > I did the test with maven and also directly with junit by providing > the lib from 1.2.8 > Results are the same. > > > I tried to extends JDODataSourceConfigTest from LocalServiceTestCase > or LocalDatastoreTestCase (http://code.google.com/appengine/docs/java/ > howto/unittesting.html<http://code.google.com/appengine/docs/java/%0Ahowto/unittesting.html> > ) > but I got the same error. > > I am sure I forgot something, but I can't figure what. > > Does anyone has an hint? > Thanks > > -- > > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
