OutOfMemory issue when loading 350 MB app via axis2 web services

I am trying to download a 350MB application over SOAP interface (with MTOM enabled) and send an attachment to axis2 web services.

Axis2 Web Services are configured to enable MTOM on the server. Server side caching is also enabled. The following configuration is in axis2.xml:

<parameter name="enableMTOM">true</parameter>

      

and

<parameter name="cacheAttachments">true</parameter>
<parameter name="attachmentDIR">C:\Temp\TempWS</parameter>
<parameter name="sizeThreshold">8000</parameter>

      

Tomcat Setting

The max heap size in tomcat is set to 3000 MB (see screenshot above), but still web services are throwing me below exception:

Java heap space
java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Arrays.java:2694)
    at java.lang.String.<init>(String.java:203)
    at java.lang.StringBuffer.toString(StringBuffer.java:561)
    at org.apache.axiom.util.base64.Base64Utils.encode(Base64Utils.java:81)
    at org.apache.axiom.om.impl.llom.OMTextImpl.getText(OMTextImpl.java:264)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getText(OMElementImpl.java:786)
    at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:334)
    at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:407)
    at org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:682)
    at org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:630)
    at org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:562)
    at org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:153)
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:188)
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at com.csdcsystems.amanda.servlet.AmandaAxisServlet.service(AmandaAxisServlet.java:103)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

      

My questions:

  • Can someone help me understand what I am not seeing? Is there any additional setting that should be in tomcat config?
  • How can I support large upload / download attachments via axis2 web services?

Note. The service is configured to have the [] byte as the service I / O parameter.

+3


source to share


1 answer


Try to increase the heap space with

C:\tomcat-7.0.57\bin>set JAVA_OPTS=-Xmx1g
C:\tomcat-7.0.57\bin>startup.bat

      



this will start jvm with 1GB of heap space if still throws try 2g exception.

If you are using tomcat via eclipse go to "Run Configurations", select your project, open the "Arguments" tab and add -Xmx1g to "VM Arguments"

0


source







All Articles