cancel
Showing results for 
Search instead for 
Did you mean: 

problem downloading from alfresco repository using java code

hclpower
Champ in-the-making
Champ in-the-making
hi there!

Im facing download problem from alfresco repository.
my different methods of uploading is successful, but while downloading im stucking up at this code :

downloadAction code:

Content[] readResult =  WebServiceFactory.getContentService().read(new Predicate(new Reference[]{contentReference}, storeRef, null), Constants.PROP_CONTENT);

and the error it throws is:

10:38:33,506 ERROR [STDERR] AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
   {http://www.alfresco.org/ws/service/content/1.0}ContentFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>Failed to resolve to a single NodeRef with parameters (store=workspaceSmiley FrustratedpacesStore uuid=null path=/app:company_home/flow.txt), found 0 nodes.</ns1:message>
   {http://xml.apache.org/axis/}exceptionNameSmiley Surprisedrg.alfresco.repo.webservice.content.ContentFault
   {http://xml.apache.org/axis/}stackTrace:
   at org.alfresco.repo.webservice.content.ContentWebService.read(ContentWebService.java:100)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
   at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
   at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
   at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
   at java.lang.Thread.run(Thread.java:619)

   {http://xml.apache.org/axis/}hostname:user-31
10:38:33,506 ERROR [STDERR]    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
10:38:33,506 ERROR [STDERR]    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
10:38:33,506 ERROR [STDERR]    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
10:38:33,506 ERROR [STDERR]    at java.lang.reflect.Constructor.newInstance(Unknown Source)
10:38:33,506 ERROR [STDERR]    at java.lang.Class.newInstance0(Unknown Source)
10:38:33,506 ERROR [STDERR]    at java.lang.Class.newInstance(Unknown Source)
10:38:33,522 ERROR [STDERR]    at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:104)
10:38:33,522 ERROR [STDERR]    at org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:90)
10:38:33,538 ERROR [STDERR]    at org.alfresco.webservice.content.ContentFault.getDeserializer(ContentFault.java:146)
10:38:33,538 ERROR [STDERR]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:38:33,538 ERROR [STDERR]    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
10:38:33,538 ERROR [STDERR]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
10:38:33,538 ERROR [STDERR]    at java.lang.reflect.Method.invoke(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.encoding.ser.BaseDeserializerFactory.getSpecialized(BaseDeserializerFactory.java:154)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:84)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.getDeserializer(DeserializationContext.java:464)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.getDeserializerForType(DeserializationContext.java:547)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:157)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
10:38:33,538 ERROR [STDERR]    at javax.xml.parsers.SAXParser.parse(Unknown Source)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:2767)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:2443)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:2366)
10:38:33,538 ERROR [STDERR]    at org.apache.axis.client.Call.invoke(Call.java:1812)
10:38:33,538 ERROR [STDERR]    at org.alfresco.webservice.content.ContentServiceSoapBindingStub.read(ContentServiceSoapBindingStub.java:467)
10:38:33,538 ERROR [STDERR]    at prime.tech.Download.service(Download.java:70)
10:38:33,538 ERROR [STDERR]    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
10:38:33,538 ERROR [STDERR]    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
10:38:33,538 ERROR [STDERR]    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
10:38:33,538 ERROR [STDERR]    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
10:38:33,538 ERROR [STDERR]    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
10:38:33,538 ERROR [STDERR]    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
10:38:33,538 ERROR [STDERR]    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
10:38:33,538 ERROR [STDERR]    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
10:38:33,538 ERROR [STDERR]    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
10:38:33,538 ERROR [STDERR]    at java.lang.Thread.run(Unknown Source)


can anybody look out and tell me whats the exact problem.

Thanks in advanceSmiley Happy
hclpower
7 REPLIES 7

jcustovic
Champ in-the-making
Champ in-the-making
Try using following code:
Reference referencePath = new Reference(WORKSPACE_STORE, null, "/app:company_home/cm:flow.txt");
InputStream is = ContentUtils.getContentAsInputStream(content)

I think that u are missing "cm:" in front of "flow.txt".

hclpower
Champ in-the-making
Champ in-the-making
Really thanks Jan Čustović

but thats doesnot solve the issue.
i have come up with some other logic and its working simply superbSmiley Happy Smiley Very Happy  Smiley Happy

n_pancholi87
Champ in-the-making
Champ in-the-making
Hie..I am facing similar issue…pls can somebody help?

hclpower
Champ in-the-making
Champ in-the-making
hi buddy
come out with exact error. so that anybody can help youSmiley Happy

n_pancholi87
Champ in-the-making
Champ in-the-making
resolved it….thnx!

wass
Champ in-the-making
Champ in-the-making
resolved it….thnx!
how u've solved it?

thanks.

n_pancholi87
Champ in-the-making
Champ in-the-making
I changed my code to something like following :

ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
System.out.println("ISO9075.encode(fileName)"+ISO9075.encode(fileName));
                Reference contentReference = new Reference(STORE,null,parentSpace+"/cm:"+fileName);// Reference contentReference = new Reference(STORE,null,parentSpace);
System.out.println("UUID IS …….."+contentReference.getPath());
System.out.println("3"+fileName);               
                Content[] readResult = contentService.read(new Predicate(new Reference[]{contentReference}, STORE, null), Constants.PROP_CONTENT);