myborobudur
myborobudur

Reputation: 4435

Web-Service on Tomcat with Timeout

I have an application witch runs about 30 min. with some input data. It has also test data, so the application takes about 30 sec.

The application should be available in a webservice. I used CXF and tomcat. All works fine with the testdata. With real data there is a timeout after about 1 min: a SocketTimeoutException

I had a look at all timeout parameters (server.xml, all web.xml) but doesn't help.

My application is very memory consuming. I added this vm value to the server -Xmx1600m. Without, I get a OutOfMemoryException

Any idea what I could still try? Can I set the memory on level session? Thanks!

Upvotes: 0

Views: 3222

Answers (2)

user9821050
user9821050

Reputation: 1

You problem is outOfMemory, Can you try to change the parameter -Xmx1600m for -Xmx2048m or more. It into file /etc/init.d/tomcat

### BEGIN INIT INFO
# Provides: tomcat8
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Tomcat 8
# Short-Description: start and stop tomcat
### END INIT INFO

## Source function library.
#. /etc/rc.d/init.d/functions
#export JAVA_HOME=/usr/java/default
export JAVA_HOME=/opt/jdk1.8.0_201
export JAVA_OPTS="-Dfile.encoding=UTF-8 \
  -Dnet.sf.ehcache.skipUpdateCheck=true \
  -XX:+UseConcMarkSweepGC \
  -XX:+CMSClassUnloadingEnabled \
  -XX:+UseParNewGC \
  -XX:MaxPermSize=256m \
  -Xms512m -Xmx2048m"
export PATH=$JAVA_HOME/bin:$PATH
TOMCAT_HOME=/opt/tomcat-latest
TOMCAT_USER=root
SHUTDOWN_WAIT=20

Upvotes: 0

Kevin D
Kevin D

Reputation: 3594

Disclaimer: I've never worked with CXF

This blog here seens to be describing a very similar situation to your timeout.

The sample code given their indicates the use of an HTTPConduit with an HTTPCLientPolicy can solve the issue.

MyWebService service = new MyWebService();
MyWebServicePortType client = service.MyWebServicePort();

Client cl = ClientProxy.getClient(client);

HTTPConduit http = (HTTPConduit) cl.getConduit();

HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setReceiveTimeout(0);

http.setClient(httpClientPolicy);

client.doSomething(...);

Upvotes: 2

Related Questions