2 Replies Latest reply on May 20, 2013 7:23 AM by m.jawwad

    Error converting InputStream to a BinaryValue

    m.jawwad

      Hi,

       

            I was working with ModeShape and finally converted my application (working on JR previously) to ModeShape, It worked fine on my developer machine (Windows). Then I deployed it on a test machine which was using linux. The repository was initialized successfully, but When I started some document uploading, I encountered the following exception:

      Exception in WebService Method EX: org.modeshape.jcr.value.ValueFormatException: Error converting InputStream to a BinaryValue
      org.modeshape.jcr.value.ValueFormatException: Error converting InputStream to a BinaryValue
              at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:254)
              at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:57)
              at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:142)
              at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:47)
              at com.virtualcode.repository.impl.UploadDocumentServiceImpl.addFileToParentNode(UploadDocumentServiceImpl.java:465)
              at com.virtualcode.repository.impl.UploadDocumentServiceImpl.uploadDocument(UploadDocumentServiceImpl.java:148)
              at com.virtualcode.controller.DocumentManagementModule.uploadDocument(DocumentManagementModule.java:78)
              at com.virtualcode.agent.das.utils.Utility.uploadDocument(Utility.java:77)
              at com.virtualcode.agent.das.dataArchiver.FileArchiver.Process(FileArchiver.java:77)
              at com.virtualcode.agent.das.dataArchiver.FileArchiver.run(FileArchiver.java:119)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
              at java.lang.Thread.run(Thread.java:722)
      Caused by: org.modeshape.jcr.value.binary.BinaryStoreException: java.io.IOException: No such file or directory
              at org.modeshape.jcr.value.binary.FileSystemBinaryStore.storeValue(FileSystemBinaryStore.java:137)
              at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:252)
              ... 12 more
      Caused by: java.io.IOException: No such file or directory
              at java.io.UnixFileSystem.createFileExclusively(Native Method)
              at java.io.File.createTempFile(File.java:1879)
              at java.io.File.createTempFile(File.java:1923)
              at org.modeshape.jcr.value.binary.FileSystemBinaryStore.storeValue(FileSystemBinaryStore.java:113)
              ... 13 more
      

       

                     The folders are created but when it comes to converting input stream to binary, the above exception is thrown on any type of file. Is  there any special configurations I might be missing? or is this a problem with the system/platform?

       

      Thanks in advance.

        • 1. Re: Error converting InputStream to a BinaryValue
          hchiorean

          When uploading binary values in the FS binary store, before creating the actual file in the store, ModeShape attempts to read the stream and store in a temporary location, via Java's java.io.File.createTempFile.

          The standard JRE behavior of the above method is to create a file in the directory referred by the "java.io.tmpdir" system property.

           

          You need to check what the value of System.getProperty("java.io.tmpdir") is on your Unix box, make sure that that folder exists and the user under which the ModeShape code is executed has read/write privileges in that folder.

          1 of 1 people found this helpful
          • 2. Re: Error converting InputStream to a BinaryValue
            m.jawwad

            Thanks. That was the problem. Modeshape was not able to create the temp folder.

            1 of 1 people found this helpful