Glassfish启动失败

Glassfish启动失败,glassfish,application-server,apache-felix,Glassfish,Application Server,Apache Felix,我已经建立了一个glassfish服务器来学习它。根据《快速入门指南》进行设置和配置后,我能够毫无问题地运行服务器和域1。一段时间后,它开始记录以下行: [#|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-11T1

我已经建立了一个glassfish服务器来学习它。根据《快速入门指南》进行设置和配置后,我能够毫无问题地运行服务器和域1。一段时间后,它开始记录以下行:

[#|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.|#]
我在谷歌上搜索了一下,找到并应用了推荐的选项。重新启动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.
/asadmin启动域域域1
正在等待域1启动…………启动域域1时出错。
服务器过早退出,退出代码为1。
在它死之前,它产生了以下输出:
在Felix平台上发射GlassFish
错误:创建捆绑缓存时出错。(java.lang.Exception:无法锁定捆绑缓存:java.io.IOException:输入/输出错误)
java.lang.Exception:无法锁定捆绑缓存:java.io.IOException:输入/输出错误
位于org.apache.felix.framework.cache.BundleCache.(BundleCache.java:176)
位于org.apache.felix.framework.felix.init(felix.java:629)
位于com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88)
线程“thread-1”java.lang.RuntimeException:org.osgi.framework.BundleException:创建捆绑缓存时出错。
位于com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:90)
原因:org.osgi.framework.BundleException:创建捆绑缓存时出错。
位于org.apache.felix.framework.felix.init(felix.java:634)
位于com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.run(OSGiFrameworkLauncher.java:88)
原因:java.lang.Exception:无法锁定捆绑缓存:java.io.IOException:输入/输出错误
位于org.apache.felix.framework.cache.BundleCache.(BundleCache.java:176)
位于org.apache.felix.framework.felix.init(felix.java:629)
... 还有一个
线程“main”java.lang.reflect.InvocationTargetException中出现异常
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(未知源)
在sun.reflect.DelegatingMethodAccessorImpl.invoke处(未知源)
位于java.lang.reflect.Method.invoke(未知源)
位于com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
位于com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)
原因:org.glassfish.embeddeble.GlassFishException:java.lang.NullPointerException
位于com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:164)
位于org.glassfish.embeddeble.GlassFishRuntime.\u bootstrap(GlassFishRuntime.java:157)
位于org.glassfish.embeddeble.GlassFishRuntime.bootstrap(GlassFishRuntime.java:110)
位于com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:112)
... 还有6个
原因:java.lang.NullPointerException
位于com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.newFramework(OSGiGlassFishRuntimeBuilder.java:230)
位于com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.java:133)
... 9更多
停止框架时出错:java.lang.NullPointerException
java.lang.NullPointerException
位于com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher$1.run(GlassFishMain.java:203)
命令启动域失败。
我试图找到解决方案,删除域目录中的缓存文件夹或更改访问权限,但问题不断出现,我无法启动我的域


有没有办法解决这个问题

在安装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");
}
}