Glassfish启动失败

时间:2013-01-11 08:50:17

标签: glassfish application-server apache-felix

我已经设置了一个glassfish服务器来了解它。根据快速入门指南设置和配置后,我能够毫无问题地运行服务器和domain1。一段时间后,它开始记录下面的行:

[#|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.|#]

我对此进行了一些谷歌搜索,发现了this link并应用了那里推荐的选项。重新启动glassfish后,虽然服务器日志说它已启动,但我在命令行中看到了这一点:

./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.

我试图找到一个解决方案,删除域目录中的缓存文件夹或更改访问权限但问题仍然存在,我无法启动我的域。

任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

在安装Glassfish之后,我遇到了与该堆栈相同的IO错误,并发现了以下内容:

Glassfish 3.1.2正在使用felix库来处理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");
}
}
相关问题