Ошибка запуска Glassfish

Я настроил сервер 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.

Я пытался найти решение, удалив папку кеша в каталоге домена или изменив права доступа, но проблема продолжает возникать, и я не могу запустить свой домен.

есть идеи, как решить эту проблему?


person denizdurmus    schedule 11.01.2013    source источник


Ответы (1)


У меня была та же ошибка ввода-вывода, что и в этом стеке после установки Glassfish, и я обнаружил следующее:

Glassfish 3.1.2 использует библиотеку felix для материалов OSGI, а этот хочет заблокировать файлы, используя основной метод Java java.nio.channels.FileChannel.tryLock(). Похоже, что это не работает, когда файл, который нужно заблокировать, находится в файловой системе, расположенной на определенных типах NAS, и приводит к ошибке ввода-вывода после длительного ожидания. Обязательно установите важные части или все 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");
}
}
person Andreas    schedule 17.04.2013