Google app engine on existing maven-tomcat projects - eclipse

I am running Magnolia CMS on a tomcat 7, I would like to leverage Googles App Engine(GAE).
From googles documentations i understand that it is enough to include the GAE plugin to my root pom.xml within the build tags, see below:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.31</version>
</plugin>
In Googles documentation it states that I also have to add appengine-web.xml in my WEB-INF folder which i did - not sure if its even getting picked up...
Google states that to start the application you need to execute mvn appengine:devserver and to upload it to google mvn appengine:update.
When i atempted to use these commands mvn appengine:devserver and mvn appengine:update i get failures .....also im not sure im supposed to run them considering my existing setup
[INFO] Initializing Log4J
[INFO] Initializing Log4J from [WEB-INF/config/default/log4j.xml]
[INFO] 2016-02-07 21:08:47,159 ERROR info.magnolia.init.MagnoliaServletContextListener : Oops, Magnolia could not be started
[INFO] java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google App Engine developer's guide for more details.
[INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:52)
[INFO] at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
[INFO] at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)
[INFO] at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
[INFO] at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
[INFO] at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)
[INFO] at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
Some points to note, project has many maven modules, only one module needs GAE. Project is running Java 8. Feature in GAE needed is Task Queue API. Eclipse version is Luna 4.4.1. Magnolia version 5.4.3. Tomcat is started from within eclipse in server configuration
Question: what is the right approach to making these two systems talk to each-other, so i can leverage GAE capabilities in my already existing project running on tomcat?

Related

Does lombok work with GWT super dev mode?

I use lombok extensively at backend, it's really nice and I hope to integrate it into GWT, so I can take advantage of the magic.
I managed to let gwt-maven-plugin recognize lombok by using the -javaagent:lombok.jar=ECJ vm args to be able to compile successfully, however, I'm not sure how to make it work with GWT super dev mode, as it continues complaining "missing getter method" in my IDE(Intellij IDEA).
Also tried the delombok goal of lombok-maven-plugin but without luck.
Any ideas?
Make sure to delete your workDir before starting gwt:run-codeserver. This directory might contain files from previous (lombok-unaware) compilation attempts.
[INFO] --- gwt-maven-plugin:2.8.0-beta1:run-codeserver (default-cli) # Web ---
[INFO] Turning off precompile in incremental mode.
[INFO] Super Dev Mode starting up
[INFO] workDir: C:\Users\jzaruba\AppData\Local\Temp\gwt-codeserver-1653004051676437159.tmp
This is what my mvn-gwt-codeserver.bat looks like:
call mvn clean dependency:properties gwt:run-codeserver %*
(I added dependency:properties because my gwt-maven-plugin configuration refers to Lombok via project dependency: ${org.projectlombok:lombok:jar}, i.e. no static path.)
And if you don't like launching the codeserver from command line, this is how "VM arguments" in my "GWT Codeserver" launch configuration look like:
-javaagent:path/to/lombok.jar=ECJ

Can not reflect changes using gwt-maven-plugin superdev

Follow steps in this post,
I use gwt-maven-plugin 2.6.0, when I run mvn gwt:run-codeserver it compiled successfully:
[INFO] binding: user.agent=safari
[INFO] Compiling module com.example.myModule
[INFO] Validating units:
[INFO] Ignored 3 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] ...
[INFO] Compiling 1 permutation
[INFO] Compiling permutation 0...
[INFO] Source Maps Enabled
[INFO] Compile of permutations succeeded
[INFO] Linking into C:\Users\admin\AppData\Local\Temp\gwt-codeserver-5664784549647002986.tmp\com.example.myModule\compile-4\war\myModule;
Writing extras to C:\Users\admin\AppData\Local\Temp\gwt-codeserver-5664784549647002986.tmp\com.example.myModule\compile-4\extras\myModule
[INFO] Link succeeded
[INFO] Compilation succeeded -- 3.401s
[INFO] Compile completed in 3496 ms
Then I started the dev server using mvn install gwt:run, made changes on my source file and click the Dev Mode On bookmark. After compiling the changes cannot reflect to UI: the UI always show old values.
Any ideas on this problem?
There's a bug in gwt-maven-plugin up to (including) 2.6.0; you have to run mvn process-classes gwt:run-codeserver instead of just mvn gwt:run-codeserver. This is fixed in 2.6.1.
Also, if you change anything in src/main/resources, you'll have to run mvn process-resources to make your changes available to Super Dev Mode (this is because you might use resource filtering, so Super Dev Mode doesn't directly look at src/main/resources).
Similarly, if you use plugins that generate resources or Java sources, you'll have to run them manually (e.g. mvn generate-sources or mvn generate-resources; or just use the same mvn process-resources as above, which will do everything at once). This will be necessary for example if you use gwt:generateAsync and change your GWT-RPC interface (note that you'll also have to redeploy your server-side code).
Note: I just updated my answer in the linked post for GWT 2.6.0, and added a note about GWT-RPC, and the gwt-maven-plugin bug.

