Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Datahandler cxf的OutofMemoryException_Java_Apache_Web Services_Cxf_Datahandler - Fatal编程技术网

Java Datahandler cxf的OutofMemoryException

Java Datahandler cxf的OutofMemoryException,java,apache,web-services,cxf,datahandler,Java,Apache,Web Services,Cxf,Datahandler,我正在通过单击链接下载文件。我在客户端和服务器中使用jdk1.7、cxf-2.7.5和启用的MTOM。对于UI,我使用struts1.2。 我得到了下面的例外 [default-workqueue-8] ERROR consoleErrorLog - Exception in thread "default-workqueue-8" [default-workqueue-8] ERROR consoleErrorLog - java.lang.OutOfMemoryError: Java he

我正在通过单击链接下载文件。我在客户端和服务器中使用jdk1.7、cxf-2.7.5和启用的MTOM。对于UI,我使用struts1.2。 我得到了下面的例外

[default-workqueue-8] ERROR consoleErrorLog - Exception in thread "default-workqueue-8" 
[default-workqueue-8] ERROR consoleErrorLog - java.lang.OutOfMemoryError: Java heap space
[default-workqueue-8] ERROR consoleErrorLog - 

[default-workqueue-6] WARN org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://com.java.test.task/}TestService#{http://api.services.test.task/
}getTestFile has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: Pipe closed
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:258)
    at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)
    at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:114)
    at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
    at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.local.LocalConduit$1$1.run(LocalConduit.java:143)
    at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
    at java.lang.Thread.run(Thread.java:722)
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[java.io.IOException: Pipe closed]
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
    at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:95)
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:539)
    at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:233)
    ... 13 more
Caused by: java.io.IOException: Pipe closed
    at java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:261)
    at java.io.PipedInputStream.receive(PipedInputStream.java:227)
    at java.io.PipedOutputStream.write(PipedOutputStream.java:149)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:51)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.flushBuffer(UTF8XmlOutput.java:418)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.text(UTF8XmlOutput.java:371)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Base64Data.writeTo(Base64Data.java:313)
    at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.text(UTF8XmlOutput.java:312)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:356)
    at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$PcdataImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:183)
    at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:256)
    at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:130)
    at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:361)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:156)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:131)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:333)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:340)
    at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:76)
    at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
    ... 17 more
服务器端代码:

DataHandler theDataHandler =    new DataHandler(new FileDataSource(new File("filename"");
            aResponse.setHeader("Pragma", "dummy");
            aResponse.setHeader("Cache-Control", "private");
            String contentType = "text/plain";
            aResponse.setContentType(contentType);
            aResponse.setHeader("Content-Disposition",
                    "attachment; filename=\"" + name + ".txt\"");

            if (theDataHandler != null)
            {
                downloadFile(inputStream from datahandler, response OutputStream());
            }
使用Datahandler处理下载。我只为更大的文件设置null。 只有大型文件才会出现此异常。 我已经注释掉了LogginInterceptor和LoggingOutInterceptor


我正在使用localtransport进行发布服务。请告诉我MTOM功能是否适用于本地传输?如果适用,为什么代码不工作?

检查您的导入。可能是您正在导入com.sun.xml.internal.ws.developer.JAXWSProperties,而不是com.sun.xml.ws.developer.JAXWSProperties。 或
您可以尝试在服务器中禁用HttpTransportPipe.dump。

您提到的两个导入都是相同的。请告诉我实际的导入,并告诉我如何在java代码中禁用HttpTransportPipe.dump。