How can I turn an Eclipse GWT/GAE app into an Eclipse Tomcat/mySQL app? - google-app-engine

Sorry in advance for the long post but the problem I am facing here is quite crucial for me, so here we go...
I have a Eclipse GWT (2.0) Web Application using the the GAE and making transactions with its datastore.
On the other hand I would like to make sure that I can also deploy this web application on another infrastructure than the Google App Engine. Therefore I wanted to debug my web app using another servlet container (Tomcat 6) and another datastore (mySQL or MSSQL or any other, it doesn't really matter for now.)
In order to be able to debug an Eclipse web app with Tomcat it has to carry the Dynamic Web Project facet. If it doesn't then the new server that I add to Eclipse within Servers refuses to pick my GWT module in its list of supported apps. And not only GWT Web Apps don't carry it, but they don't even allow to alter the project's facets at all!
However, I found that adding the few relevant tags to the .project file can make it eligible within Eclipse to allow new project facets additions. Here are the tags I used:
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.appengine.eclipse.core.gaeNature</nature>
So I did that, I could "turn" the project into an Eclipse's Dynamic Web Project and by doing so made it compliant to be added to the list of modules handled by - let's say - Tomcat 6 within Servers.
So that is exactly what I wanted, I can now switch between two debug configurations at will in Eclipse in order to debug my GWT web app either on the App Engine or on Tomcat.
The problem is that adding the Dynamic Web Project facet disturbs the DataNucleus enhancer. For some reason, once the project has become a Dynamic Web Project, it seems that the enhancer is never called anymore and I get this error message saying that some classes haven't been enhanced. Playing with the Google... App Engine... ORM classes or checking/unchecking the Enhancer in Builders wouldn't change anything. Please note that the enhancer issue affects both debug configurations: Tomcat as well as the App Engine.
So I was thinking of two solutions.
(1) Disable the Google plugin's DataNucleus enhancer and perform the enhancements myself. So I installed the DataNucleus plugin to configure project specific enhancements by following their guide about the Eclipse plugin.
They say that by right-clicking on the project one can activate DataNucleus support for the given project's files. Unfortunately, after installing the latest version of their plugin for Eclipse, no such right-click menu appears! I have therefore no way to tell their plugin that I want to activate the enhancements on a given project! How frustrating is that?? (I uninstalled/reinstalled the plugin, let perform plenty of pending Eclipse updates... but still no right-click menu.)
Does anyone know of another way to activate DataNucleus enhancement? For now I would be happy even with a pretty manual trick as it is very critical for me to be able to perform this cross-servlet container debugging within Eclipse.
(2) Use this tip from the official GWT website http://code.google.com/webtoolkit/doc/latest/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT%27s
Ok that works, and for now let's say that it saves my life BUT... it requires hosted mode and therefore doesn't allow the use of GWT 2.0.
So regarding this workaround I would like to know if there is a way to do something similar under GWT 2.0?
Turning the GWT Web App into a Eclipse Dynamic Web Project would be the ideal solution for pursuing the development of my application. As I said above, that way, it is very convenient to switch from the App Engine to Tomcat and vice versa. So I favour workaround (1) over workaround (2). But anyway, some help or piece of advice regarding any of the two points will be very very welcome.
Thank you for reading this very long post!

I always use Google Plugin (GPE) for GWT development even when I deploy to Tomcat, where I simply disable GAE option.
Perhaps, I don't understand the question - but I have had no problems debugging my app running on jetty and then transferring the app to Tomcat. Are there any issues that I need to learn?
In fact, even when my app is plain jsp or servlets, without any GWT, I still used GPE. But GPE would refuse to run jetty without either GWT or GAE enabled. So I simply create a dummy GWT app. In all my years, I had never had to worry about differences between jetty and tomcat. And if I had to write an app where I had to exploit the differences in tomcat over jetty, I would consider myself a lousy programmer.
The only reason I see to push JEE server into an external server, is for profiling the app as it runs on tomcat.
JEE is JEE, whether Tomcat or Jetty. I have heard that some people have a bias against using Jetty, like preferring starbucks over neighbourhood cafe. Coffee is coffee.
I don't understand. May be you could write another thesis to explain why you cannot debug on jetty and then deploy on tomcat.

I ran into the exact same problem, I could edit the properties of my project and see the datanucleus menu in the context so the plugin was definitely working. My issue was I was using the "Java EE" perspective in eclipse. (Juno btw). I switched to the "Java" context and my datanucleus menu was back and I was able to enable support and enable automatic enhancement.
Window -> Show perspective -> Other -> Java

Related

Google App Engine Flexible Environment, Custom Runtime, general newbie questions

I want to build a web application using a mixture of App Engine Standard and Flexible Environment as described in the Google docs (flexible as microservice where third party software is needed, standard for everything else).
I need the mentioned microservice to run latex, a few linux tools and python. What is the best way to go from here?
My guess is:
Build a docker container from a Linux OS and use either Google Pub/Sub, Google Task Queue or plain HTTP for communication with the Standard Env App.
But how is this custom runtime then managed by Google regarding security updates, scaling, loadbalancing and everything else promised in the docs?
Sorry for the rather generic question, the infos are thin IMHO and so I have to ask.
It would be your responsability to re-build the custom runtime images (done during every app deployment) to incorporate security updates. If your Dockerfile references other Google-supplied base images then the security updates for them will be automatically picked up in the process. But for any additional packages or customisations you added to your runtime you may need to incorporate the updates yourself.
Scaling depends on your app's configuration (your responsability), see Service scaling settings.
Google automatically load-balances traffic across your app's instances.

What is the actual advantage of running an AngularJS web app over Node.js instead of a server like Xampp?

As stated in the title,
I don't really understand how Node.js works and above all why it's actually used to run an AngularJS application (e.g. in WebStorm IDE this is the default option when you create an AngJS project).
I've got this doubt since I could run a simple AngularJS app on an Apache web server (within Xampp) without any involvement of NodeJS.
Thank you in advance
Node.js is an application platform. It's good for running your applications on.
Apache HTTPD is a web server. It's good at serving web pages.
They're two very different things, not directly related, and not mutually exclusive.
You are correct that many apps can run anywhere, but some benefits we've seen are:
Simplicity, especially for web developer also developing the server-side code/config/deploy.
Real-time web - easier to add in things like WebSockets and Server Sent Events if you need them.

IOException: Changed index specification

I am developing a GWT 2.5.1 and GAE/J 1.7.6 web app using Eclipse Juno/Google Plugin for Eclipse, and I am experimenting with the Search API. After an upgrade to the 1.7.6 GAE SDK the following started happening:
When the app is running in GAE Dev Mode and my index is populated,
it's subsequently programmatically accessible.
If the Dev Mode is
terminated and started again, programmatic access attempts fail (no results returned) as
follows:
SEVERE: Failed to access index
java.io.IOException: Changed index specification for description_index
at com.google.appengine.api.search.dev.LuceneDirectoryMap.getDirectory(LuceneDirectoryMap.java:198)
at com.google.appengine.api.search.dev.LuceneDirectoryMap$FileBased.getDirectory(LuceneDirectoryMap.java:64)
at com.google.appengine.api.search.dev.LocalSearchService.search(LocalSearchService.java:438)
Since the Search API is in development I would much rather use the SDK with the latest bugfixes and improvements. Does anyone have any suggestions regarding the cause of the exception?
Update
Fixed in App Engine SDK for Java release 1.7.7.1, available from the App Engine Downloads page.
Fix released in 1.7.7.1 SDK for Java. See here
Today, we found the same problem, our only possible fix on this moment was to change the appengine sdk for version 1.7.5 / 1.7.4.
I suppose there are significant changes coming, but until they're stable, we should not use or depend on it.
An issue has been opened for this in Google Code:
https://code.google.com/p/googleappengine/issues/detail?id=9088
If you believe this problem is important for you, and the workaround is not sufficient, then make sure to star the issue so that it gets escalated for repair.

Possible to test website with GAE over LAN in Mountain Lion?

I'm hosting my website using Google App Engine. It's a pretty simple website, but I've got some javascript drawing to a canvas element, which I'm trying to test on my iPhone. I'd also like to take a crack at reworking my CSS for mobile. However, I can't access http://localhost:8080/ (which is the url that GoogleAppEngineLauncher spits out when I run the app locally) from my phone. This seems obvious.
Unfortunately, it seems that Mountain Lion has removed the web sharing preference from system preferences. I found at least two different sites with "solutions" for re-activating web sharing (Apache server?), but none of them seem to work in conjuction with Google App Engine... I also tried this preference pane, which also doesn't work. I keep getting "Safari cannot open the page because it could not connect to the server."
Sorry if this is a stupid question, I'm a relative noob to this stuff. Also, I see a lot of questions here on SO which seem related, but I think I'm still too uninitiated to understand how they're releated. Is there an extra step here that's GAE specific which I'm missing?
This isn't anything specific to your OS. By default, the App Engine dev server binds to the loopback interface, making it accessible only to your machine. If you want to access it from other machines, you need to pass the --address=0.0.0.0 flag to the dev server - which you can do in the launcher's preference pane.
As of March 2013 - the "address" argument has been renamed to "host" - (at least for Python version of the app engine)
--address=0.0.0.0 argument not working after upgrading to App Engine 1.7.6

possible to eliminate JDO/JPA-related JARs from GAE project if using Twig/Objectify/etc?

In my Google App Engine project, I'm currently using Twig for accessing the Datastore (but I suspect my question would be relevant for other 3rd party libs like SimpleDS, Objectify, etc.).
I was thinking that I should be able to delete some or all of the following JARs from my WEB-INF/lib folder:
datanucleus-appengine-[...].jar
datanucleus-core-[...].jar
datanucleus-jpa-[...].jar
geronimo-jpa_[...].jar
geronimo-jta_[...].jar
jdo2-api-[...].jar
But when I do, I get errors from Eclipse complaining that "The App Engine SDK JAR is missing in the WEB-INF/lib directory".
Is it really necessary to retain all these (unused) JARs?
If you're using the Google Plugin for Eclipse you can delete these JARs and then open the Properties for your Google Web Application project and open the Google > App Engine and then uncheck the Use datanucleus JDO/JPA to access the datastore. In fact, unchecking this box actually deletes these JARs for you.
I don't think you can delete them from the project (as you have said, eclipse starts to complain), but I've heard you don't have to upload them to your app, as long as you upload from the command line. This has the advantage that at startup your app won't have to load them up.
There are some details of uploading to app engine via the command line here and confirmation that you can do this here
If you manage to do this I would appreciate it it if you post links to the instructions you followed or post what you needed to do, as I have this on my todo list as well, but only got as far as seeing if it was possible. Thanks!

Resources