0

i'm using struts 2(version 2.3.30), jdk 8, tomcat 10, (jakarta).

Getting the errors while using

HttpServletResponse response = ServletActionContext.getResponse();

eventually, this is using import org.apache.struts2.ServletActionContext which I belive is causing the error

Multiple markers at this line
    - The method getResponse() from the type ServletActionContext refers to the missing type HttpServletResponse
    - The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from required .class files
    - The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from required type org.apache.struts2.ServletActionContext 

I tried using Jakarta plugin "https://github.com/apache/struts-extras/blob/master/struts2-secure-jakarta-multipart-parser-plugin/README.md" but didn't able to resolve I'm currently upgrading my project to tomcat 10 and jdk 8 from tomcat 7 and jdk 7.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
rob
  • 17
  • 9
  • Well yes. When you migrate from Java-EE to Jakarta-EE, you need to change `javax.servlet.*` to `jakarta.servlet.*`. In your source code. And if are using libraries that depend on the `javax.servlet.*` APIs, then you need new versions of those too. – Stephen C May 02 '23 at 06:30
  • 2
    And ... as of the latest Apache Struts release ... they do NOT support Jakarta; see https://issues.apache.org/jira/projects/WW/issues/WW-5141. So, I think you are stuck on Tomcat 9.x until the Struts project catches up. – Stephen C May 02 '23 at 06:34
  • Struts2 6.0.x does not support Jakarta EE 9, so neither does Struts2 2.3.30. You cannot upgrade to Tomcat 10, or you need to get rid of your dependency on struts 2. – Mark Rotteveel May 02 '23 at 12:35

0 Answers0