04-15-2014 06:34 AM
Good Day!
Kindly help me with my problem, I am using Nuxeo 5.9.1 platform, and Linux precise1-Ubuntux86_64 server on a vmware. , i use nuxeo automation client to download nuxeo files. It works fine when I use mvn tomcat:run on my local, but it does not work when I will mvn clean install, and use the jar file it creates.
Here is the log from tomcat.
java.lang.RuntimeException: Cannot execute {Authorization=Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y} at org.nuxeo.ecm.automation.client.jaxrs.impl.HttpConnector.execute(HttpConnector.java:122) at org.nuxeo.ecm.automation.client.jaxrs.spi.ConnectorHandler.execute(ConnectorHandler.java:30) at org.nuxeo.ecm.automation.client.jaxrs.spi.DefaultSession.getFile(DefaultSession.java:127) at tv.migo.cms.domain.service.NuxeoAutomationClientService.getFile(NuxeoAutomationClientService.java:163) at tv.migo.cms.domain.service.NuxeoAutomationClientService.recursiveAssetFileCreation(NuxeoAutomationClientService.java:138) at tv.migo.cms.domain.service.NuxeoAutomationClientService.recursiveAssetFileCreation(NuxeoAutomationClientService.java:135) at tv.migo.cms.domain.service.publish.contentlibrary.TitleCbPublisher.publish(TitleCbPublisher.java:73) at tv.migo.cms.domain.service.publish.PublishContentLibraryService.publish(PublishContentLibraryService.java:26) at tv.migo.cms.domain.service.publish.PublishService.publish(PublishService.java:33) at tv.migo.cms.domain.resource.PublishResource.publish(PublishResource.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: java.io.IOException: No such file or directory at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1006) at java.io.File.createTempFile(File.java:1989) at java.io.File.createTempFile(File.java:2040) at org.nuxeo.ecm.automation.client.jaxrs.util.IOUtils.copyToTempFile(IOUtils.java:58) at org.nuxeo.ecm.automation.client.jaxrs.spi.Request.readBlob(Request.java:158) at org.nuxeo.ecm.automation.client.jaxrs.spi.Request.handleResult(Request.java:126)
My code.
final FileBlob fileBlob = this.getFile(document);
final File file = fileBlob.getFile();
logger.info(objectMapper.writeValueAsString(document));
final File targetFile = new File(parent, fileBlob.getFileName());
logger.info("file copied to : {}", targetFile.getAbsolutePath());
FileUtils.copyFile(file, targetFile);
file.delete();
public FileBlob getFile(Document doc) throws Exception {
Document fileDocument = (Document) session.newRequest(
"Document.Fetch").setHeader(
Constants.HEADER_NX_SCHEMAS, "*").set("value", doc.getPath()).execute();
// get the file content property
PropertyMap map = fileDocument.getProperties().getMap("file:content");
// get the data URL
String path = map.getString("data");
return (FileBlob) session.getFile(path);
}
Some dependencies I use for nuxeo automation client.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.nuxeo.ecm.automation</groupId>
<artifactId>nuxeo-automation-client</artifactId>
<version>5.9.1</version>
</dependency>
i even used this:
<dependency>
<groupId>org.nuxeo.ecm.automation</groupId>
<artifactId>nuxeo-automation-client</artifactId>
<version>5.9.1</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
Java version tried, 1.6 and 1.7
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
04-17-2014 02:57 PM
Hi,
Based on your log Caused by: java.io.IOException: No such file or directory at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1006) at java.io.File.createTempFile(File.java:1989) at java.io.File.createTempFile(File.java:2040) at
So this looks like the java.io.File.createTempFile does not work on your platform.
Looks like you may have a Java temp directory pointing to a non existent directory.
Check that you have not defined a Java Env variable java.io.tmpdir pointing to a non existing directory. Otherwise, if you are ruuning linux : check that the default tmp dir (/tmp) does exists.
Tiry
04-17-2014 02:57 PM
Hi,
Based on your log Caused by: java.io.IOException: No such file or directory at java.io.UnixFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1006) at java.io.File.createTempFile(File.java:1989) at java.io.File.createTempFile(File.java:2040) at
So this looks like the java.io.File.createTempFile does not work on your platform.
Looks like you may have a Java temp directory pointing to a non existent directory.
Check that you have not defined a Java Env variable java.io.tmpdir pointing to a non existing directory. Otherwise, if you are ruuning linux : check that the default tmp dir (/tmp) does exists.
Tiry
04-18-2014 11:02 PM
Yes, you are most probably right! Thanks!
04-21-2014 01:23 PM
It worked thanks.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.