Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade has removed appengine-api jar from projects. Now getting noClassDefFoundErrors #2530

Closed
mhopkins-dynactive opened this issue Oct 24, 2017 · 7 comments

Comments

@mhopkins-dynactive
Copy link

(please ensure you are running the latest version of CT4E with Help > Check for Updates)

  • Cloud Tools for Eclipse version: 1.4.0.201710181251
  • Google Cloud SDK version: 172.0.1
  • OS: Mac OS X 10.12.6
  • Java version: 1.8.0_144

What did you do?
I upgraded to 1.4.0

What did you expect to see?
I expected everything to work the same and that the build path would still work.

What did you see instead?

Now I am seeing java.lang.NoClassDefFoundError: com/google/appengine/api/memcache/MemcacheServiceException

The release notes say "In native projects the App Engine SDK (com.google.appengine:appengine-sdk-1.0-api) is now included in the App Engine standard runtime definition, as it is in the server runtime." So I assume that it should be included in the run time and it should just work.

I have no idea what I need to do to get the Appengine Api to work. :(

@chanseokoh
Copy link
Contributor

chanseokoh commented Oct 24, 2017

Sorry for the inconvenience. I believe your project is an App Engine standard app and is not using Maven (no pom.xml). Assuming no Maven, let's try if the following can quickly fix this.

  1. Make a copy of your project and keep it safe, just in case.
  2. Remove the "App Engine Standard Runtime" library.
    selection_007
    • After that, you'll see build errors.
  3. Right-click on your project > Build Path > Add Libraries... > Server Runtime > App Engine Standard Runtime > Finish.

It should then add back the runtime with the appengine-api-1.0-sdk JAR.
selection_008

@chanseokoh
Copy link
Contributor

After that, verify that you get correct Servlet and JSP API versions (e.g., Servlet 2.5 vs. 3.1).

@mhopkins-dynactive
Copy link
Author

You are correct. Not using Maven and it is a standard app. The only thing that I would add is that I am using services. So the .jar files get exported to somewhere else and then get ran. (I think)

I deleted the app engine standard and it shows the api jar. It also shows the servlet and JSP and that they are the correct versions. (I assume)

screen shot 2017-10-24 at 10 07 07 am

unfortunately this did not fix my problem.

Here is a video showing what I did.

https://www.dynactiveeducation.com/cms/?blobWSK=agpzfmRzY21zbG1zcvoBCxIRQmxvYnN0b3JlTWV0YWRhdGEi4gFBTUlmdjk3emRJZFFMZmYwRXp3VnBKMkZ0RU1rWnlwUkg3WG9jb2EzYTduNVN4Y1VReHZ2MDZwLVBZTjkzeUxHMXgybUl6V0tiYXZncTE0cC12amhMaDdJVHU5ZDgyVzNlc084WE50X2xmUFBmWXZvM195Z1pJOV95cmpsZjI2Skh4aFFyTjN1cWJZa3FaQnpNOW9DQ29IS054amhVYi01YzNsQ0RHNm5kLVExekpteXFwMzFrTGc0Uno2UGlQZHBkdk04UG90b0tBWFhRY2FDNXZmZHlFbjFzc3JqZW9ZdjB3DKIBBmRzLmNtcw

@chanseokoh chanseokoh changed the title Upgrade has removed appengine-api jar from projects. Not getting noClassDefFoundErrors Upgrade has removed appengine-api jar from projects. Now getting noClassDefFoundErrors Oct 24, 2017
@chanseokoh
Copy link
Contributor

chanseokoh commented Oct 24, 2017

I think I know why this is happening, but I need to do some more testing before I explain everything.

In the meanwhile, as a workaround, drop the JAR found under your ~/.m2/repository into your WEB-INF/lib and refresh your project. The "Web App Libraries" container will automatically pick up any JARs under WEB-INF/lib and export them:

selection_009

@mhopkins-dynactive
Copy link
Author

The workaround worked. :) Thanks.

@chanseokoh
Copy link
Contributor

@mhopkins-dynactive FYI, you need this workaround only for debugging locally with the dev server; the JAR is provided by the production runtime like the servlet API JAR. So, in this sense, the dev server is not reflecting the prod env precisely, and this is sort of a known issue. Therefore, anyone who wants to use the API locally should export the JAR in their web apps; many times, tools or users just export the JAR to make life easier.

You don't have to worry about the workaround regarding the prod env, because we will remove the JAR from WEB-INF/lib anyway when deploy happens; your WAR deployed to App Engine won't include the JAR.

@chanseokoh
Copy link
Contributor

Opened #2531. Closing this issue. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants