AnsweredAssumed Answered

error retrieving an image using web-services

Question asked by hvyas on Jun 20, 2006
Latest reply on Aug 17, 2007 by hvyas
I get  the  following error when I try to retrieve an image using webservices.

ERROR [[localhost].[/alfresco].[downloadContent]] Servlet.service()
for servlet downloadContent threw exception
org.alfresco.error.AlfrescoRuntimeException: Error during download content servl
et processing: Failed to copy content to output stream:


———————————————————————————

The following is the Code

———————————————————————————-
  // Get a reference to the respository web service
RepositoryServiceSoapBindingStub repositoryService = getRepositoryService();        
             
Query query = buildQueryForDocumentById(docId);
             
// Execute the query
QueryResult queryResult = repositoryService.query(STORE, query, false);
             
ResultSet resultSet = queryResult.getResultSet();
ResultSetRow[] rows = resultSet.getRows();
if (rows == null)
{
     System.out.println("No query results found.");
  docVO.setContent(new ResourceReader().getProJISPhotoTimeout());
}
else
{

            
        // Get the content service
   ContentServiceSoapBindingStub contentService = getContentService();                 
    // Get the id of the first result
   String firstResultId = rows[0].getNode().getId();
  Reference reference = new Reference(STORE, firstResultId, null);
                 
      //Read the content from the respository
               
Content[] readResult = contentService.read(                                                new Predicate(new Reference[]{reference}, STORE, null),
                                                      Constants.PROP_CONTENT);
             
    Content content = readResult[0];

String mimeType = getMimeType(rows);      
DocumentVO docVO = new DocumentVO();                      
docVO.setContent(ContentUtils.convertToByteArray(ContentUtils.getContentAsInputStream(content)));
docVO.setMimeType(mimeType);
}//end of else

———————————————————————————–


The following is the stack trace

————————————————————————————

17:37:54,549 DEBUG [webservice.authentication.AuthenticationWebService] Issued t
icket 'TICKET_032222ce-fff5-11da-aadd-f58b22fa211f' for 'admin'
17:37:54,579 DEBUG [webservice.axis.TicketCallbackHandler] Verifying ticket for:
ticket
17:37:54,579 DEBUG [webservice.axis.TicketCallbackHandler] Ticket: TICKET_032222
ce-fff5-11da-aadd-f58b22fa211f
17:37:54,599 DEBUG [webservice.axis.TicketCallbackHandler] Ticket validated succ
essfully
17:37:54,599 DEBUG [webservice.axis.QueryConfigHandler] QueryHeader was not foun
d for call to query
17:37:54,609 DEBUG [webservice.repository.ResultSetQuerySession] Before getNextR
esultsBatch: org.alfresco.repo.webservice.repository.ResultSetQuerySession@15781
6a (id=032b4a90-fff5-11da-aadd-f58b22fa211f batchSize=-1 position=0 store=worksp
ace:SpacesStore language=lucene statement=(TYPE:"{http://www.alfresco.org/model/
content/1.0}content" AND (@\{http\://www.alfresco.org/model/content/1.0\}name:10
91 )))
17:37:54,689 DEBUG [webservice.repository.ResultSetQuerySession] Total rows = 1,
current batch size = 1
17:37:54,699 DEBUG [webservice.repository.ResultSetQuerySession] After getNextRe
sultsBatch: org.alfresco.repo.webservice.repository.ResultSetQuerySession@157816
a (id=032b4a90-fff5-11da-aadd-f58b22fa211f batchSize=-1 position=-1 store=worksp
ace:SpacesStore language=lucene statement=(TYPE:"{http://www.alfresco.org/model/
content/1.0}content" AND (@\{http\://www.alfresco.org/model/content/1.0\}name:10
91 )))
17:37:55,000 DEBUG [webservice.axis.TicketCallbackHandler] Verifying ticket for:
ticket
17:37:55,000 DEBUG [webservice.axis.TicketCallbackHandler] Ticket: TICKET_032222
ce-fff5-11da-aadd-f58b22fa211f
17:37:55,010 DEBUG [webservice.axis.TicketCallbackHandler] Ticket validated succ
essfully
17:37:55,020 DEBUG [repo.webservice.Utils] There was no path to resolve so using
root or specified node
17:37:55,030 DEBUG [webservice.content.ContentWebService] Content: fe9ee493-fff4
-11da-aadd-f58b22fa211f name=1091 MUGSHOT encoding=UTF-8 mimetype=image/jpeg siz
e=528805 downloadURL=http://localhost:8080/alfresco/download/direct/workspace/Sp
acesStore/fe9ee493-fff4-11da-aadd-f58b22fa211f/1091+MUGSHOT
17:37:55,260 DEBUG [webservice.authentication.AuthenticationWebService] Session
ended for ticket 'TICKET_032222ce-fff5-11da-aadd-f58b22fa211f'
17:38:01,419 WARN  [springframework.util.FileCopyUtils] Could not close OutputSt
ream
ClientAbortException:  java.net.SocketException: Software caused connection abor
t: socket write error

        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffe
