I have been developing a web application (written using Java 8, CSS, JS, HTML) and testing it regularly on Google App Engine standard environment for the past couple of years with no problems, whatsoever. The structure of my app is as follows:

  1. myCommonEntities (written entirely in Java, produces a standard .jar file when compiled)
  2. myCommonTransactions (written entirely in Java, produces a standard .jar file when compiled)
  3. myCommonUtilities (written entirely in Java, produces a standard .jar file when compiled)
  4. myAppServer (written entirely in Java, produces a standard .jar file when compiled)
  5. myAppWeb (written using js, css, html, produces a standard .war file and includes the above 4 jars)

This is the portion of the pom.xml file that is invoked for deploying to GAE:

<build>
    <plugins>
        <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-maven-plugin</artifactId>
            <version>1.9.64</version>
            <configuration>
                <enableJarClasses>false</enableJarClasses>
                <version>1</version>
                <devAppserverLogLevel>warning</devAppserverLogLevel>
            </configuration>
        </plugin>
    </plugins>
</build>

I used to deploy the app using the following command from the myWebApp directory: mvn appengine:update

For the last 4 days, I have been unable to deploy my app using the above-described method. The mvn appengine:update command returns with the following error: Application deployment failed. Message: Deployments using appcfg are no longer supported

After searching around, as per this web page, I realized that the appcfg method of deploying is deprecated and is now superseded by the gloud app deploy method. After downloading the same, I deployed my app using this command: gcloud app deploy.

The problem is, the gloud app deploy method of deploying uploads only the source code in src/main/webapp folder, i.e., all css, html and js gets uploaded. However, the 4 jar files that contain entities, transactions, utilities and server code do NOT get uploaded, which consequentially results in a ClassNotFoundException when the web page is accessed.

So I searched again if I am missing something and I found this page. Therein, and I quote ad verbatim from this page...it says....

An example Here is an example of how you would configure the various files in a WAR directory structure for an application that has two services: a default service that handles web requests, plus another service (named my-service) for backend processing. Assuming that the top-level EAR directory is "my-application," define the file my-application/META-INF/appengine-application.xml:

As far as my app is considered, what is exemplified in the above quote as "my-service" is equivalent to myServerApp and what is exemplified in the above quote as "default service" is equivalent to myWebApp.

Does this mean that my app, under the new scheme of deployment, will get deployed ONLY IF I convert my above-described project structure to an "ear" structure? Alternatively, is there a way for me to deploy my app WITHOUT having to change from the existing structure to an "ear" structure?

Any help in this matter will be highly appreciated. I am willing to take flak if I have completely misunderstood the method of migrating from the old way to the new way.

1

There are 1 best solutions below

0
On

.....and it happened again.....the deploy process completed successfully (as per the messages in the console) but the very first call to a server-side java class resulted in ClassNotFoundExeption.........and this was (and still is) intermittent.

Turns out that when you click the Google Cloud Tools button -> Deploy to App Engine Standard, all code is dumped in <YOUR_PROJECT_NAME>\.metadata\.plugins\com.google.cloud.tools.eclipse.appengine.deploy\tmp\1602065809544\staging and the deploy process deploys from this folder.

The timestamp (that is part of the folder name above) is the time at which the deploy was initiated. Upon examining the contents of WEB-INF\lib folder inside staging above, I realized that the sizes of the jar files.....commonEntities and commonAppServer were 10s of KBs rather than 100s of KBs and 100s of MBs respectively. This implies that the deploy process is not sourcing the files for deploying in a proper manner.

I am not equipped to define proper because I am not the author of the deploy process but whoever is, should look into this.

My solution: delete all contents of the tmp folder, rebuild all the projects and deploy afresh. It is a bit tiresome, but hey, it works!!!