PlayN + Eclipse not working. DependencyResolutionException

I've never used PlayN before. I tried following the direction Google gives for it, but all I get is errors. I'm using Eclipse, I've got Maven installed, and I imported the sample projects as directed. I keep getting:
[INFO] Building PlayN Hello Android 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.googlecode.playn:playn-hello-core:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
This is completely meaningless to me. Can someone explain what is going on? How to resolve it?
It seems that your core's POM is missing, I would recommend that you try to create a new archetype directly from Maven and then try open the project with Eclipse to see if this helps, also you should check that you're using Maven 3, if I remember well Maven 2.X gave some problems creating and building the PlayN archetype.

Problem upgrading to GWT 2.3.0

I'm totally flummoxed by a GWT problem, and have no clue how to interpret the GWT log or how to troubleshoot the problem. I'm working on a fairly trivial template project. I upgraded to GWT 2.3.0 and am now running into the following issue when compiling the module using the maven-gwt-plugin:
[INFO] --- gwt-maven-plugin:2.3.0:compile (default) # gaewebtemplate ---
[INFO] auto discovered modules [stuff.gaegwttemplate.Main, stuff.gaegwttemplate.security.SecurityRequest]
[INFO] Loading inherited module 'com.google.gwt.activity.Activity'
[INFO] Loading inherited module 'com.google.gwt.place.Place'
[INFO] Loading inherited module 'com.google.gwt.user.User'
[INFO] Loading inherited module 'com.google.gwt.animation.Animation'
[INFO] Loading inherited module 'com.google.gwt.core.Core'
[INFO] Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker'
[INFO] [ERROR] Unable to load class 'com.google.gwt.core.linker.DirectInstallLinker'
[INFO] java.lang.ClassNotFoundException: com.google.gwt.core.linker.DirectInstallLinker
< Huge stack-trace removed >
[INFO] [ERROR] Failure while parsing XML
[INFO] com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
< Huge stack-trace removed >
[INFO] [ERROR] Unexpected error while processing XML
[INFO] com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
The two stack traces and cryptic error messages above is then repeated creating page after page of (as far as I can tell) completely useless log information.
Does anyone know what might be going on here? Any idea what logging "strategy" Google is using here :).
Gunnar,
I ran into a similar issue. If you are trying to use a GWT SDK newer than the maven plugin, you have to also point the maven plugin to that SDK, like this:
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/using-different-gwt-sdk-version.html
Otherwise, I believe the maven plugin will still use the GWT version that matches it (if you were to delete your GWT jars from your maven repo, you could confirm this by seeing it downloading the older version.)
The DirectInstallLinker class doesn't appear to be present in GWT 2.3, but I do see it in trunk - are you sure you are using 2.3.0? To get this error, it seems likely that you have at least one copy of something newer than 2.3.0 on your classpath.
GWT 2.3.0 was released on May 2, while the DirectInstallLinker doesn't appear to have been added to source until May 6.
The GWT compiler is using the TreeLogger class, built in to GWT as a way for the compiler and generators to nest debug/error/info messages.
I got the same error when upgrading from gwt 2.3 to gwt 2.4. I was being silly and updated the version on the gwt-user dependency but not on the gwt-dev dependency. So, check that you aren't also being silly.

