Does SAStruts work with Tomcat7?

Asked 1 years ago, Updated 1 years ago, 79 views

Struts SA < p > it must, you will have movement an application, and by < / > To Tom, 17, moving toward the. < / >

However, javax.servlet.ServletRequestWrapper.isAsyncStarted(ServletRequestWrapper.java:396)
An AbstractMethodError has occurred in .
This method reads
@since Servlet 3.0
In the entity of the request, "org.apache.struts.upload.MultipartRequestWrapper" in Struts 1.2.9,
Not implemented.
(Javadoc said Servlet 2.3).

Therefore, SAStruts using Struts 1.2.9 does not support servlet 3.0, and
I thought that Tomcat7, Servlet 3.0, was not supported.

However, I was wondering if there was any information on the web, but I couldn't find it at all, so I asked you a question.

Actual Code

RequestUtil.getRequest().getRequestDispatcher(input).forward(RequestUtil.getRequest(), ResponseUtil.getResponse());

StackTrace

 1029, 2015 10:11:13 AM org.apache.catalina.core.ApplicationDispatcher invoice
Critical: Servlet.service() in Servlet action threw an exception
java.lang.AbstractMethodError
    at javax.servlet.ServletRequestWrapper.isAsyncSupported (ServletRequestWrapper.java:407)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:225)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:208)
    at org.apache.catalina.core.ApplicationDispatcher.invoke (ApplicationDispatcher.java:748)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest (ApplicationDispatcher.java:486)
    at org.apache.catalina.core.ApplicationDispatcher.doForward (ApplicationDispatcher.java:411)
    at org.apache.catalina.core.ApplicationDispatcher.forward (ApplicationDispatcher.java:338)

Other Environments

  • Eclipse 4.4.1
  • Java 1.7.0_67
  • Compiler Compliance Level 1.7
  • Tomcat 7.0.61
  • SAStruts 1.0.4-sp7

Additional 1

"MultipartRequestWrapper" where this incident occurred seems to be a class that Struts wraps when sending files (when ""enctype="multipart/form-data"" is set in the form of html)."
(Typically, the request was in the ororg.apache.catalina.core.ApplicationHttpRequest でした class.)
In other words, since Struts usually does not wrap requests, there is no problem as Tomcat is using the class.
When sending files, Struts wraps in a Servlet 2.3 compliant? class, so if you try to use the request instance from the class Tomcat is using, you will get an error.

Additional 2

Originally, I think it should be written in the comments, but I cannot, so I will write it in the text.
I think I have come to understand many things by trying the contents you pointed out.Thank you.
On Eclipse, it is WTP, and the project facet setting is 2.5.
We also use maven and specify servlet-api as follows:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId> servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>

Therefore, since 2.5 is used for compilation and not included after build and deployment, 3.0.1? included in Tomcat7 is likely to be used during operation.

When I checked the operation of tutorial, as A-pZ pointed out, the upload sample also worked. (I tried it in 1.0.4-sp7)
When I added the code that encountered this problem to /sa-struts-tutorial/src/main/java/tutorial/action/UploadAction #upload in the tutorial, I found that

RequestUtil.getRequest().getRequestDispatcher("index.jsp").forward(RequestUtil.getRequest(), ResponseUtil.getResponse();

The real method called in the getRequestDispatcher method call of HttpServletRequest (MultipartRequestWrapper) returned by ReRequestUtil.getRequest() 」 appears to be called ggeronimo-servlet_2.4_spec-1.0.jar が in the lib.
In a failed environment, what do you think is the reason why the servlet-api.jar class in Tomcat is the parent and the 3.0 method is called?
In this case, will Tomcat be able to use this, including servlet-api.jar?

Additional 3

The description was omitted, but web.xml is specified as 2.5.
We also investigated the filter, but we did not take any action related to this issue.

Additional 4

RequestUtil is org.seasar.struts.util.RequestUtil.
It is true that I have obtained a 3.x series request here.
The getRequest implementation is as follows:

public static HttpServletRequest getRequest(){
    return SingletonS2Container.getComponent(HttpServletRequest.class);
}

Additional 5

Thank you for reproducing the phenomenon!
Honestly, I don't know why I'm doing forward here because I'm maintaining an application that's been around for a long time. (I'm returning null after forward.)
However, after specifying the jsp file name, I was able to confirm that the problem did not occur and that it worked properly.

java tomcat sastruts

2022-09-30 14:43

1 Answers

SAStruts works on Tomcat 7 series as well.
Tomcat 7 also works "in Servlet 3.0", but also in Servlet 2.x series.

Just to confirm, have you specified Servlet version 3.0 in web.xml?
Or do you have servlet-api.jar 3.0 in your own war file?

The operation check was performed in the following environments:

  • Preiades All in one Eclipse 4.5.0
  • jdk1.7.0_71
  • Compiler Compliance Level 1.7
  • Tomcat 7.0.61
  • operational applications:SA-Struts-tutorial 1.0.4-sp9

Note 1

Lists the jar files located within the web-INF/lib.This is from sa-struts-tutorial, so please check if there is any excess or deficiency.

  • antlr.jar
  • aopalliance-1.0.jar
  • commons-beanutils-1.7.0.jar
  • commons-collections-3.1.jar
  • commons-digester-1.6.jar
  • commons-el-1.0.jar
  • commons-fileupload-1.2.jar
  • commons-io-1.3.2.jar
  • commons-logging-1.1.jar
  • commons-validator-1.2.0.jar
  • geronimo-annotation_1.0_spec-1.0.jar
  • geronimo-ejb_3.0_spec-1.0.jar
  • geronimo-interceptor_3.0_spec-1.0.jar
  • geronimo-jpa_3.0_spec-1.0.jar
  • geronimo-jta_1.1_spec-1.0-tsr.jar
  • geronimo-jta_1.1_spec-1.0.jar
  • jakarta-oro-2.0.8.jar
  • javassist-3.4.ga.jar
  • jstl-1.1.2.jar
  • log4j-1.2.13.jar
  • ognl-2.6.9-patch-20070908.jar
  • poi-3.0-FINAL.jar
  • s2-extension-2.4.44.jar
  • s2-framework-2.4.44.jar
  • s2-tiger-2.4.44.jar
  • sa-struts-1.0.4-sp9.jar
  • standard.jar
  • struts-1.2.9.jar

Note 2

Since you are using WTP, I also used WTP and specified Servlet 3.0 on web.xml just in case, but there was no problem with the operation.

Another possibility might be that if you have a proprietary jar file or a servlet filter that detects and operates on multipart requests, it might have an impact.

Note 3

Thank you for the information.There seems to be no problem with the excess or deficiency of filters and jar files.
Then there was a new question, and it was in the original source

RequestUtil.getRequest()

However, is this RequestUtil a different class, not Struts 1.2.9?
This is because getRequest() did not exist in the requestUtil of Struts2.

(I think you mean getRequest() of MultipartRequestWrapper.but)

I suspect that the servlet request (ServletRequest) I am getting here has not been able to get the 2.x series servlet request.

Note 4

I was able to confirm the phenomenon here.A similar error was detected by retrieving the RequestDispatcher and forward().
One thing I'm curious about is that SAStruts only needs to specify the file name of jsp for the value to return from Action (for example, return "index.jsp") and I don't need to forward as I did with Servlet+JSP. Is there any reason why I have to forward?

I hope it will be helpful.


2022-09-30 14:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.