简体   繁体   中英

Glassfish Server 4 post too large error

I have a problem with GF4 while calling a web service I coded using http post. GF4 responds with a "Post too large" error. My post data is about 3MB.

Here is the GF4 debug log:

WARNING:   Post too large
WARNING:   StandardWrapperValve[obx2oex]: Servlet.service() for servlet obx2oex threw exception
java.lang.IllegalStateException: Post too large
    at org.glassfish.grizzly.http.server.Request.parseRequestParameters(Request.java:2024)
    at org.glassfish.grizzly.http.server.Request.getParameter(Request.java:1052)
    at org.apache.catalina.connector.Request.getParameter(Request.java:1547)
    at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:448)
...

I already googled for this issue and found some help that encourages to modify the server configuration. I edited the following part in the domain.xml:

<http-service>
        <access-log></access-log>
        <virtual-server id="server" network-listeners="http-listener-1,http-listener-2"></virtual-server>
        <virtual-server id="__asadmin" network-listeners="admin-listener"></virtual-server>
        <property name="maxPostSize" value="2097152"></property>
</http-service>

and restarted the server. But the error still occurs.

Does anybody know, how to solve this "post too large" issue? Thanks for your help!

PS: I just saw the starting log of the GF4 and it told me:

WARNING: Unsupported http-service property maxPostSize is being ignored

So where should I tell GF4 to accept large post data?

Open Glass Fish administrative console, select

Configurations - server config - Network Config - Network Listeners - http-listener-1

and

tab HTTP.

There is parameter Max Post Size . Increase it as you wish. Look screenshot

My first attempt coding my webservice was a servlet that accepts data via POST parameter of HTTP. That lead to the "Post too large" error, when sending more than 2MB.

I got a suggestions to code it as REST service. It is very strange, but now it works with more than 2MB. Even while the data is sent via http post.

Maybe it should help someone.

But nevertheless I'd like to know, where you can set the maxPostSize value in GF4 server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM