我检查了站点,但是找不到解决方案。我尝试了“asadmin起始域”“asadmin起始域domain1”,然后将conf文件夹AS_JAVA中的asenv文件编辑为JAVA_HOME(我之所以这样说是因为有人可能也建议这样做),但是我无法启动该域。
当我刚安装glassfish 4并自动启动时,它正在工作。我使用“asadmin stop-domain”将其停止,但现在无法正常工作。
我的命令和结果如下:
C:\Program Files\Java\glassfish4\glassfish\bin>asadmin start-domain domain1
java.nio.file.AccessDeniedException: C:\Program Files\Java\glassfish4\glassfish\
domains\domain1\logs\server.log.lck
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(Unknown Source)
at java.nio.channels.FileChannel.open(Unknown Source)
at java.nio.channels.FileChannel.open(Unknown Source)
at java.util.logging.FileHandler.openFiles(Unknown Source)
at java.util.logging.FileHandler.<init>(Unknown Source)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(
GFLauncherLogger.java:98)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:19
1)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLaun
cher(StartDomainCommand.java:220)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCom
mand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:321)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:
360)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:298)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
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 create bundl
e cache lock file: java.io.FileNotFoundException: C:\Program Files\Java\glassfis
h4\glassfish\domains\domain1\osgi-cache\felix\cache.lock (Erişim engellendi))
java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFou
ndException: C:\Program Files\Java\glassfish4\glassfish\domains\domain1\osgi-cac
he\felix\cache.lock (Erişim engellendi)
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:
168)
at org.apache.felix.framework.Felix.init(Felix.java:640)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.r
un(OSGiFrameworkLauncher.java:88)
Exception in thread "Thread-1" java.lang.RuntimeException: org.osgi.framework.Bu
ndleException: Error creating bundle cache.
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.r
un(OSGiFrameworkLauncher.java:90)
Caused by: org.osgi.framework.BundleException: Error creating bundle cache.
at org.apache.felix.framework.Felix.init(Felix.java:645)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiFrameworkLauncher$1.r
un(OSGiFrameworkLauncher.java:88)
Caused by: java.lang.Exception: Unable to create bundle cache lock file: java.io
.FileNotFoundException: C:\Program Files\Java\glassfish4\glassfish\domains\domai
n1\osgi-cache\felix\cache.lock (Erişim engellendi)
at org.apache.felix.framework.cache.BundleCache.<init>(BundleCache.java:
168)
at org.apache.felix.framework.Felix.init(Felix.java:640)
... 1 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMa
in.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Caused by: org.glassfish.embeddable.GlassFishException: java.lang.NullPointerExc
eption
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuild
er.build(OSGiGlassFishRuntimeBuilder.java:170)
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.OSGiGlassFishRuntimeBuild
er.newFramework(OSGiGlassFishRuntimeBuilder.java:241)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuild
er.build(OSGiGlassFishRuntimeBuilder.java:135)
... 9 more
Error stopping framework: java.lang.NullPointerException
java.lang.NullPointerException
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher$1.run(G
lassFishMain.java:203)
Command start-domain failed.
C:\Program Files\Java\glassfish4\glassfish\bin>
最佳答案
您必须以管理员身份打开命令行才能解决此问题。您应该获得下一个:
C:\Program Files\Java\java_ee_sdk-7u1\glassfish4\glassfish\bin>asadmin start-domain
Waiting for domain1 to start .............
Successfully started the domain : domain1
domain Location: C:\Program Files\Java\java_ee_sdk-7u1\glassfish4\glassfish\domains\domain1
Log File: C:\Program Files\Java\java_ee_sdk-7u1\glassfish4\glassfish\domains\domain1\logs\server.log
Admin Port: 4848
Command start-domain executed successfully.
C:\Program Files\Java\java_ee_sdk-7u1\glassfish4\glassfish\bin>
干杯