2014-06-24 9 views
0

링크를 클릭하여 파일을 다운로드 중입니다. jdk1.7, cxf-2.7.5를 사용 중이며 클라이언트와 서버 모두에서 MTOM을 사용할 수 있습니다. UI 들어 struts1.2 사용하고 있습니다. 나는 아래의 예외를OutofMemoryException with Data Handler cxf

[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 

서버 측 코드를 가지고 : 다운로드를 handlde하는 DataHandler에 사용

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()); 
      } 

합니다. 큰 파일의 경우에만 null이 표시됩니다. 큰 파일에 대해서만 예외가 발생합니다. LoggingINInceptceptor와 LoggingOutInterceptor를 주석 처리했습니다.

게시 서비스에 localtransport를 사용하고 있습니다. MTOM 기능이 localtransport에 적용되는지 여부를 알려주십시오. 적용 가능한 경우 코드가 작동하지 않는 이유는 무엇입니까?

답변

0

com.sun.xml.ws.developer.JAXWSProperties 대신 com.sun.xml.internal.ws.developer.JAXWSProperties를 가져올 수 있습니다. 가져 오기를 확인하십시오. 또는 서버에서 HttpTransportPipe.dump를 사용하지 않도록 설정할 수 있습니다.

+0

언급 한 두 가지 가져 오기가 모두 동일합니다. 실제 수입을 알려주고 Java 코드에서 HttpTransportPipe.dump를 비활성화하는 방법을 알려주십시오. – Shriram