Upgrade to Cloud Tools For Eclipse 1.4.0 appengine-api now missing - google-plugin-eclipse

I upgraded the Google Cloud tools to version 1.4.0 and now my projects do not have the appengine-api jar file. (Maybe others) Now I can a memcacheservice exception.
How do I get the appengine api jar back into the build path? Any help or advice would be great. Thanks.
These are the release notes. https://cloud.google.com/eclipse/docs/release-notes
com/google/appengine/api/memcache/MemcacheServiceException
Caused by:
java.lang.NoClassDefFoundError: com/google/appengine/api/memcache/MemcacheServiceException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2595)
at java.lang.Class.getConstructor0(Class.java:2895)
at java.lang.Class.newInstance(Class.java:354)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)

I contacted the Cloud Tools people on github and they got me a workaround.
You have to take their appengine-api jar from their location and stick it in the web-inf/lib folder so that it can be found on your dev box.
https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2530

We're working on this. I expect we'll have a CT4E 1.4.1 release that integrates the above workaround early next week; that is, around 10/31. That should suffice until the underlying issue in the Cloud SDK is fixed.

Related

Eclipse unable to generates classes while using AWS SWF

I am following hello world application of Amazon Web Services Simple Workflow Service. According to description #Activities annotation should have been able to generate two classes GreeterActivitiesClient and GreeterActivitiesClientImpl. But these classes has not been generated.
I have Enable annotation processing in project properties. I am using Eclipse Mars with Jdk 1.8. I have also installed AWS toolkit for eclipse, aspectj.
Can someone see where the problem is?
Some versions of Eclipse, (notably Mars and Neon), may fail to fetch the latest artifacts due to a bug in old versions of the Oomph plugin. To work around this issue:
Make sure that you’re using https://aws.amazon.com/eclipse/site.xml as the AWS Toolkit for Eclipse update site.
Delete the ~/.eclipse/org.eclipse.oomph.p2/cache/ directory to remove cached content.
Install the latest version of Oomph (Eclipse Installer).
Reference: Set up the Toolkit

Class not found when using JAX-RS with Eclipse and Glassfish

I am using Eclipse Luna (versions 4.4.2) and Glassfish 4 to build a REST web-app using JAX-RS.
The following piece of code, which is just a very simple post to the REST api that was previously working just fine, has started throw a very strange error:
#POST
public Response addToWatchlist(WatchlistEntry watchlistentry)
{
return Response.ok(watchlist_service.addToWatchlist(watchlistentry).toString()).build();
}
The error is below:
Warning: StandardWrapperValve[Jersey Web Application]: Servlet.service() for servlet Jersey Web Application threw exception
java.lang.ClassNotFoundException: javax.xml.parsers.ParserConfigurationException not found by org.eclipse.persistence.moxy
All I have been able to find out about this is this webpage:
https://java.net/jira/browse/JERSEY-2888
One of the comments says this has been fixed in EclipseLink 2.6.1 and Jersey 2.19.
I am pretty new to using MAVEN and eclipse - assuming the above is correct, how do I get my Maven Project in Eclipse to update the Jersey version? Also how do I update the EclipseLink version? Their site only seems to have version 2.6.0 available: http://www.eclipse.org/eclipselink/#download
I assume all this can be done through eclipse itself?
All help appreciated!
EDIT 1: It seems like eclipselink 2.6.1 has been released on Oct 15th 2015, as you can see here: http://www.eclipse.org/eclipselink/releases/
However, as you can see here, it doesn't seem to have been incorporated into eclipse for "help -> update software": http://download.eclipse.org/rt/eclipselink/updates/
Which is highly annoying.
I am building my REST website, and no PUT or POST will work because of this error.
Does anybody know how to get 2.6.1 working? I am using a Maven jersey-quickstart-webapp Project.
This bug is a royal pain in the face.
EDIT 2: I've got a hack working today. When I check programmtically what version of eclipselink is being used at runtime like below, it tells me it is version 2.6.1, even though the bug remains:
Class<?> myClass = Class.forName("org.eclipse.persistence.Version");
Method myMethod = myClass.getMethod("getVersion");
String version = myMethod.invoke(null).toString();
System.out.println("version = " + version);
In a related question (How to find what version of EclipseLink my Eclipse Project is using?) I found out how to find the actual jar files glassfish is using for eclipse. They are in the glassfish/modules directory. Inside the org.eclipse.persistence.core.jar file has will be a readme.html which tells you the version of eclipselink that glassfish is using. For me it was 2.6.
I manually updated the org.eclipse.persistence.core.jar and the org.eclipse.persistence.moxy.jar file with the latest versions from the maven site. While this is quite hacky, as I don't know what else is effected by doing this, it does get over this problem. If I find out the correct way to do this, I will write an answer below, for all and sundry.
Going through the Jersey JIRA and eclipse link website it seems like Eclipse link 2.6.1 is still under development i.e. not yet released. That's why its not available for download.
To use an updated version of Jersey in maven you need to give depending to the newer version 2.19 in your pom.xml.
But, since eclipse link 2.6.1 is yet to be released, even if you use newer version of Jersey it might be of little use. But still you can give it a try.
To update version of jersey, find the following dependency and update the value of version tag in your pom.xml file
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.22.1</version>
</dependency>
Which server are you deploying your project into? I've had A LOT of problems with Glassfish 4.1.1 (incluiding that error). I downgraded to 4.1 and everything runs fine. It may be due to a problem with 4.1.1 newest modules (jars incluided in the server). I hope it helps. Its not the best solution but for me was a temporary workaround 'till I find which modules are failing.
The problem was solved by updating the version of eclipselink that glassfish was using. Eclipse updated it's version, but glassfish needs it's own update. The list of jar files that need to be placed in the glassfish/modules directory is given in this answer: How to change EclipseLink in GlashFish 4.0?

