Project ID is Required Error in 6.0a1

824 views
Skip to first unread message

Randy May

unread,
Jan 11, 2018, 3:50:54 PM1/11/18
to objectify-appengine
Today, I upgraded Objectify to version 6.0a1 (to take advantage of the support for the java.time package), and I am seeing the error below.  Any help would be most appreciated.

java.lang.ExceptionInInitializerError
at com.blaazinsoftware.sportScheduler.dao.domain.typicalSeason.constraint.teamAllowed.TeamAllowedConstraintEntityTest.setUp(TeamAllowedConstraintEntityTest.java:37)
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:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
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:498)
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)
Caused by: java.lang.IllegalArgumentException: A project ID is required for this service but could not be determined from the builder or the environment.  Please set a project ID using the builder.
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:134)
at com.google.cloud.ServiceOptions.<init>(ServiceOptions.java:246)
at com.google.cloud.datastore.DatastoreOptions.<init>(DatastoreOptions.java:102)
at com.google.cloud.datastore.DatastoreOptions.<init>(DatastoreOptions.java:35)
at com.google.cloud.datastore.DatastoreOptions$Builder.build(DatastoreOptions.java:89)
at com.google.cloud.datastore.DatastoreOptions.getDefaultInstance(DatastoreOptions.java:158)
at com.googlecode.objectify.ObjectifyFactory.<init>(ObjectifyFactory.java:84)
at com.googlecode.objectify.ObjectifyService.<clinit>(ObjectifyService.java:17)
... 31 more

Jeff Schnitzer

unread,
Jan 11, 2018, 4:11:41 PM1/11/18
to objectify-appengine
When running unit tests, you’ll need to set up the local datastore emulator. This is different from the GAE SDK Local Unit Test Harness, which emulates the old datastore, not the new one.

Look at these Junit5 extensions to see how Objectify sets up the test environment:


One thing to watch out for is that setting up and tearing down the emulator with the LocalDatastoreHelper is slow - it starts and stops a process. If you do that for every test, your harness will take forever to run. My Junit5 extension starts it up once per suite run and uses the reset() method between tests; I don’t know how you do that with Junit4.

Jeff


--
You received this message because you are subscribed to the Google Groups "objectify-appengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appengine+unsubscribe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages