java.lang.NoSuchMethodError

904 views
Skip to first unread message

Noam Dishon

unread,
Oct 28, 2013, 9:50:40 AM10/28/13
to objectify...@googlegroups.com

Hi,

I was getting the below exception all the time with objectify-4.0rc2 and AppEngine 1.8.6, (in the cloud only, not in local environment) :

java.lang.NoSuchMethodError: com.google.appengine.api.datastore.Key.getRootKey()Lcom/google/appengine/api/datastore/Key;
        at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$V3KeyBatcher.getGroup(AsyncDatastoreServiceImpl.java:105)
        at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$V3KeyBatcher.getGroup(AsyncDatastoreServiceImpl.java:101)
        at com.google.appengine.api.datastore.Batcher.getBatches(Batcher.java:299)
com\google\appengine\api\datastore\

After a day of wasting time on this, I found that objectify-4.0rc2.jar contains for some reason copies of google.com.appengine.api.datastore.Key, and of many other classes.
After deleting them manually from the jar, things started to work well.

The jar was downloaded from: http://repo1.maven.org/maven2/com/googlecode/objectify/objectify/4.0rc2/

Why are these even in the jar in the first place? Is this documented somewhere that it can make such problems?

thanks,
Noam

Grant Slender

unread,
Oct 31, 2013, 11:45:39 PM10/31/13
to objectify...@googlegroups.com
Wow! So is this fixed or still and issue in the 4.0rc2 release?

I've migrated my dev environment to rc2, but have not yet pushed to the cloud, so glad I saw this first.

G

Noam Dishon

unread,
Nov 1, 2013, 5:40:41 AM11/1/13
to objectify...@googlegroups.com
Ii might not happen to you. I am not sure it happens to everyone, otherwise this post would make more noise :)
Probably it depends on some special conditions of the class loader.
It might have to do with the fact that I am using the new Modules, and so the war is built a bit differently.

-Noam

Ingo

unread,
Nov 1, 2013, 10:45:46 AM11/1/13
to objectify...@googlegroups.com
This happened to me when I had to different versions of Objectify on my classpath. Make sure that your project does not bring in two different versions of objectify. I use objectify 4.0rc2 and do not see this problem.

Thanks,
Ingo

Emanuele Ziglioli

unread,
Feb 16, 2014, 8:51:32 PM2/16/14
to objectify...@googlegroups.com
Why?? I hate appengine...


java.lang.NoSuchMethodError: com.google.appengine.api.datastore.Key.<init>(Ljava/lang/String;Lcom/google/appengine/api/datastore/Key;JLjava/lang/String;Lcom/google/appengine/api/datastore/AppIdNamespace;)V
	at com.google.appengine.api.datastore.KeyTranslator.createFromPb(KeyTranslator.java:37)
	at com.google.appengine.api.datastore.EntityTranslator.createFromPb(EntityTranslator.java:35)
	at com.google.appengine.api.datastore.QueryResultsSourceImpl.processQueryResult(QueryResultsSourceImpl.java:197)
	at com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities(QueryResultsSourceImpl.java:106)
	at com.google.appengine.api.datastore.QueryResultIteratorImpl.ensureLoaded(QueryResultIteratorImpl.java:155)
	at com.google.appengine.api.datastore.QueryResultIteratorImpl.nextList(QueryResultIteratorImpl.java:110)
	at com.google.appengine.api.datastore.LazyList.forceResolveToIndex(LazyList.java:93)
	at com.google.appengine.api.datastore.LazyList.resolveToIndex(LazyList.java:73)
	at com.google.appengine.api.datastore.LazyList.resolveAllData(LazyList.java:44)
	at com.google.appengine.api.datastore.LazyList.size(LazyList.java:117)
	at siena.gae.GaeMappingUtils.mapEntitiesKeysOnly(GaeMappingUtils.java:633)
	at siena.gae.GaePersistenceManager.mapKeysOnly(GaePersistenceManager.java:1405)
	at siena.gae.GaePersistenceManager.doFetchList(GaePersistenceManager.java:1506)
	at siena.gae.GaePersistenceManager.fetchKeys(GaePersistenceManager.java:2012)

using
appengine-api-1.0-sdk-1.8.9
objectify-4.0rc2
 

I've tried reverting to 1.8.8... same
There on other Objectify jars in my classpath.

I can see com.googlecode.objectify.cache.AsyncCacheFilter catches the exeption in its finally block.
Maybe it could print out something useful, I'll investigate

Emanuele Ziglioli

