Play framework websevice - activator start issue when passing the base64
Asked Answered
B

1

1

I am creating web-service APIs using the Play framework with Java. I have created the service successfully.

WHAT I DID:

In one web service request, I have sent the base64 string. If I passed the base64 string in the request, I got the below exception.

[warn] p.nettyException - Handling TooLongFrameException
org.jboss.netty.handler.codec.frame.TooLongFrameException: An HTTP line is larger than 4096 bytes.

After searching in the internet, I got the below solution.

export SBT_OPTS="-Xms1024m -Xmx3084m -XX:MaxPermSize=1024m -Dhttp.netty.maxInitialLineLength=8192"

After setting the SBT_OPTS, I can pass the base64 string in the request and receive it on the server side successfully.

I used the following command for debugging purpose - "activator -jvm-debug 9999 run". So it is working fine.

WHAT IS ISSUE:

But now I tried to deploy this as service. So that I used the following commands - "activator start" (or) "activator start $SBT_OPTS" (or) "activator $SBT_OPTS start".

When I use this commands to start the service, I got the same above issue - "An HTTP line is larger than 4096 bytes."

Can anyone help me to fix this issue?

Bricky answered 18/5, 2015 at 14:56 Comment(2)
Did you check playframework.com/documentation/2.3.x/ProductionConfigurationMccammon
@MonCalamari Thank you for the response. I did check the link. Can you tell me, Where do I set the http.netty.maxInitialLineLength?Bricky
S
0

Please add the below line in your application.conf, then you don't need to set any config at runtime

parsers.text.maxLength=7024K

Its accept the request data upto 7MB, if you need more, you can set it. https://www.playframework.com/documentation/2.3.x/JavaBodyParsers

Slideaction answered 19/5, 2015 at 4:3 Comment(6)
Thank you for the response. I did set the parsers.text.maxLength. But still I did get the same issue. Can you please tell me, where do I set the http.netty.maxInitialLineLength?Bricky
You need to set it on application.conf, also please take a look "Max content length" in playframework.com/documentation/2.3.x/JavaBodyParsersSlideaction
I did set parsers.text.maxLength=7024K. But even I did get the issue "An HTTP line is larger than 4096 bytes".Bricky
Did you clean and compile the app after the changes you made?Slideaction
Yes. I am using eclipse as IDE. So it is compiled the code once I clean the project. But still I am getting the issue. Can you help me to fix this.Bricky
official doc parsers.text.maxLength is for body length. If you had error by URL length, set http.netty.maxInitialLineLength at System.Properties.Knell

© 2022 - 2024 — McMap. All rights reserved.