Reputation: 11
I have a Maven Java GAE (Google App Engine) project in Eclipse Oxygen Release 4.7.2 and Google Cloud Tools for Eclipse plugin version 1.5.0. I'm running my Eclipse in a Windows 10 machine.
I have simple a Servlet class in my code:
package it.ale.test;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(name = "HelloAppEngine", urlPatterns = { "/hello" }, loadOnStartup = 1)
public class HelloAppEngine extends HttpServlet {
@Override
public void init() throws ServletException {
super.init();
System.out.println("Print something.");
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
response.getWriter().print("Hello App Engine!\r\n");
}
}
when I put a debug breakpoint on any line of the "public void init()" function, example on the line:
System.out.println("Print something.");
and I start the server in DEBUG mode (Debug As -> App Engine), the server startup is incredible SLOW and I reach the error message:
server app engine Standard at localhost was unable to start within 240 seconds. If the server requires more time, try increasing the timeout in the server editor.
UPDATE 16 January 2018:
in the meantime while the mistake is coming, Eclipse freeze and after that the Java process of the launched server remains hanging. So I cannot restart the server unless I kill the Java server process.
This is a screenshot that represents this point
Note that in the lower right corner the server's Java process has not yet been stopped
This is a screenshot that show the pending stopping state
So I cannot restart the server unless I kill the Java server process.
@BriandeAlwis Is there any log I can provide to help you better? Maybe is a Google Cloud SDK "gcloud" integration problem ?
UPDATE 16 January 2018:
I try to downgrade version in Google Cloud SDK:
but the problem persists.
Now I'm back to the most current version highlighting the problem again.
Upvotes: 1
Views: 883
Reputation: 73
You can fix this issue by deleting your existing server and removing your all break points and restart again your project in app engine
Window->Show View->other->Servers(search for servers if doesn't exists) Window->Show View->other->Breakpoints(search for breakpoints if doesn't exists)
after that simply right click on servers and delete them refresh your work-space and run project it will work. Happy Coding.
Upvotes: 1
Reputation: 4306
This has been fixed since Google Cloud Tools for Eclipse 1.6.0.
For those who are interested in the details, see https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/2727.
Upvotes: 1
Reputation: 11
I updated the plugin to version 1.5.1 and finally I saw that the problem of slow startup, both in DEBUG and in RUN has been solved.
In any case I found that the following problem persists:
In the meantime I discovered another bug ... try replacing the code of the INIT function with this code:
@Override public void init() throws ServletException { super.init(); if (true) { throw new RuntimeException(); } System.out.println("Print something."); }
in this way I force an exception to the start. Try to click on Run As -> App Engine and try to stop the server. The server remains hung in "STOPPING" state.
This means that if there is an exception in the startup code the server will not shut down anymore.
Upvotes: 0