Buenas chic@s.He cambiado algo el código que tenia para trabajar con Alfresco, ya que tenía problemas cuando queria guardar un documento en una carpeta ya existente en el proyecto.Con la modificación actual he dejado el código tal que así:
public String uploadFile(String idfolder, byte[] bytes, String fileName,
String contentType) {
String idDoc = null;
// properties
Folder folder = (Folder) session.getObject(idfolder);
Map<String, Object> newDocProps = new HashMap<String, Object>();
newDocProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
newDocProps.put(PropertyIds.NAME, fileName);
ContentStream contentStream = new ContentStreamImpl(fileName,
BigInteger.valueOf(bytes.length), contentType,
new ByteArrayInputStream(bytes));
try {
// create the file
Document doc = folder.createDocument(newDocProps, contentStream,
VersioningState.NONE);
idDoc = doc.getId();
} catch (CmisConstraintException e) {
System.out.println("No se pudo crear el archivo");
}
return idDoc;
}
En la línea siguiente: Folder folder = (Folder) session.getObject(idfolder), idFolder contiene /carpetaDeseada/, que ya esta creada en alfresco, pero obtengo el siguiente error llegado a ese punto.ADVERTENCIA: /subir.xhtml @98,49 fileUploadListener="#{documentoMBean.handleFileUpload}": org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: javax.el.ELException: /subir.xhtml @98,49 fileUploadListener="#{documentoMBean.handleFileUpload}": org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111) at org.primefaces.component.fileupload.FileUpload.broadcast(FileUpload.java:310) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:755) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at alfresco.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:662)Caused by: org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:484) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:645) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:868) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:626) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:519) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:497) at alfresco.DocumentoManagedBean.uploadFile(DocumentoManagedBean.java:357) at alfresco.DocumentoManagedBean.handleFileUpload(DocumentoManagedBean.java:493) 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.el.parser.AstValue.invoke(AstValue.java:278) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) … 27 more16-jun-2015 13:41:43 com.sun.faces.context.AjaxExceptionHandlerImpl handlePartialResponseErrorGRAVE: org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Object not found: at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:484) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.read(AbstractAtomPubService.java:645) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.getObjectInternal(AbstractAtomPubService.java:868) at org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImpl.getObject(ObjectServiceImpl.java:626) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:519) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getObject(SessionImpl.java:497) at alfresco.DocumentoManagedBean.uploadFile(DocumentoManagedBean.java:357) at alfresco.DocumentoManagedBean.handleFileUpload(DocumentoManagedBean.java:493) 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.el.parser.AstValue.invoke(AstValue.java:278) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) at org.primefaces.component.fileupload.FileUpload.broadcast(FileUpload.java:310) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:755) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at alfresco.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:662)¿Algunda sugerencia? Yo solo quiero poder almacenar un documento en un fichero ya existente.Un saludo!!