GWT Development Mode with Eclipse/Maven

I am just starting with GWT. I use Eclipse and have installed the GWT plugin.
I have followed the directions here Maven GWT 2.0 and Eclipse to set up a GWT project using the gwt-maven-plugin. When I run the Maven goals gwt:compile gwt:run, GWT Development Mode is launched and I can copy the url from it to my browser and view the label.
However, the project has this problem:
Description: The web.xml file does not exist
Resource: WEB-INF
Path: /GWTExample/war
Location: Unknown
Type: Google Web App Problem
If I try to run the project as a Google Web Application, I get this warning:
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
I can get rid of the problem by copying the web.xml to the war directory, but I still get the URL issue when running as a Google Web App.
If I'm using Maven and GWT in Eclipse, should I just ignore the web.xml problem and always run applications in development mode via the Maven goals? Or is there a way to set things so I can run as a Google Web App?
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run? I have added breakpoints to my application but it doesn't stop on them. I'm not sure if it is something I've configured wrong or if it's just not possible.
Update:
In response to Prem's answer...
When I run a compile gwt:run, the web.xml file isn't copied. When I run the install gwt:run, I get this error:
[INFO] --- gwt-maven-plugin:1.2:test (default) # SampleGWT ---
[INFO] using GWT jars from project dependencies : 2.0.4
[INFO] establishing classpath list (scope = test)
[ERROR] java.lang.NoClassDefFoundError: org/codehaus/mojo/gwt/test/MavenTestRunner
[ERROR] Caused by: java.lang.ClassNotFoundException: org.codehaus.mojo.gwt.test.MavenTestRunner
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[ERROR] Could not find the main class: org.codehaus.mojo.gwt.test.MavenTestRunner. Program will exit.
[ERROR] Exception in thread "main"
I’m guessing that bug http://jira.codehaus.org/browse/MGWT-24 is included in version 1.2 of the gwt-maven-plugin. Normally I wouldn’t run install on a project that builds a war file, but I would expect to at least get past the test phase of the build cycle.
Does anybody have any idea why I would get this error on the install but not the compile goals? Also, should I be expecting either goal to copy the web.xml file from src/main/webapp/WEB-INF/web.xml to the /war directory?
Description: The web.xml file does not exist
gwt-maven-plugin creates a project with 'war' packaging format (it's a web app so no surpirse here). Web.xml for this project will be under 'src/main/webapp' folder which will be copied to the 'war' directory (which is set as the output directory) as part of the 'resources' phase in the maven build life-cycle. You should always use
mvn compile gwt:run
or
mvn install gwt:run
so that resources are copied, all java files are compiled and gwt:compile is also invoked (since it is bound to the 'compile' phase automatically)
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
As per the stackoverflow link you used as reference, only your maven build file is setup with startupUrl. In order for it to work in Eclipse, you must edit the Run Configuration of your project and add the '-statupUrl' command line arguments to the existing arguments in the "Arguments" panel.
However, this is just a warning and it should not stop you from running your GWT application from eclipse. If you are facing the same "web.xml" problem here as well, it could be because you did not compile your project in your IDE before invoking "Run as Web Application". I suggest you to disable "Build Automatically" option for this project and always build it manually and invoke "GWT Compile" and then try "Run as web application"
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run?
In general you must use "Remote Application" debug configuration for remote debugging a process. However I am not sure if it will work for GWT projects.
I got me too this warning:
No startup URLs supplied and no plausible ones found
when I have followed this gwt tutorial
In that screenshot there is no checkbox with "Generate sample code" . In my IDE ( sdk 2.5) it is, so I have unchecked...
It wasn't created any of the server and client packages, I have created the client manually, as the tutorial required. The tutorial until that step doesn't say I must have a server package too. That and his configuration is missing from project.
If you right-click on your project and go to Properties -> Google -> Web Application, your WAR directory might be something like either war or src/main/webapp/WEB-INF/classes.
Change that to src/main/webapp.
Also un-check the box next to "Launch and delploy from this directory..."
That's what fixed this problem for me. It also fixed the "can't find gwt-servlet.jar" problem at the same time.