1

I have 3 java modules using Google Appengine Standard:

The first one module uses Java 7 with Servlet 2.5 + web.xml + Spring 4

The second module uses Java 8 with Servlet 3.1 without web.xml + Spring 5 using WebApplicationInitializer.

The third module is just to frontend files (HTML,CSS).

I have a dispatch.yaml that contains route for each module.


If I run only java8 module using:

mvn appengine:run OR /usr/lib/google-cloud-sdk/bin/java_dev_appserver.sh, 

It is ok, the modules run.

If I use: dev_appserver.py theJava8Module, happens the follow problem:

google.appengine.tools.devappserver2.errors.AppConfigNotFoundError: The "target/theJava8Module/WEB-INF" subdirectory exists but is missing web.xml

Before I had this java8 module, I used to run with this command:

dev_appserver.py --max_module_instances=1 frontendmodule/frontendmodule.yaml dispatch/dispatch.yaml java7Module/target/java7Module --dev_appserver_log_level=debug

When I use this command, it is ok, the 2 modules run and I can use the application and dispatch rules.


My question is, is there any way to run more than one module and using dispatch rules? Can I user dev_appserver.py (python) to run java8 application that does not have web.xml? Or Can I user mvn:appengine to run multiple modules and use dispatch.xml or dispatch.yaml?

Important: Could I run separete modules using mvn:appengine and dev_appserver, the problem is that the ports will be different, so the dispatch rules won't work.

Example:

dev_appserver.py --max_module_instances=1 frontendmodule/frontendmodule.yaml dispatch/dispatch.yaml java7Module/target/java7Module --dev_appserver_log_level=debug (port 8080)
mvn appengine:run java8module (port 9090)

enter image description here

Victor M Perez
  • 2,185
  • 3
  • 19
  • 22
javaTry
  • 1,085
  • 2
  • 18
  • 30

2 Answers2

1

The User Guide for the appengine-maven-plugin covers running multiple modules. See if it helps.

Mike E.
  • 372
  • 1
  • 6
  • Hi, but, How I make a deploy of dispatch.yaml? My frontendmodule sends request to other modules, the dispatch has rules that forward for right module. Using mvn appengine:run can I deploy a dispatch too? The frontendmodule it is a app.yaml: #application: gae-microservices service: default runtime: python27 api_version: 1 threadsafe: true – javaTry Feb 23 '18 at 20:49
  • appengine:run simply runs the app locally. If you want to deploy the dispatch file, use appengine:deployDispatch. See: https://cloud.google.com/appengine/docs/standard/java/tools/maven-reference – Mike E. Feb 23 '18 at 22:23
  • I would like to "deploy" locally, like this example: dev_appserver.py --max_module_instances=1 frontendmodule/frontendmodule.yaml dispatch/dispatch.yaml java7Module/target/java7Module --dev_appserver_log_level=debug. In this case, I could run all modules and dispatch rules. – javaTry Feb 26 '18 at 22:06
  • FWIW, at least in python the local devserver can't run hostname-based dispatch.yaml rules. There are warning messages indicating it if it's the case. But there may be ways to work around it. – Dan Cornilescu Feb 27 '18 at 16:53
0

Regarding your module with Java7, you should know about the deprecation of Java7 runtime environment by Google Cloud.

Can I user dev_appserver.py (python) to run java8 application that does not have web.xml?

The Local Development Server for Java is documented here:

The App Engine SDK for Java includes a local development server for testing your application on your computer. The local development server simulates the App Engine Java runtime environment and all of its services, including Datastore.

The syntax description for the appengine-web.xml reference says that:

..... An App Engine Java app must have a file named appengine-web.xml in its WAR, in the directory WEB-INF/. This is an XML file whose root element is <appengine-web-app>. ....

Can I use mvn:appengine to run multiple modules and use dispatch.xml or dispatch.yaml?

According to this doc:

All dispatch files are ignored when running the local development server. The only way to target instances is through their ports.

Victor M Perez
  • 2,185
  • 3
  • 19
  • 22
  • ..... An App Engine Java app must have a file named appengine-web.xml in its WAR, in the directory WEB-INF/. This is an XML file whose root element is . .... But the problem is because I am using servlet 3.1 without web.xml, I can run multiples modules with dispatch file with servlets 2.5 because I can use dev_appserver.py, this is the reason to want to run dev_appserver.py using servlet 3.1 – javaTry Mar 26 '18 at 20:15