I am working on an Apache Maven dynamic web project on eclipse. It uses static files (html, css, js) and a Java servlet. When I deploy my project to the google app engine, the Java servlet does not handle http requests. The project runs perfectly locally. The servlets use @WebServlet, but adding url-mapping to the xml doesn't work either. I deploy using mvn appengine:update. To troubleshoot, I decided to take a java class from a google github repository. I added the java file to my servlet folder and after deploying I get 404 errors for it as well.
This is my WebServlet annotation:
@WebServlet(name = "requests", description = "Requests: Trivial request",
urlPatterns = "/requests")
Here is the bulk of my pom.xml:
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.54</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>www</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
Where am I going wrong?
Edit:
<?xml version="1.0" encoding="UTF-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<threadsafe>true</threadsafe>
<runtime>java8</runtime>
<warmup-requests-enabled>true</warmup-requests-enabled>
<module>default</module>
<automatic-scaling>
<min-idle-instances>1</min-idle-instances>
<max-idle-instances>automatic</max-idle-instances>
<min-pending-latency>500ms</min-pending-latency>
<max-pending-latency>automatic</max-pending-latency>
<max-concurrent-requests>50</max-concurrent-requests>
</automatic-scaling>
</appengine-web-app>
appengine-web.xml
? The production App Engine standard environment only supports Java 7 and Servlet 2.5. App Engine standard environment for Java 8 is now in beta, but requires an explicit<runtime>java8</runtime>
to be added to yourappengine-web.xml
. – Brian de Alwis Jul 24 '17 at 15:54appengine-web.xml
, but I don't have my source insrc
andwww
, and I don't pin a version onmaven-war-plugin
. I can only suggest you look at the "Tools" menu for in the Developer Console > App Versions and look at the "Debug" and verify that the uploaded archive looks as you expect. And check the logs to see what if there's anything anomalous reported. – Brian de Alwis Aug 3 '17 at 19:24