r.java:366)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
        at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:
314)
        at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:27
8)
        at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputSt
ream.java:103)
        at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:132)
        at org.alfresco.repo.content.AbstractContentReader.getContent(AbstractCo
ntentReader.java:343)
        at org.alfresco.web.app.servlet.DownloadContentServlet.doGet(DownloadCon
tentServlet.java:212)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:868)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:663)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.net.SocketException: Software caused connection abort: socket wr
ite error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(Internal
OutputBuffer.java:747)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:323)
        at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffe
r.doWrite(InternalOutputBuffer.java:770)
        at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedO
utputFilter.java:123)
        at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputB
uffer.java:580)
        at org.apache.coyote.Response.doWrite(Response.java:555)
        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffe
r.java:361)
        … 23 more
17:38:01,419 ERROR [[localhost].[/alfresco].[downloadContent]] Servlet.service()
for servlet downloadContent threw exception
org.alfresco.error.AlfrescoRuntimeException: Error during download content servl
et processing: Failed to copy content to output stream:

   accessor: ContentAccessor[ contentUrl=store://2006/6/19/17/012e9027-fff5-11da
-aadd-f58b22fa211f.bin, mimetype=image/jpeg, size=528805, encoding=UTF-8]
        at org.alfresco.web.app.servlet.DownloadContentServlet.doGet(DownloadCon
tentServlet.java:229)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:868)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:663)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.alfresco.service.cmr.repository.ContentIOException: Failed to cop
y content to output stream:
   accessor: ContentAccessor[ contentUrl=store://2006/6/19/17/012e9027-fff5-11da
-aadd-f58b22fa211f.bin, mimetype=image/jpeg, size=528805, encoding=UTF-8]
        at org.alfresco.repo.content.AbstractContentReader.getContent(AbstractCo
ntentReader.java:348)
        at org.alfresco.web.app.servlet.DownloadContentServlet.doGet(DownloadCon
tentServlet.java:212)
        … 16 more
Caused by: ClientAbortException:  java.net.SocketException: Software caused conn
ection abort: socket write error
        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffe
r.java:366)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:323)
        at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.ja
va:392)
        at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:38
1)
        at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputSt
ream.java:88)
        at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:118)
        at org.alfresco.repo.content.AbstractContentReader.getContent(AbstractCo
ntentReader.java:343)
        … 17 more
Caused by: java.net.SocketException: Software caused connection abort: socket wr
ite error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(Internal
OutputBuffer.java:747)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
        at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:323)
        at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffe
r.doWrite(InternalOutputBuffer.java:770)
        at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedO
utputFilter.java:125)
        at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputB
uffer.java:580)
        at org.apache.coyote.Response.doWrite(Response.java:555)
        at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffe
r.java:361)
        … 24 more



————————————————————————————

Any idea….

Outcomes