[
https://issues.apache.org/jira/browse/AXIS2-3528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thilina Gunarathne reassigned AXIS2-3528:
-----------------------------------------
Assignee: Thilina Gunarathne
> upload large file error! (java heap space)
> ------------------------------------------
>
> Key: AXIS2-3528
> URL: https://issues.apache.org/jira/browse/AXIS2-3528
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Affects Versions: 1.3
> Environment: win xp jdk 1.5.0_06 tomcat 5.0.28 axis2_1.3
> Reporter: portnet mc
> Assignee: Thilina Gunarathne
>
> i had tried to upload and download large file(about 300M) through axis2_1.3
> mtom . i got a error message on uploading test but download is ok. code and
> config file modified are as follows:
> public static boolean upload(String mailboxnum, short greetingType,
> File file, String fileType) {
> try {
> OMElement data = buildUploadEnvelope(mailboxnum,
> greetingType,
> file, fileType);
> Options options = buildOptions();
> ServiceClient sender = new ServiceClient();
> sender.setOptions(options);
> OMElement ome = sender.sendReceive(data);
> String b = ome.getText();
> return Boolean.parseBoolean(b);
> } catch (Exception e) {
> e.printStackTrace();
> }
> return false;
> }
> public static InputStream download(String mailboxnum, short
> greetingType,
> String FileType) {
> try {
> OMElement data = buildDownloadEnvelope(mailboxnum,
> greetingType,
> FileType);
> Options options = buildOptions();
> ServiceClient sender = new ServiceClient();
> sender.setOptions(options);
> OMElement ome = sender.sendReceive(data);
> OMText binaryNode = (OMText) ome.getFirstOMChild();
> binaryNode.setOptimize(true);
> DataHandler actualDH = (DataHandler)
> binaryNode.getDataHandler();
> return actualDH.getInputStream();
> } catch (Exception e) {
> e.printStackTrace();
> }
> return null;
> }
> private static OMElement buildUploadEnvelope(String mailboxnum,
> short greetingType, File file, String FileType) {
> DataHandler expectedDH;
> OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace(
> "http://example.org/mtom/data", "x");
> OMElement data = fac.createOMElement("upload", omNs);
> OMElement fileContent = fac.createOMElement("fileContent",
> omNs);
> FileDataSource dataSource = new FileDataSource(file);
> expectedDH = new DataHandler(dataSource);
> OMText textData = fac.createOMText(expectedDH, true);
> fileContent.addChild(textData);
> OMElement mboxnum = fac.createOMElement("mailboxnum", omNs);
> mboxnum.setText(mailboxnum);
> OMElement gtType = fac.createOMElement("greetingType", omNs);
> gtType.setText(greetingType + "");
> OMElement fileType = fac.createOMElement("fileType", omNs);
> fileType.setText(FileType);
> data.addChild(mboxnum);
> data.addChild(gtType);
> data.addChild(fileType);
> data.addChild(fileContent);
> return data;
> }
> private static OMElement buildDownloadEnvelope(String mailboxnum,
> short greetingType, String FileType) {
> OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace(
> "http://example.org/mtom/data", "x");
> OMElement data = fac.createOMElement("getobject", omNs);
> OMElement mboxnum = fac.createOMElement("mailboxnum", omNs);
> mboxnum.setText(mailboxnum);
> OMElement gtType = fac.createOMElement("greetingType", omNs);
> gtType.setText(greetingType + "");
> OMElement fileType = fac.createOMElement("fileType", omNs);
> fileType.setText(FileType);
> data.addChild(mboxnum);
> data.addChild(gtType);
> data.addChild(fileType);
> return data;
> }
> private static Options buildOptions() {
> Options options = new Options();
>
> options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
> options.setTo(targetEPR);
> // enabling MTOM in the client side
> options.setProperty(Constants.Configuration.ENABLE_MTOM,
> Constants.VALUE_TRUE);
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> options.setProperty(Constants.Configuration.CACHE_ATTACHMENTS,
> Constants.VALUE_TRUE);
> options.setProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR,
> TempDir);
> options
>
> .setProperty(Constants.Configuration.FILE_SIZE_THRESHOLD,
> "4000");
> return options;
> }
> axis2.xml is modified like this :
> <parameter name="enableMTOM">true</parameter>
> <parameter name="enableSwA">true</parameter>
> <!--Uncomment if you want to enable file caching for attachments -->
> <parameter name="cacheAttachments">true</parameter>
> <parameter name="attachmentDIR">C:\\upload\\tep</parameter>
> <parameter name="sizeThreshold">4000</parameter>
> there' an error when large file is upload as follows:
> org.apache.axis2.AxisFault: Java heap space
> at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
> at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
> at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579)
> at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
> at example.client.FileTransferClient1.upload(FileTransferClient.java:39)
> at example.client.FileTransferClient1.main(FileTransferClient.java:154)
> i had change java_opts to -xms1024m and -xmx1024m , it looks like the same .
> there'r many problems like this i have found
> still unsolved .
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]