how to start all modules instances on dev server?

16,281 views
Skip to first unread message

Tapir

unread,
Jan 2, 2014, 12:03:39 AM1/2/14
to google-a...@googlegroups.com
This page mentions all modules instances will be started. https://developers.google.com/appengine/docs/java/modules/routing
But I don't how to do this. When call dev_server on a second module, it says:

Could not open the requested socket: Address already in use: bind. Try overriding --address and/or --port.

If I call dev_server on the ear directory, it says

com.google.apphosting.utils.config.AppEngineConfigException: Could not locate D:\my-project\ear\WEB-INF\appengine-web.xml

yes, there is no WEB-INF in the ear folder but only a META‑INF folder and module folders in the ear folder.
Can't find document on how to start all module instances.

Tapir

unread,
Jan 2, 2014, 12:32:26 AM1/2/14
to google-a...@googlegroups.com

To deploy the example above, use the appcfg update command, passing the directory path of the EAR:
appcfg update <directory-path>

But when I call

appcfg update D:\my-project\ear

It says the same error: com.google.apphosting.utils.config.AppEngineConfigException: Could not locate D:\my-project\ear\WEB-INF\appengine-web.xml

The folder structure of my-projects is total a clone from the above GAE document link.
Sometimes, GAE documents are really frustrating.

Vinny P

unread,
Jan 2, 2014, 2:31:14 AM1/2/14
to google-a...@googlegroups.com
On Wed, Jan 1, 2014 at 11:03 PM, Tapir <tapi...@gmail.com> wrote:
This page mentions all modules instances will be started. https://developers.google.com/appengine/docs/java/modules/routing
But I don't how to do this. When call dev_server on a second module, it says:
Could not open the requested socket: Address already in use: bind. Try overriding --address and/or --port.



The dev server should be starting up all the modules automatically, you don't need to call the dev server a second time.

When you call the dev server on the second module - after already calling it on the first module - the second dev server instance is unable to run because (as it points out in the error text) the first dev server instance is already bound to the port. So this is correct behavior.


On Wed, Jan 1, 2014 at 11:03 PM, Tapir <tapi...@gmail.com> wrote:
If I call dev_server on the ear directory, it says

com.google.apphosting.utils.config.AppEngineConfigException: Could not locate D:\my-project\ear\WEB-INF\appengine-web.xml

yes, there is no WEB-INF in the ear folder but only a META‑INF folder and module folders in the ear folder.



More than likely, the dev server is interpreting your folder as a basic, single-module application rather than a multi-module application (i.e. JAR rather than an EAR). Can you post the stack trace for the AppEngineConfigException?

 
On Wed, Jan 1, 2014 at 11:32 PM, Tapir <tapi...@gmail.com> wrote:
The folder structure of my-projects is total a clone from the above GAE document link.



Can you try cloning the modules example from here: https://github.com/GoogleCloudPlatform/appengine-modules-sample-java and see if that works for you? 

 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Tapir

unread,
Jan 2, 2014, 4:31:01 AM1/2/14
to google-a...@googlegroups.com


On Thursday, January 2, 2014 3:31:14 PM UTC+8, Vinny P wrote:
On Wed, Jan 1, 2014 at 11:03 PM, Tapir <tapi...@gmail.com> wrote:
This page mentions all modules instances will be started. https://developers.google.com/appengine/docs/java/modules/routing
But I don't how to do this. When call dev_server on a second module, it says:
Could not open the requested socket: Address already in use: bind. Try overriding --address and/or --port.



The dev server should be starting up all the modules automatically, you don't need to call the dev server a second time.

When you call the dev server on the second module - after already calling it on the first module - the second dev server instance is unable to run because (as it points out in the error text) the first dev server instance is already bound to the port. So this is correct behavior.


On Wed, Jan 1, 2014 at 11:03 PM, Tapir <tapi...@gmail.com> wrote:
If I call dev_server on the ear directory, it says

com.google.apphosting.utils.config.AppEngineConfigException: Could not locate D:\my-project\ear\WEB-INF\appengine-web.xml

yes, there is no WEB-INF in the ear folder but only a META‑INF folder and module folders in the ear folder.



More than likely, the dev server is interpreting your folder as a basic, single-module application rather than a multi-module application (i.e. JAR rather than an EAR). Can you post the stack trace for the AppEngineConfigException?

yes, I think so. How to let dev_server not interpret the folder as a single-module app?

The folder structure is like this:
my-project
--- ear
------ META-INF
--------- appengine-application.xml
--------- application.xml
------ default
--------- war
------------ WEB-INF
--------------- appengine-web.xml
---------------- web.xml
------ websockets
--------- war
------------ WEB-INF
--------------- appengine-web.xml
---------------- web.xml

