0

I am starting to learn GWT and created a first very simple project. But when I run the project in Super-Dev Mode and load my first page from the browser, the console in Eclipse displays errors:

NoSuchMethodError: javax.servlet.http.HttpServletResponse.getHeader(String) NoSuchMethodError: javax.servlet.http.HttpServletResponse.isAsyncStarted(String)

From other posts, I understand that I need to check my servlet-api version and that I am likely using an old version.

How do I check which servlet-api version I have and how to change it? From what I have read from other posts I don't understand what I have to do.

I am using the Google App Engine SDK 1.9.58. In the SDK > servlet-api.jar > META-INF folder there is a MANIFEST.MF file , whose content is :

Manifest-Version: 1.0 Created-By: blaze-singlejar Build-GPlatform: gcc-4.X.Y-crosstool-v18-llvm-grtev4-k8

So it does not tell me which Servlet API version I have.

In the same package , there is the HttpServletResponse class, obviously it does not have these two methods.

Thank you

bretondev
  • 129
  • 1
  • 2
  • 13
  • Servlet API version can be fetched by `session.getServletContext().getMajorVersion() and session.getServletContext().getMinorVersion()`. I think you are having missing servlet jar/multiple servlet API jar issue. – Rohit Gaikwad Oct 25 '17 at 11:12
  • @RohitGaikwad How do I get access to the session object ? Ihave made this main method, but of course it does not recognize session : public static void main(String[] args) { session.getServletContext().getMajorVersion(); } – bretondev Oct 25 '17 at 11:31
  • you need a servlet to get the HttpSession. check this https://www.javatpoint.com/http-session-in-session-tracking Otherwise, you can explore the servlet API jar to check API version. https://stackoverflow.com/questions/3913485/how-do-i-know-what-version-of-servlet-api-jar-i-have – Rohit Gaikwad Oct 25 '17 at 11:35
  • @RohitGaikwad see the screenshot I have attached - your link says I shoul look at MANIFEST.MF under META-INF, but I do not have this file.. – bretondev Oct 25 '17 at 12:31
  • @RohitGaikwad sorry I was looking at the wrong place. I looked inside the Google App engine SDK and there there is MANIFEST.MF file but it says : Manifest-Version: 1.0 Created-By: blaze-singlejar Build-GPlatform: gcc-4.X.Y-crosstool-v18-llvm-grtev4-k8 ; so I still do not know which version I have – bretondev Oct 25 '17 at 12:57

1 Answers1

0

I solved my issue by using the GWT SDK 2.5.1 instead of GWT SDK 2.82. I am not 100% sure, but I think GWT SDKs use Servlet 3.0 from version 2.6.0 up. Lower versions use Servlet 2.5 , which is compatible with my GAE version (Google App Engine SDK 1.9.58)

bretondev
  • 129
  • 1
  • 2
  • 13