AlexCartio1
AlexCartio1

Reputation: 238

How to have access to ServletRequestAware on struts2-core 2.3.16.1?

I changed my struts2 version from 2.3.14 to 2.3.16.1, it seems that newest version does not support ServletRequestAware and ServletResponseAware anymore, what should I do? I could not find anything online.

<dependency>    
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.16.1</version>
    <type>jar</type>    
</dependency>

Code

 import org.apache.struts2.interceptor.ServletRequestAware;
 public class MyExample implements ServletRequestAware, ServletResponseAware { 

Error

package org.apache.struts2.interceptor does not exist.

When I try to find a dependency for it Maven shows the latest version of Struts2 which is supporting it is 2.3.14!

Upvotes: -1

Views: 2302

Answers (2)

Roman C
Roman C

Reputation: 1

At the How To Create A Struts 2 Web Application add the following dependency to your pom.xml

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>X.X.X.X</version>
</dependency>

Check the file version X.X.X.X is available in the repository and downloaded to your hard drive.

Upvotes: 0

Andrea Ligios
Andrea Ligios

Reputation: 50271

You probably have some problem with the libraries included in your project;

  • Be sure to erase all the old JARs from the classpath (your WAR / EAR and shared libs on the AS;
  • run Clean Project in your IDE;
  • download Struts2.3.16.1 from Maven or manually from here;
  • check out the ServletRequestAware and ServletResponseAware Interfaces at

    /struts-2.3.16.1/src/core/src/main/java/org/apache/struts2/interceptor/
    

    , exactly where they were before ;)

E.g., output from 2.3.16.3 distribution:

$ jar tvf struts2-core-2.3.16.3.jar | grep ServletRequest
223 Fri May 02 17:23:44 EDT 2014 org/apache/struts2/interceptor/ServletRequestAware.class

It's also in the 2.3.16.1 jars.

Upvotes: 0

Related Questions