The following is added in application.xml:

  <module>
    <web>
      <web-uri>default</web-uri>
      <context-root>default</context-root>
    </web>
  </module>
  <module>
    <web>
      <web-uri>websokets</web-uri>
      <context-root>websokets</context-root>
    </web>
  </module>

I downloaded the example on git, but I dislike the mvn style so I give up it.
The mvn style hide too many details, so I think it is not a good example to start.

Afte run "dev_appserver.cmd ear", the stack trace is output:

Jan 02, 2014 5:15:46 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
SEVERE: Received exception processing D:\my-project\ear\WEB-INF/appengine-web.xml

com.google.apphosting.utils.config.AppEngineConfigException: Could not locate D:\my-project\ear\WEB-INF\appengine-web.xml
        at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:140)
        at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:75)
        at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:166)
        at com.google.appengine.tools.development.ApplicationConfigurationManager$WarModuleConfigurationHandle.readConfiguration(ApplicationConfigurationManager.java:399)
        at com.google.appengine.tools.development.ApplicationConfigurationManager.<init>(ApplicationConfigurationManager.java:146)
        at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:88)
        at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:139)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:258)
        at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:36)
        at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:226)
        at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:224)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:224)
        at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:94)
        at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:265)
        at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
        at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:219)
        at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:210)
Caused by: java.io.FileNotFoundException: D:\my-project\ear\WEB-INF\appengine-web.xml (The system cannot find the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:146)
        at java.io.FileInputStream.<init>(FileInputStream.java:101)
        at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:137)
        ... 21 more
com.google.apphosting.utils.config.AppEngineConfigException: Invalid configuration
        at com.google.appengine.tools.development.DevAppServerImpl.reportDeferredConfigurationException(DevAppServerImpl.java:445)
        at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:225)
        at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
        at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:212)
        at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:210)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:210)
        at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:277)
        at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
        at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:219)
        at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:210)
Caused by: com.google.apphosting.utils.config.AppEngineConfigException: Invalid appengine-web.xml(D:\my-project\ear\WEB-INF/appengine-web.xml) - Could not locate D:\my-project\ear\WEB-INF\appengine-web.xml
        at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:168)
        at com.google.appengine.tools.development.ApplicationConfigurationManager$WarModuleConfigurationHandle.readConfiguration(ApplicationConfigurationManager.java:399)
        at com.google.appengine.tools.development.ApplicationConfigurationManager.<init>(ApplicationConfigurationManager.java:146)
        at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:88)
        at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:139)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:258)
        at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:36)
        at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:226)
        at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:224)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:224)
        at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:94)
        at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:265)
        ... 3 more

Tapir

unread,
Jan 2, 2014, 4:40:45 AM1/2/14
to google-a...@googlegroups.com
btw, how to use different languages in different modules of one projects?
I heard it is possible, but how to implement it?


On Thursday, January 2, 2014 3:31:14 PM UTC+8, Vinny P wrote:

Vinny P

unread,
Jan 2, 2014, 12:08:48 PM1/2/14
to google-a...@googlegroups.com
On Thu, Jan 2, 2014 at 3:31 AM, Tapir <tapi...@gmail.com> wrote:
How to let dev_server not interpret the folder as a single-module app?

The folder structure is like this:
my-project
--- ear
------ META-INF
--------- appengine-application.xml
--------- application.xml
------ default
--------- war
------------ WEB-INF
--------------- appengine-web.xml
---------------- web.xml
------ websockets
--------- war
------------ WEB-INF



Can you try removing the war directories and moving its contents up one level? So for example:

-ear
-----META-INF
----------appengine-application.xml
----------application.xml
-----default
----------WEB-INF
---------------web.xml and appengine-web.xml
-----websockets
----------WEB-INF
---------------web.xml and appengine-web.xml


If that doesn't work, can you post the text of the appengine-application.xml and application.xml files?


On Thu, Jan 2, 2014 at 3:31 AM, Tapir <tapi...@gmail.com> wrote:
        at com.google.appengine.tools.development.ApplicationConfigurationManager$WarModuleConfigurationHandle.readConfiguration(ApplicationConfigurationManager.java:399)



So yes, it looks like the dev server is attempting to read your application as a WAR, not an EAR. 

Alejandro Gonzalez

unread,
Jan 2, 2014, 12:17:36 PM1/2/14
to google-a...@googlegroups.com
I execute the backends commands directly in the target folder, so first i build it and then:

appcfg update D:\my-project\target\ear-name

