2013-01-11 196 views
0

我建立了一個glassfish服務器來了解它。根據快速入門指南進行設置和配置後,我能夠毫無問題地運行服務器和domain1。一段時間後,它開始記錄下面幾行:Glassfish啓動失敗

[#|2013-01-11T15:43:45.246+0800|WARNING|glassfish3.1.2|java.util.prefs|_ThreadID=105;_ThreadName=Thread-2;|Could not lock User prefs. Unix error code 5.|#] 

[#|2013-01-11T15:43:45.246+0800|WARNING|glassfish3.1.2|java.util.prefs|_ThreadID=105;_ThreadName=Thread-2;|Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.|#] 

而且我做了一個小Googling這個發現this link和應用這是推薦在那裏的選項。

./asadmin start-domain domain1 
Waiting for domain1 to start .............Error starting domain domain1. 
The server exited prematurely with exit code 1. 
Before it died, it produced the following output: 

Launching GlassFish on Felix platform 
ERROR: Error creating bundle cache. (java.lang.Exception: Unable to lock bundle cache: java.io.IOException: Input/output error) 
java.lang.Exception: Unable to lock bundle cache: java.io.IOException: Input/output error 
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:176) 
at org.apache.felix.framework.Felix.init(Felix.java:629) 
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88) 
Exception in thread "Thread-1" java.lang.RuntimeException: org.osgi.framework.BundleException: Error creating bundle cache. 
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:90) 
Caused by: org.osgi.framework.BundleException: Error creating bundle cache. 
at org.apache.felix.framework.Felix.init(Felix.java:634) 
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88) 
Caused by: java.lang.Exception: Unable to lock bundle cache: java.io.IOException: Input/output error 
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:176) 
at org.apache.felix.framework.Felix.init(Felix.java:629) 
... 1 more 
Exception in thread "main" java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97) 
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55) 
Caused by: org.glassfish.embeddable.GlassFishException: java.lang.NullPointerException 
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:164) 
at org.glassfish.embeddable.GlassFishRuntime._bootstrap(GlassFishRuntime.java:157) 
at org.glassfish.embeddable.GlassFishRuntime.bootstrap(GlassFishRuntime.java:110) 
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:112) 
... 6 more 
Caused by: java.lang.NullPointerException 
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.newFramework(OSGiGlassFishRuntimeBuilder.java:230) 
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:133) 
... 9 more 
Error stopping framework: java.lang.NullPointerException 
java.lang.NullPointerException 
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher$1.run(GlassFishMain.java:203) 

Command start-domain failed. 

我試圖找到一個解決方案,在域目錄中刪除緩存文件夾或更改訪問權限,但該問題持續:需要重新啓動GlassFish雖然服務器日誌中說,它開始了,我看到這個在命令行後發生,我不能開始我的域名。

任何想法如何解決這個問題?

回答

0

我有同樣的IO錯誤在安裝Glassfish的後堆,發現了以下工作:

的Glassfish 3.1.2使用了OSGI的東西菲利克斯庫,而且這樣一個希望鎖住使用核心Java文件方法java.nio.channels.FileChannel.tryLock()。當要鎖定的文件位於特定類型的NAS上的文件系統上並在長時間超時後導致IO錯誤時,這似乎不起作用。 確保在本地磁盤上安裝關鍵部件或所有Glassfish,並且此錯誤將消失。

可以很容易地重現該錯誤運行下面的Java類:

import java.io.File; 
import java.io.FileOutputStream; 
import java.nio.channels.FileChannel; 

public class TryLock { 

/** 
* @param args 
*/ 
public static void main(String[] args) { 
    // name of a file is the only parameter 
    File lockFile = new File(args[0]); 
    FileChannel fc = null; 
    FileOutputStream fos = null; 
    try { 
     fos = new FileOutputStream(lockFile); 
     fc = fos.getChannel(); 
     // This is the code that fails on some NAS (low-level operation?): 
     fc.tryLock(); 
    } catch(Throwable th) { 
     th.printStackTrace(); 
    } 
    System.out.println("Success"); 
} 
}