java.io.IOException:Xuggle拒绝权限

时间:2012-05-04 13:27:13

标签: java xuggle xuggler

我正在尝试在服务器上运行Xuggle 5.4,并且有一个例外我不知道如何处理。相同的代码在另外两个服务器上工作正常,也在另一个应用程序(Playframework)下的同一服务器上工作。它在另一个应用程序下运行的事实使我建议这可能是错误。

错误的根源似乎是Xuggle尝试创建临时文件并拒绝访问。我怎么知道这是哪里?如上所述,这可能是其他安装已经使用过的位置,并且正在另一个用户帐户下运行。

这是堆栈跟踪:

2012-05-04 08:49:01,985 ERROR ~ could not create temp file: {}
java.io.IOException: Permission denied
    at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.6.0_26]
    at java.io.File.checkAndCreate(File.java:1704) ~[na:1.6.0_26]
    at java.io.File.createTempFile(File.java:1792) ~[na:1.6.0_26]
    at com.xuggle.ferry.JNILibrary.unpackLibrary(JNILibrary.java:274) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.JNILibrary.loadFromClasspath(JNILibrary.java:195) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:176) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:158) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.xuggler.IContainer.<clinit>(IContainer.java:1622) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77) [xuggle-xuggler-5.4.jar:5.4.0]
    at logic.server.MediaCoder.createEncodingJobs(MediaCoder.java:39) [idoms-server:na]
    at controllers.FileCopyJob$ProgressListener.actionPerformed(FileCopyJob.java:127) [idoms-server:na]
    at controllers.FileCopyJob$DownloadCountingOutputStream.afterWrite(FileCopyJob.java:84) [idoms-server:na]
    at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:92) [commons-io-2.0.1.jar:2.0.1]
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1263) [commons-io-2.0.1.jar:2.0.1]
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236) [commons-io-2.0.1.jar:2.0.1]
    at controllers.FileCopyJob.doJob(FileCopyJob.java:58) [idoms-server:na]
    at play.jobs.Job.doJobWithResult(Job.java:50) [play-1.2.4.jar:na]
    at play.jobs.Job.call(Job.java:146) [play-1.2.4.jar:na]
    at play.jobs.Job$1.call(Job.java:66) [play-1.2.4.jar:na]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_26]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_26]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) [na:1.6.0_26]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) [na:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
2012-05-04 08:49:02,003 ERROR ~ could not create temp file: {}
java.io.IOException: Permission denied
    at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.6.0_26]
    at java.io.File.checkAndCreate(File.java:1704) ~[na:1.6.0_26]
    at java.io.File.createTempFile(File.java:1792) ~[na:1.6.0_26]
    at com.xuggle.ferry.JNILibrary.unpackLibrary(JNILibrary.java:274) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.JNILibrary.loadFromClasspath(JNILibrary.java:195) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:176) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:158) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.xuggler.IContainer.<clinit>(IContainer.java:1622) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137) [xuggle-xuggler-5.4.jar:5.4.0]
    at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77) [xuggle-xuggler-5.4.jar:5.4.0]
    at logic.server.MediaCoder.createEncodingJobs(MediaCoder.java:39) [idoms-server:na]
    at controllers.FileCopyJob$ProgressListener.actionPerformed(FileCopyJob.java:127) [idoms-server:na]
    at controllers.FileCopyJob$DownloadCountingOutputStream.afterWrite(FileCopyJob.java:84) [idoms-server:na]
    at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:92) [commons-io-2.0.1.jar:2.0.1]
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1263) [commons-io-2.0.1.jar:2.0.1]
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236) [commons-io-2.0.1.jar:2.0.1]
    at controllers.FileCopyJob.doJob(FileCopyJob.java:58) [idoms-server:na]
    at play.jobs.Job.doJobWithResult(Job.java:50) [play-1.2.4.jar:na]
    at play.jobs.Job.call(Job.java:146) [play-1.2.4.jar:na]
    at play.jobs.Job$1.call(Job.java:66) [play-1.2.4.jar:na]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_26]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_26]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) [na:1.6.0_26]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) [na:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_26]
