2012-05-04 124 views
1

我想在服務器上運行Xuggle 5.4,並且有一個異常我不知道該如何處理。相同的代碼可以在另外兩個服務器上正常工作,也可以在另一個應用程序(Playframework)下的同一臺服務器上工作。它在另一個應用程序下運行的事實使我認爲這可能是錯誤。java.io.IOException:權限被Xuggle拒絕

錯誤的根源似乎是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 
+0

什麼用戶在這個失敗的程序運行的?它試圖粘貼臨時文件在哪裏?誰擁有它試圖粘貼臨時文件的目錄以及該目錄的權限是什麼? 也許你可以像'strace'這樣的命令來運行程序,試圖看看它試圖創建臨時文件的位置。 – QuantumMechanic

+0

用戶與Play!的目錄相同。正在運行,並且由用戶擁有。問題是,我不知道它試圖寫入的地方,但也許strace的工具可以工作。我可能會看看 –

回答

2

那麼問題是用來存儲二進制文件的臨時目錄。由於另一個實例創建了此臨時位置,因此不同用戶名下的第二個進程無權訪問。 開發人員知道這個問題。刪除臨時目錄或授予權利解決問題

+0

您是否找到解決此問題的解決方案?我正在與類似的問題鬥爭。 Xuggler無法在服務器端創建文件。 – goodm

+0

你必須找出它正在使用的臨時目錄。我修改了代碼,把一個文本字符串出來告訴我的臨時目錄,並給予所有權利。如果有多個用戶,則可能必須在第一個用戶創建目錄和文件後再次執行此操作。 –

+0

也許會嘗試,現在我們的後端主人更改了用戶的權限。 – goodm

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. 無論這種方法也不是任何變體將返回相同在虛擬機的當前調用中再次提取抽象路徑名。

[...]

如果directory參數爲null,則系統有關的默認臨時文件目錄將被使用。默認的臨時文件目錄由系統屬性java.io.tmpdir指定。在UNIX系統上,這個屬性的默認值通常是「/ tmp」或「/ var/tmp」;在Microsoft Windows系統上,它通常是「C:\ WINNT \ TEMP」。當調用Java虛擬機時,可能會給此係統屬性賦予不同的值,但對此屬性的編程更改不保證對此方法使用的臨時目錄有任何影響。

參見:

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