Maven problems using GAE and DataNucleus - google-app-engine

I'm having trouble retrieving 2 artifacts in my Maven/Java/Google App Engine project:
com.google.appengine.orm:datanucleus-appengine:jar:1.0.7.final
com.google.appengine:appengine-api-1.0-sdk:jar:1.3.4
There's a similar question posted, but each answer brings me back to the same error message.
More detail
I don't know if it is relevant, but rather than a version number, my original dependency for DataNucleus contained a variable. I am using Eclipse.
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.version}</version>
<scope>runtime</scope>
I did not include my stack trace in Maven for brevity's sake. Please let me know if it would help to post it. Thank you.
UPDATE
I was able to get the DataNucleus artifact by changing the version from 1.0.7.final to 1.0.6.final (check this repo) and rolling back to AppEngine 1.3.3 (thanks, #Taylor!). However, I still can't find the repo for appengine-java-sdk:jar:1.3.3. There are no jar files hosted at Google Code.
Does anyone know where to find the appengine-java-sdk jar?

Version 1.3.4 of the App Engine SDK is not yet supported by the maven-gae-plugin. Please see the issue here.
Also, based on your latest edit to the question you should NOT be using version 1.3.3. Rather, you should be using version 1.3.3.1 (see here). Also, the appengine-java-sdk jar is available in the maven-gae-plugin repo (see here).

Related

Need help Migrating from legacy SDK (appcfg)

Google has emailed me saying "Migrate your App Engine projects from the legacy SDK (appcfg)" for 3 of my projects. I don't use appcfg, I use mvn to deploy my software. I've 6 projects in total on GAE and have compared the pom files and build files and they are identical. I thought it was because I'm using an older appengine-api, but they are fairly up to date and all use the same version:
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.58</version>
</dependency>
What I am missing here?
Thanks
Tim
So you basically want to know why would Google send you that email if your projects do not use appcfg?. It could be because:
1.- Just a reminder that you should migrate to the new SDK. If is not specified on the email something like "we have noticed that your project --- is using ..." then is probably just a general reminder.
2.- You have previous versions where you used the legacy SDK, and Google is detecting this.
3.- You are using a deprecated version of Java App Engine SDK-based plugin and have to migrate to the new version (less likely but since you are in fact using Maven wouldn't hurt to check).
Also, i know that you said you weren't using appcfg but here's a list of equivalents commands between appcfg and gcloud for extra information.

Is there a mandatory requirement to switch app.yaml?

Folks,
I'm using the recently released Google Cloud SDK 0.9.56 on Windows 7x64.
When trying to gcloud deploy my app using web.xml and appengine-web.xml, I get a response:
ERROR: Found no valid App Engine configuration files in directory
When trying to do the same with apps defined with app.yaml there were no issues.
Teammates with older SDK versions don't seem to have an issue.
Is there a mandatory requirement to use app.yaml in all apps?
P.S: This question might be related but its actually a different issue.
sorry about this.
That question you linked is actually the same issue. You can use the new maven plugin described there to translate your appengine-web.xml to app.yaml automatically. We have a gradle plugin coming out very soon to do the same thing.
If you'd like to keep using gcloud directly without Maven or Gradle, you'll need to translate the appengine-web.xml to an app.yaml for now.
Let me know if I can help.

NoClassDefFoundError: Could not initialize OauthRawGcsServiceFactory on production environment

I'm using appengine-sdk 1.9.3.
In devserver, works in Eclipse and Ant normally.
When I deploy (update) to appengine (production environment), I get this error:
event.getResults(): [<pre>Error for /p7/formPanelServlet
java.lang.NoClassDefFoundError: Could not initialize class
com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsServiceFactory
at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFactory.java:42)
at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:34)
at com.bitvisio.p7.server.FormPanelServlet.<init>(FormPanelServlet.java:27)
At FormPanelServlet.java:27, the code is:
private final GcsService gcsService = GcsServiceFactory
.createGcsService(new RetryParams.Builder()
.initialRetryDelayMillis(10)
.retryMaxAttempts(10)
.totalRetryPeriodMillis(15000)
.build());
I put the lib appengine-gcs-client-0.3.9.jar in war/WEB-INF/lib. I think there is a problem with this lib.
Thanks for help.
Always use tools like Maven or Ivy to resolve dependencies for you. Copying JARs to war/WEB-INF/lib/ directory and editing .classpath file manually will be painful and may not help you always. If you use Eclipse & Google App Engine plugin, use Add Google APIs... as mentioned here - Google Plugin for Eclipse. In my case, adding Cloud Storage API via Google Plugin for Eclipse helped resolve this NoClassDefFoundError.
I had the same problem. I use Ivy to resolve dependencies and always get the latest.integration (with Maven use RELEASE) for revisions.
However I usually ignore transitive libraries. It looks like Google is expanding the API family - at least splitting out discrete functionality.
There are now quite a few transitive dependencies and it seems they released a new version of the GCS client around the same time as 1.9.3.
Getting all dependencies and packaging them in my deployment fixed my issue. I did not have the issue in development which made it more confusing.
You are facing this issue because you are not adding the some of the jar like
google-api-services-storage-v1-rev78-1.22.0.jar download link
joda-time-2.94.jar download link
guava-19.0.jar link to download
you can use the different version of jar according to your appengine-gcs-client jar file.
Note : Add all these jar and build path with the project and problem will get solve.

DataNucleus libraries and maven-gae-plugin

I'm using maven-gae-plugin to manage a Google AppEngine project but I don't know how to include the libraries required to use JPA.
Google's documentation says:
The classpath must contain the JARs 'datanucleus-core-*.jar', 'datanucleus-jpa-*', 'datanucleus-enhancer-*.jar', 'asm-*.jar', and 'geronimo-jpa-*.jar' (where * is the appropriate version number of each JAR) from the 'appengine-java-sdk/lib/tools/' directory, as well as all of your data classes.
How can I tell the plugin to put all the jars in the classpath?
So far I just edited the pom.xml file setting gae.version to 1.7.3 (Leaving datanucleus.version to 1.1.5 and I run mvn gae:unpack but I cannot get it to work.
First, I have problems with javax.persistance that is not found. Do I have to add it manually to pom.xml?
If I do it, the development server starts, but I cannot work with the storage: I get the following error:
SEVERE: Found Meta-Data for class com.sharecost.entities.User but this class is not enhanced!! Please enhance the class before running DataNucleus.
I found a solution to the second part of my question. Looking at the POM.xml file I discovered that the all entities are supposed to be in a **/model package.
I still don't know if the manual inclusion of the javax.persistence dependency is actually required.

Datanucleus using wrong enhancer in Google App Engine 1.7

I'm having difficulty in getting Datanucleus 2 to work properly with enhancing classes on GAE 1.7.0 in Eclipse using the Datanucleus plugin. This worked fine in older versions of GAE when I'd follow the manual steps here:
http://www.datanucleus.org/products/accessplatform/guides/eclipse/index.html
But since upgrading, GAE now includes these libs (newer versions of them it looks like), and also GAE has a new "enhancer" flag you can set. I can't find anyway to set this flag in Eclipse though. It appears that GAE is still including the v1 libs when I want the V2 libs and Datanucleus is having conflicts according to this error:
Jul 1, 2012 5:59:55 PM org.datanucleus.enhancer.DataNucleusEnhancer <init>
INFO: DataNucleus Enhancer : Using ClassEnhancer "ASM" for API "JPA"
Exception in thread "main" java.lang.NoSuchFieldError: NUCLEUS_CONTEXT_LOADER
at org.datanucleus.NucleusContext.<clinit>(NucleusContext.java:73)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:171)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1265)
I've tried many different things. I've tried using all the defaults. I've tried adding the v2 libs to the Datanucleus runtime Classpath Entries. I've tried deleting the v1 libs in the GAE 1.7.0 SDK in both the src and libs. But somehow GAE is still pulling over (or trying to pull over the V1 libs. I've even tried the older method of manually setting up the configuration as specified by the link above. It's a little frustrating as it seems like I'm now in a situation where I can't use these libs at all. At least with older versions of GAE I could manually set it up to work. Nothing seems to work now. Any suggestions?
I hit this same error and was able to resolve it in my project by:
Doing what DavidB suggested in the comments, without modifying the DataNucleus JPA settings in the preferences.
Deleting all of the "V1" jars from the war/WEB-INF/lib
To clarify DavidB's suggestion, open the directory that holds your project. There will be a folder named ".settings", open this and edit com.google.appengine.eclipse.core.prefs. Just change the third line from gaeDatanucleusVersion=v1 to gaeDatanucleusVersion=v2
Once you have done this, remove the following jars from you war/WEB-INF/lib directory:
datanucleus-appengine-1.0.10.final.jar
datanucleus-core-1.1.5.jar
datanucleus-jpa-1.1.5.jar
geronimo-jpa_3.0_spec-1.1.1.jar
geronimo-jta_1.1_spec-1.1.1.jar
jdo2-api-2.3-eb.jar
Restart eclipse and you should be good to go.

Resources