ClassNotFoundException: org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider

I try to start an Google appengine application in my eclipse.
I have the Google plugin and I set the sdk for my application.
But, when I start this one, I get the following error:
java.lang.ClassNotFoundException: org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider
However, this class is present in the sdk which is present in my classpath.
Why Appengine doesn't find this class ?
Thanks.
https://developers.google.com/appengine/docs/java/datastore/jpa/overview-dn2
Please try to follow the steps to add JPA and datastore JARs in the app's war/WEB-INF/lib/ directory.
All the jars in the appengine-java-sdk/lib/opt/user/datanucleus/v2/ directory.
I met the same problem and followed the steps on that webpage. Now my code works well.
I believe that problems happens because we are using JPA 2.0 instead of JPA 1.0 now.
Also, please make sure you are using org.datanucleus.api.jpa.PersistenceProviderImpl as the provider instead of org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider. At least I used the new provider because I am developing GAE projects using the newest GAE plug-in
Good luck.

Unable to publish web app: SpringSource Tool Suite problem?

I have an existing, fully functional Spring web application based on Spring 2.5.6 - developed using SpringSource Tool Suite 2.1.0.SR1.
Because I'd like to use REST I decided to upgrade to Spring 3.0.0.M4. After editing the dependencies in pom.xml and changing my code to reflect the API changes in Spring 3.0 I tried to publish my web app to a local server (SpringSource tc - a Tomcat derivate).
The result is an almost empty web app folder and therefore a non-functional app. The app's folder only contains WEB-INF/lib with all libraries required by the Maven dependencies.
After realising that something's broken, I created a new Spring MVC project (based on the default 2.5.6) and published it to the same server. No problems. I tried to adapt my project's files (.settings/*, .project, .classpath, .springBeans), but this didn't change anything.
I'm pretty lost right now. My guess is that STS doesn't handle 3.0 apps correctly. Any suggestions?
PS: I don't want to revert to 2.5 if it's not absolutely necessary. I don't need STS and tc so I don't have a problem using other tools, but it worked fine so far.
I run into this all the time using Eclipse Galileo and m2eclipse 0.9.8 and Tomcat with WTP. I think it is m2eclipse that is the culprit. The problem seems worse after switching from Ganymede. The work around is to run mvn to create the war and then copy the war contents from "target" to WTP's "wtpwebapps" directory. You can conveniently find this horribly long path by double clicking the server in the Servers view, and choosing "Open Launch Configuration" from there click on Arguments(?) tab I think and copy the catalina.home java property that is defined as an argument there.
The problem vanished with newer versions of STS. Additionally my development environment changed a bit since I posted this question, so I can't really tell what caused the problem.
For me, it looked like a weird hiccup inside STS.
Spring Tool Suite 2.1.0 claims partial support for Spring 3.0, though not for the REST features. According to the release, future releases will add full support. From the release statement:
Features
Support for milestones of Spring 3.0 including XML editing and validation, support for #Configuration and #Bean annotations
Future
Complete Spring 3.0 support including tools for developing RESTful web applications
Try deploying your app to embedded jetty. 'mvn jetty:run' with help you confirm if that there's nothing wrong with your build (that all the right manifests and deps are in place)

Grails in Eclipse

I'm trying to follow some of the introduction to Grails tutorials and am at the point where I want to try to see if I can use a debugger in Eclipse with my Grails applications. My grails application runs fine when I use the command to execute, but when I tried to use the Eclipse run configuration, I get the following error:
Exception in thread "main" java.lang.NullPointerException
at java.io.File.<init>(File.java:194)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:107)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:192)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:200)
at grails.util.GrailsMain.run(GrailsMain.groovy:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1062)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:893)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:744)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:727)
at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:383)
at org.codehaus.groovy.runtime.InvokerHelper$runScript.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:129)
at grails.util.GrailsMain.main(GrailsMain.groovy)
I figure it's a configuration issue (I did recently set the GRAILS_HOME environment variable and that seems to be correct) but that error message doesn't really give me much to go.
Suggestions?
Grails does work in Eclipse. Based on my observations I would actually say that it is the preferred IDE for Grails development (well the STS version).
A) You could choose to install the Eclipse groovy plug in. Can be a little fiddly http://groovy.codehaus.org/Eclipse+Plugin
B) Or you could used the Spring tool suite (STS) IDE and install Grails support from the extensions menu. http://grails.org/STS+Integration (Just works!)
STS is built on Eclipse
I personally have found STS to have better Grails support than Netbeans. Its developed by the same organisation that backs Grails
Have you installed the Groovy Eclipse Plugin?
IIRC, you need this to enable Groovy debugging --- take a look at this page for a step by step about setting up the eclipse debugger - http://www.grails.org/Eclipse+IDE+Integration
But Jared is right, Netbeans step debugger is so much nicer --- http://www.grailsblog.com/archive/show?id=13
Besides grails home, try setting JAVA_HOME environment variable.
I was never able to get grails to work properly in eclipse. You may want to try Netbeans though the 6.7 version has improved grails support.
We use Groovy/Grails Tool Suite IDE. It's similar to Spring Tool Suite (STS) in that it's based on Eclipse, but GGTS comes bundled with the Grails distribution itself and the tooling for Eclipse so that there's no extra step required to get any plugins.