java.lang.NoSuchMethodError: javax.servlet.http.Cookie.setHttpOnly(Z)V

Pawan Patil :

I am using weblogic 10.3.6.0 application server for deploying application . after deploying one of the application which uses JDK8. at run time I got the following error.

java.lang.NoSuchMethodError: javax.servlet.http.Cookie.setHttpOnly(Z)V

contents of dependencies.gradle file are as follows

providedCompile 'javax.servlet:javax.servlet-api:3.0.1'

What would be the reason behind this error?

Karol Dowbecki :

Cookie.setHttpOnly() is available since Servlet 3.0. You are deploying to WebLogic 10 which provides only Servlet 2.5.

Note that your project is compiling against an API dependency and not the actual runtime implementation. This is correct project setup, don't change it. However you must ensure that the APIs that you selected for compilation are provided in the runtime by deploying to the correct server.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=91971&siteId=1