When you build your project, in the target folder the WEB-INF at the root directory is your main appengine-web.xml file wich is what you need. Have you tried it?





2014/1/2 Vinny P <vinn...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Rafael

unread,
Jan 2, 2014, 12:20:56 PM1/2/14
to google-appengine
the routing feature doesn't work in dev. 

I had to implement my own routing filter to make the modules kinda work in dev.


--

Vinny P

unread,
Jan 2, 2014, 12:28:02 PM1/2/14
to google-a...@googlegroups.com
On Thu, Jan 2, 2014 at 3:40 AM, Tapir <tapi...@gmail.com> wrote:
btw, how to use different languages in different modules of one projects?
I heard it is possible, but how to implement it?


You can upload applications written in different languages as different versions, then route requests with version-specific URLs such as (assuming 1 is a version ID): 1 . your_application_id_here . appspot . com (remove spaces).

Tapir

unread,
Jan 2, 2014, 6:37:36 PM1/2/14
to google-a...@googlegroups.com
Is the version urls support custom domains?

Tapir

unread,
Jan 2, 2014, 6:39:49 PM1/2/14
to google-a...@googlegroups.com
Thanks for the suggestion.
But it still outputs the same error.

Tapir

unread,
Jan 2, 2014, 6:47:34 PM1/2/14
to google-a...@googlegroups.com


On Friday, January 3, 2014 1:17:36 AM UTC+8, Alejandro Gonzalez wrote:
I execute the backends commands directly in the target folder, so first i build it and then:

appcfg update D:\my-project\target\ear-name

When you build your project, in the target folder the WEB-INF at the root directory is your main appengine-web.xml file wich is what you need. Have you tried it?

Not very understand this. There is no WEB-INF but a META‑INF at the root directory.

Tapir

unread,
Jan 5, 2014, 3:33:33 AM1/5/14
to google-a...@googlegroups.com
Ok, found the problem by accident.

After finding the google maven example on github works well, I copied the META‑INF folder to my project.
A replace files dialog was expected to show up.
But, no, it didn't show!
Then there are two META‑INF folders in my project.
Two identical folders in my project!!!

Researched it for a while, I copy the two folder name into a notepad file, the difference is obvious.
One "‑" character is longer than the other one.
 (But in windows file explorer, they are the same length! However, in IE browser,  the shorter one becomes longer)
The hexdump shows the longer is e22d 9180, the shorter one is 000A.

Ok, the short one is the correct one. It is META‑INF
The longer one is META-INF.

So, it looks it must be my mistake?
Aha, no.
I search the longer one in the google document: https://developers.google.com/appengine/docs/java/modules/
Eh, it seems this page mixes the longer one and the shorter one many times.
I'm so lucky that I picked the wrong one.

Can't believe no one else has found this problem before.
Does this mean there are very few projects using the modules feature?

Tapir

unread,
Jan 5, 2014, 4:25:49 AM1/5/14
to google-a...@googlegroups.com


On Sunday, January 5, 2014 4:33:33 PM UTC+8, Tapir wrote:
Ok, found the problem by accident.

After finding the google maven example on github works well, I copied the META‑INF folder to my project.
A replace files dialog was expected to show up.
But, no, it didn't show!
Then there are two META‑INF folders in my project.
Two identical folders in my project!!!

Researched it for a while, I copy the two folder name into a notepad file, the difference is obvious.
One "‑" character is longer than the other one.
 (But in windows file explorer, they are the same length! However, in IE browser,  the shorter one becomes longer)
The hexdump shows the longer is e22d 9180, the shorter one is 000A.

Ok, the short one is the correct one. It is META‑INF
The longer one is META-INF.

sorry, I messed up, META‑INF is wrong, META-INF is correct.

Tapir

unread,
Jan 5, 2014, 9:24:54 PM1/5/14
to google-a...@googlegroups.com

Andrew Jessup

unread,
Jan 6, 2014, 3:59:58 PM1/6/14
to google-a...@googlegroups.com
Tapir, was the bad character in the App Engine documentation somewhere? If so, where?

Tapir

unread,
Jan 6, 2014, 11:10:39 PM1/6/14
to google-a...@googlegroups.com


On Tuesday, January 7, 2014 4:59:58 AM UTC+8, Andrew Jessup wrote:
Tapir, was the bad character in the App Engine documentation somewhere? If so, where?

En ha, yes, there are some META‑INF and some META-INF.
I have already reported this bug.
And It seems this bug was fixed just now.
At the end of that page, it show "Last updated January 7, 2014."
Reply all
Reply to author
Forward
0 new messages