Working with modules on a local dev server for Java

I am developing a Java Appengine Java application and before doing this I am facing serious testing for problems with my local dev server. I dumped the Eclipse tools because I am more flexible with Netbeans and I am using the Appengine Maven plugin for development.

This is my example project structure:

MyApp
     module-endpoint
     module web
     module ear
    pom.xml

The app works when I build from mvn clean install

in the root folder (myapp) and also when I use the command mvn appengine:devserver

to launch the module-ear app, however I cannot access the cloud endpoints via http://localhost:8080/_ah/api

. I can only access the endpoints API through the dynamically released port when I access it through the admin console http://localhost:8080/_ah/admin

.

The problem with this is that when testing a cloud Javascript client in a module-web project according to the tutorials, I have to use localhost:8080/_ah/api

as my url for testing. Did I miss something?

+3


source to share


4 answers


If the question is still valid, you can always update your pom.xml with flags to define the ports of all your modules:

<plugin>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>${appengine.target.version}</version>
    <configuration>
      <port>8080</port>
      <jvmFlags>
        <jvmFlag>-Xdebug</jvmFlag>
        <jvmFlag>-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n</jvmFlag>
        <jvmFlag>-Dcom.google.appengine.devappserver_module.mymodule2.port=9090</jvmFlag>
      </jvmFlags>
      <disableUpdateCheck>true</disableUpdateCheck>
    </configuration>
  </plugin>

      



Then you can use localhost: 9090 / _ah / api / explorer to test your APIs

+3


source


If you have multiple modules deployed, you need to update your maven program startup setting to recognize different modules. See Sample Java Application Sample at https://github.com/GoogleCloudPlatform/appengine-modules-sample-java .



If you've already done so, then the dispatch.xml file will tell the application engine how to route requests: https://cloud.google.com/appengine/docs/java/modules/routing

+2


source


It worked when I made the endpoints project a default module.

+1


source


dispatch.xml is ignored on devserver, the documentation states the following.

File upload

All upload files are ignored when starting the development server. The only way to target instances is through their ports.

This means that only the default module (usually 8888 or 8080) can be accessed on the configured port. I just tested it with 1.9.25 app and it doesn't work, so there was no improvement.

On the other hand, you can always refer to a module by its port. The location of the module is logged to the console when the application starts, you will see something like:

INFO: Instance module module2-auto works with http://localhost:37251/

It was useless in my case as I expected to make AJAX requests for different modules using the same host (but different urls). For example:

0


source







All Articles