2

While trying to install a third part java application I got this error Failed to create temporary file for jnidispatch library: java.io.IOException: Read-only file system.

java.lang.reflect.InvocationTargetException
        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.rzo.yajsw.boot.WrapperExeBooter.main(WrapperExeBooter.java:35)
Caused by: java.lang.Error: Failed to create temporary file for jnidispatch library: java.io.IOException: Read-only file system
        at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:751)
        at com.sun.jna.Native.loadNativeLibrary(Native.java:685)
        at com.sun.jna.Native.<clinit>(Native.java:109)
        at com.sun.jna.Pointer.<clinit>(Pointer.java:42)
        at com.sun.jna.PointerType.<init>(PointerType.java:25)
        at com.sun.jna.ptr.ByReference.<init>(ByReference.java:32)
        at com.sun.jna.ptr.IntByReference.<init>(IntByReference.java:22)
        at com.sun.jna.ptr.IntByReference.<init>(IntByReference.java:18)
        at org.rzo.yajsw.os.posix.PosixProcess.<init>(PosixProcess.java:43)
        at org.rzo.yajsw.os.posix.OperatingSystemPosix.setWorkingDir(OperatingSystemPosix.java:10)
        at org.rzo.yajsw.WrapperExe.main(WrapperExe.java:163)
        ... 5 more
skaffman
  • 398,947
  • 96
  • 818
  • 769
user837306
  • 857
  • 3
  • 18
  • 32
  • 1
    So, what's the problem? Have you checked the file system permission for your user? Does it have a temp directory? – AlexR Dec 28 '11 at 12:11
  • Dear Alex,It have been working fine before this. Yes the temp directory /tmp is there I tried to remove files it keep giving me errors. – user837306 Dec 28 '11 at 13:25
  • just because you're root doesn't mean you have write permissions on the directory in question. if you have other commands failing due to lack of permissions, the problem is outside of JNA. – technomage Jan 20 '12 at 17:25

5 Answers5

12

I just had this exact same problem; the program had been working fine for months and suddenly this error. Some quick debugging with strace shows that it's trying to open:

/tmp/jna/jna6858279656331549999.tmp

Naturally /tmp/jna was owned by another user, and in my case was a week old. I can't even start to explain how the program had been working properly all day and then suddenly fail because it cannot write to this directory.

Anyhow, I sudo chmod'd /tmp/jna to 777 and now everything's fine. Go figure.

britt
  • 121
  • 1
  • 3
3

So this application is trying to write to the temp directory. Where is this ? It's OS-specific. I don't know which OS you're running, but you can find the location by using the examples here.

Note that you may be able to use that system property (java.io.tmpdir) to provide a new temp directory location, if you can't change the permissions of where this application is writing to.

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
  • Dear Brian,I am using Centos and running it as root user. Before I had no problem. When I remote connect a lot of basic linux command like ls-la etc also does not work. I guess the Os is corrupted is it? – user837306 Dec 28 '11 at 13:13
0

You're likely to have another application using the same directory, /tmn/jna, in such a way to have changed its ownership. In my case it was the Hudson CI.

You can check which application has ownership on '/tmp/jna' by typing 'ls -l /tmp'.

Chmod /tmp/jna to grant access to anyone (or to your current user) and things will come back to normality.

Felipe Martins Melo
  • 1,323
  • 11
  • 15
0

even after downloading specific required file or everything, we could face this error.

a file creation fail could be due to following reasons:
1. user permission/s (inheritance manhandled).
2. corrupt file.
3. file being accessed by another application at the same time.
4. file being locked by anti-malware / anti-virus software.

strangely my antivirus detected adb, avd and jndispatch.dll files as unclean files.

i had to restore them from AVG vault. configure AVG to ignore (add folder to exception list) required folder.

if you are without antivirus and still facing this problem, remember that windows 7 and above have inbuilt 'windows defender'. see whether this fellow is doing the same thing. put your folder in antivirus 'exclusion' list as the vendor is trusted world wide.

this same answer would go to 'Error in launching AVD with AMD processor'.
i didn't had enough reputation to answer this question there and there.

Community
  • 1
  • 1
sifr_dot_in
  • 3,153
  • 2
  • 33
  • 42
0

You don't have permission to write file on that location

jmj
  • 237,923
  • 42
  • 401
  • 438
  • Dear Jigar,I am running it as root on centos it have been running fine. The problem beside this when I use the winscp I cannot even upload or download any files. I guess my os is corrupted is it? – user837306 Dec 28 '11 at 13:12