2012-05-04 08:49:02,015 ERROR ~ Could not load library: xuggle; version: 5; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem
08:49:02,115 ERROR ~ 

@6a91glkdf
Error during job execution (controllers.FileCopyJob)

Oops: UnsatisfiedLinkError
An unexpected error occured caused by exception UnsatisfiedLinkError: no xuggle in java.library.path

play.exceptions.UnexpectedException: Unexpected Error
    at play.Invoker$Invocation.onException(Invoker.java:244)
    at play.jobs.Job.onException(Job.java:124)
    at play.jobs.Job.call(Job.java:163)
    at play.jobs.Job$1.call(Job.java:66)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsatisfiedLinkError: no xuggle in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1028)
    at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(JNILibraryLoader.java:268)
    at com.xuggle.ferry.JNILibraryLoader.loadLibrary(JNILibraryLoader.java:171)
    at com.xuggle.ferry.JNILibrary.load(JNILibrary.java:161)
    at com.xuggle.ferry.FerryJNI.<clinit>(FerryJNI.java:16)
    at com.xuggle.ferry.Ferry.<clinit>(Ferry.java:25)
    at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19)
    at com.xuggle.xuggler.IContainer.<clinit>(IContainer.java:1622)
    at com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137)
    at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77)
    at logic.server.MediaCoder.createEncodingJobs(MediaCoder.java:39)
    at controllers.FileCopyJob$ProgressListener.actionPerformed(FileCopyJob.java:127)
    at controllers.FileCopyJob$DownloadCountingOutputStream.afterWrite(FileCopyJob.java:84)
    at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:92)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1263)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1236)
    at controllers.FileCopyJob.doJob(FileCopyJob.java:58)
    at play.jobs.Job.doJobWithResult(Job.java:50)
    at play.jobs.Job.call(Job.java:146)
    ... 8 more

2 个答案:

答案 0 :(得分:2)

然后问题是用于存储二进制文件的临时目录。当另一个实例创建此临时位置时,不同用户名下的第二个进程没有访问权限。 开发人员知道这个问题。删除临时目录或授予权限可以解决问题

答案 1 :(得分:0)

虽然这个问题已经过时了,并且xuggle已被弃用,但我认为在查看此处的评论后,我仍然会向其他人展示我是如何解决这个问题的。

可以设置java.io.tmpdir属性,而不是删除文件夹或更改其权限。

就像这样:

java -Djava.io.tmpdir="~/custom/tempdir/" HelloWorld

背景:

正如另一个答案的评论所示,将问题的根追溯回创建相关临时文件夹的函数,表明java使用了可以自定义的默认位置。

public static File createTempFile(String prefix,
                                  String suffix,
                                  File directory)
                           throws IOException
  

在指定目录中创建一个新的空文件,使用给定的前缀和后缀字符串生成其名称。如果此方法成功返回,则保证:

     
      
  1. 在调用此方法之前,返回的抽象路径名表示的文件不存在,
  2.   
  3. 此方法及其任何变体都不会在当前虚拟机调用中再次返回相同的抽象路径名。
  4.         

    [...]

         

    如果directory参数为null,则将使用与系统相关的默认临时文件目录。缺省临时文件目录由系统属性java.io.tmpdir指定。在UNIX系统上,此属性的默认值通常为&#34; / tmp&#34;或&#34; / var / tmp&#34 ;;在Microsoft Windows系统上,它通常是&#34; C:\ WINNT \ TEMP&#34;。调用Java虚拟机时,可能会为此系统属性赋予不同的值,但不保证对此属性的编程更改会对此方法使用的临时目录产生任何影响。

请参阅:

  1. JavaDoc createTempFile(String, String, File)
  2. Old Google Groups discussion