unread,
Feb 16, 2014, 9:21:56 PM2/16/14
to objectify...@googlegroups.com
Solved.
I found an exclusion in my POM.xml, as I was trying to remove the number of jars in my project, in order to speedup warmup time

                                <exclusion>
<artifactId>appengine-api-1.0-sdk</artifactId>
<groupId>com.google.appengine</groupId>
</exclusion>

This is really weird because the jar itself was in the lib folder.
Running from Eclipse, the maven plugin for eclipse perhaps was listing it as a dependency, not sure.
But why was I having the same problem on the gae servers?
Perhaps the gae:deploy goal was not pushing that jar.
Weird, frustrating

Jon Stevens

unread,
Feb 17, 2014, 3:37:42 AM2/17/14
to objectify...@googlegroups.com
Yea, I had to do the same thing but I added api-labs too...

<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>4.0</version>
<exclusions>
<exclusion>
<artifactId>appengine-api-labs</artifactId>
<groupId>com.google.appengine</groupId>
</exclusion>
<exclusion>
<artifactId>appengine-api-1.0-sdk</artifactId>
<groupId>com.google.appengine</groupId>
</exclusion>
</exclusions>
</dependency>

Definitely a bit frustrating to figure out.



--
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-appen...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Huseyn Guliyev

unread,
Feb 18, 2014, 1:13:23 PM2/18/14
to objectify...@googlegroups.com
As we are all here trying to cut the size of GAE deploy for java, it will be very appreciated if somebody could share their exclusions lists and maybe we could collectively get an optimized maven bootstrap for GAE.
To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appengine+unsub...@googlegroups.com.

Jon Stevens

unread,
Feb 18, 2014, 1:24:39 PM2/18/14
to objectify...@googlegroups.com
Not needed for JDK 7...

         <exclusion>
        <artifactId>backport-util-concurrent</artifactId>
        <groupId>backport-util-concurrent</groupId>
        </exclusion>

Causes issues with IllegalAccessErrors... (included by an older version of resteasy)...

<exclusion>
<artifactId>jaxb-impl</artifactId>
<groupId>com.sun.xml.bind</groupId>
</exclusion>



To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appen...@googlegroups.com.

Mohit A

unread,
Jul 2, 2014, 12:15:09 PM7/2/14
to objectify...@googlegroups.com

Emanuele Ziglioli

unread,
Jul 2, 2014, 6:01:58 PM7/2/14
to objectify...@googlegroups.com
I've seen this error again when updating the GAE SDK. I'm still using Objectify 4.
Just cleaning the project (in Eclipse) worked for me.
I use both the old gae maven plugin and Eclipse, so when I upgrade the SDK they kind of interfere with each other.
Will try Ofy 5 at some stage.

David Chandler

unread,
Jul 4, 2014, 1:23:23 AM7/4/14
to objectify...@googlegroups.com
This has gone away with Objectify 5.0.3... unless you're using objectify-gwt also, where it's still an issue in v1.0.

Jeff Schnitzer

unread,
Jul 6, 2014, 6:47:12 PM7/6/14
to objectify...@googlegroups.com
I just pushed objectify-gwt 1.1 to maven central. This includes kebernet's PR which should fix gradle builds.

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-appen...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chad Vincent

unread,
Jul 7, 2014, 12:19:46 PM7/7/14
to objectify...@googlegroups.com, je...@infohazard.org
Simply replacing 1.0 with 1.1 breaks my build.  Using Eclipse and the default (as of 19 months ago) project setup in Eclipse (Eclipse build, manual libraries...):

   Validating units:
      Ignored 681 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   [ERROR] Errors in 'jar:file:/C:/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.6.0/gwt-2.6.0/gwt-user.jar!/com/google/web/bindery/autobean/shared/impl/StringQuoter.java'
      [ERROR] Line 34: No source code is available for type java.text.DateFormat; did you forget to inherit a required module?
      [ERROR] Line 34: No source code is available for type java.text.SimpleDateFormat; did you forget to inherit a required module?
      [ERROR] Line 34: No source code is available for type java.util.Locale; did you forget to inherit a required module?
      [ERROR] Line 69: No source code is available for type org.json.JSONObject; did you forget to inherit a required module?

haris...@gmail.com

unread,
Jul 15, 2014, 2:43:34 AM7/15/14
to objectify...@googlegroups.com, je...@infohazard.org
I am having same issue as Chad Vincent, with same error. 

Replacing the 1.1 jar back to objectify-gwt-1.0. Now is ok with successful gwt compile.
Reply all
Reply to author
Forward
0 new messages