1

UPDATE

Following the advice I was given, I decided to deploy a smaller project with just a class calling this line:

 _cache = MemcacheServiceFactory.getMemcacheService();

Now I'm getting this error:

java.lang.NoClassDefFoundError: com/google/appengine/api/memcache/MemcacheServiceFactory

I read here that this is because I'm missing the appengine-api-1.0-sdk.jar but here it says there is no need to include it.

My problem now is that if I try to include it in the deploy, by adding it to the WEB-INF\lib directory, it gets ignored. If I try with a different jar (non related to GAE) it gets deployed just fine.

For instance, both of this versions had the appengine-api-1.0-sdk.jar in \lib, but version 5 also had a different jar (bcprov-jdk15on-147.jar). The size difference between those two is because of that. enter image description here

To sum up, my question is, should I deploy the appengine-api-1.0-sdk.jar? And if so, then how can I avoid it getting ignored?

Link to .rar with project.

Project Dependencies, they are the default ones for a web application that is going to be deployed to GAE from NetBeans

enter image description here


I´m trying to implement Memcache so that I can use the one provided by GAE when I deploy the app.

Once it´s deployed when I try to run it I get an IllegalStateException:

java.lang.IllegalStateException: Committed

This happens on this line:

private MemcacheService _cache=MemcacheServiceFactory.getMemcacheService();

What could I do to fix it?

Community
  • 1
  • 1
moondaisy
  • 4,303
  • 6
  • 41
  • 70
  • 1
    Are you sure that the line of code (MemCacheService) you are thinking is the culprit? I do not see anything in the stack trace that supports your assumption. Does the application work if you comment out that line/related? The exception is from Jetty trying to tell you that response was already committed and cannot reset the Response. [Javadoc](http://docs.oracle.com/javaee/7/api/javax/servlet/ServletResponse.html#reset--) – Sai Pullabhotla Sep 12 '16 at 17:11
  • @SaiPullabhotla I added a `System.out.println` before and after this line of code and the one after never gets printed, but the one before does. The rest of the code uses `_cache` – moondaisy Sep 12 '16 at 17:38
  • 1
    Perhaps you should try this [sample code](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheConcurrentServlet.java) in a stand alone Servlet and see what happens. – Sai Pullabhotla Sep 12 '16 at 18:28
  • @SaiPullabhotla thanks for the tip, I did just that I realized what the error but i haven't managed to fix that one either – moondaisy Sep 16 '16 at 17:53
  • What are the exact dependencies you have in your project? – Sai Pullabhotla Sep 16 '16 at 20:22
  • @SaiPullabhotla I just added the dependencies to the question – moondaisy Sep 19 '16 at 15:18

1 Answers1

1

The stack trace suggests that you are trying to write something or set something on your HTTP response after you already committed it. It is not related to your use of Memcache.

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58