开发者

Exception in Google App Engine (Java) while trying to create Memcache Object

开发者 https://www.devze.com 2022-12-19 00:12 出处:网络
I am coming back to an old Google App Engine project on which I saw a bug. During this lag, I have been upgrading my AppEngine SDK and is now set at 1.3. When I try to run the same project 开发者_C百科

I am coming back to an old Google App Engine project on which I saw a bug. During this lag, I have been upgrading my AppEngine SDK and is now set at 1.3. When I try to run the same project 开发者_C百科again, I see the following exception:

java.lang.NoSuchMethodError: com.google.apphosting.api.ApiProxy$Environment.getDefaultNamespace()Ljava/lang/String;
at com.google.appengine.api.NamespaceManager.get(NamespaceManager.java:56)
at com.google.appengine.api.memcache.MemcacheServiceImpl.setNamespace(MemcacheServiceImpl.java:181)
at com.google.appengine.api.memcache.MemcacheServiceImpl.(MemcacheServiceImpl.java:145)
at com.google.appengine.api.memcache.MemcacheServiceFactory.getMemcacheService(MemcacheServiceFactory.java:25)

The line causing the problem is:

CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());

(It is the same line as suggested by the AppEngine documentation to create a memcache object. It used to work fine previously. )

Any suggestions on how to fix it?


I found that the issue was caused by having multiple versions of appengine SDK JARs in war/WEB-INF/lib folder, caused presumably by the upgrades. Once I removed them, the problem was resolved and it works as expected now.

Is there any other reason for having multiple versions of the JARs in the war/WEB-INF/lib (I didn't manually put them there)?

0

精彩评论

暂无评论...
验证码 换一张
取 消