致命错误:无法在 smartFoxServer 中创建日志文件

Posted

技术标签:

【中文标题】致命错误:无法在 smartFoxServer 中创建日志文件【英文标题】:FATAL ERROR: Could not create log files in smartFoxServer 【发布时间】:2015-03-02 07:24:40 【问题描述】:

最近,我尝试在我的新项目中使用 smartFoxServer。 问题是安装后,我尝试启动 smartFoxServer,它是这样写的:

|------------------------------------------------------------|
|                      SmartFoxServer                        |
|                Multiplayer Socket Server                   |
|                      version 1.5.5                         |
|                           ---                              |
|              (c) 2004 - 2007 gotoAndPlay()                 |
|                  www.smartfoxserver.com                    |
|                    www.gotoandplay.it                      |
|------------------------------------------------------------|

java.nio.file.InvalidPathException: Illegal char <:> at index 2: \C:\Users\Ariel
PC\Documents\SmartFoxServerBASIC_1.5.5\Server\logs\smartfox_log_0.txt.lck
        at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
        at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
        at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
        at sun.nio.fs.WindowsPath.parse(Unknown Source)
        at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
        at java.nio.file.Paths.get(Unknown Source)
        at java.util.logging.FileHandler.openFiles(Unknown Source)
        at java.util.logging.FileHandler.<init>(Unknown Source)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.initLogger(SmartFoxServe
r.java:495)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:
585)
FATAL ERROR: Could not create log files.


Shutting down server...

Press any key to continue . . .

我该如何解决这个问题?服务器不工作!

谢谢!

【问题讨论】:

Java NIO file path issue 的可能重复项 @Houseman 有点不同。 【参考方案1】:

我认为问题与 Java 版本有关,因为 SmartFoxServer 不支持 JRE 8。因此,为避免该问题,您可以下载并安装 JRE 6JRE 7 然后打开文件 SmartFoxServerBASIC_1.5.5\Server\start.bat 并像这样编辑它(我们将只更改 java路径):

@"path_of_jre\bin\java.exe" -cp "./;/;./lib/nanoxml-2.2.1.jar;./lib/js.jar;./lib/jython.jar;./lib/commons-pool-1.2.jar;./lib/commons-dbcp-1.2.1.jar;./lib/commons-collections-3.1.jar;./lib/activation.jar;./lib/javamail/smtp.jar;./lib/javamail/mailapi.jar;./lib/jetty/jetty.jar;./lib/jetty/jetty-util.jar;./lib/jetty/servlet-api-2.5.jar;./lib/jetty/multipartrequest.jar;./lib/json.jar;./lib/xbean.jar;./lib/jsr173_1.0_api.jar;./lib/concurrent.jar;./lib/jysfs.jar;" -Dfile.encoding=UTF-8 -Djava.util.logging.config.file=logging.properties it.gotoandplay.smartfoxserver.SmartFoxServer
@pause

path_of_jre 是您的 JRE 目录的路径,例如:C:\Program Files\Java\jre7

看看我使用三个版本的 Java 进行的测试:1.8、1.7 和 1.6:

Java 1.8.0 版:

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
|------------------------------------------------------------|
|                      SmartFoxServer                        |
|                Multiplayer Socket Server                   |
|                      version 1.5.5                         |
|                           ---                              |
|              (c) 2004 - 2007 gotoAndPlay()                 |
|                  www.smartfoxserver.com                    |
|                    www.gotoandplay.it                      |
|------------------------------------------------------------|

java.nio.file.InvalidPathException: Illegal char <:> at index 2: \C:\Users\zo\Sm
artFoxServerBASIC_1.5.5\Server\logs\smartfox_log_0.txt.lck
        at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
        at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
        at java.nio.file.Paths.get(Paths.java:84)
        at java.util.logging.FileHandler.openFiles(FileHandler.java:438)
        at java.util.logging.FileHandler.<init>(FileHandler.java:354)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.initLogger(SmartFoxServe
r.java:495)
        at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:
585)
FATAL ERROR: Could not create log files.

Shutting down server...

Java 版本 1.7.0_65:

java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
|------------------------------------------------------------|
|                      SmartFoxServer                        |
|                Multiplayer Socket Server                   |
|                      version 1.5.5                         |
|                           ---                              |
|              (c) 2004 - 2007 gotoAndPlay()                 |
|                  www.smartfoxserver.com                    |
|                    www.gotoandplay.it                      |
|------------------------------------------------------------|

--- [ System Info ] ------------------------------------------

System CPU(s): 4
VM Max memory: 1431 MB

os.name: Windows 7
os.arch: amd64
os.version: 6.1
java.version: 1.7.0_65
java.vendor: Oracle Corporation
java.vendor.url: http://java.oracle.com/
java.vm.specification.version: 1.7
java.vm.version: 24.65-b04
java.vm.vendor: Oracle Corporation
java.vm.name: Java HotSpot(TM) 64-Bit Server VM

--- [ Network Cards ] -----------------------------------------
...
--- [ Licence Loaded ] ------------------------------------

Licence Type: BASIC
Licenced to : --== Free Demo License ==--
Max. Clients: 20

--- [ Zones & Rooms ] -------------------------------------
...
--- [ Server Starting ] ---------------------------------

Server address: 127.0.0.1
Server port   : 9339

22:05:39.295 - [ INFO ] > [EventWriter] ..... started :: 1 thread(s)
22:05:39.320 - [ INFO ] > [SystemHandler] ... started :: 1 thread(s)
22:05:39.321 - [ INFO ] > [ExtensionHandler]. started :: 1 thread(s)
22:05:39.321 - [ INFO ] > [DeadChannelsPolicy: strict]
22:05:39.322 - [ INFO ] > Server is up and running!

Java 版本 1.6.0_45:

java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
|------------------------------------------------------------|
|                      SmartFoxServer                        |
|                Multiplayer Socket Server                   |
|                      version 1.5.5                         |
|                           ---                              |
|              (c) 2004 - 2007 gotoAndPlay()                 |
|                  www.smartfoxserver.com                    |
|                    www.gotoandplay.it                      |
|------------------------------------------------------------|

--- [ System Info ] ------------------------------------------

System CPU(s): 4
VM Max memory: 1431 MB

os.name: Windows 7
os.arch: amd64
os.version: 6.1
java.version: 1.6.0_45
java.vendor: Sun Microsystems Inc.
java.vendor.url: http://java.sun.com/
java.vm.specification.version: 1.0
java.vm.version: 20.45-b01
java.vm.vendor: Sun Microsystems Inc.
java.vm.name: Java HotSpot(TM) 64-Bit Server VM

--- [ Network Cards ] -----------------------------------------
...
--- [ Licence Loaded ] ------------------------------------

Licence Type: BASIC
Licenced to : --== Free Demo License ==--
Max. Clients: 20

--- [ Zones & Rooms ] -------------------------------------
...
--- [ Server Starting ] ---------------------------------

Server address: 127.0.0.1
Server port   : 9339

22:09:07.578 - [ INFO ] > [EventWriter] ..... started :: 1 thread(s)
22:09:07.593 - [ INFO ] > [SystemHandler] ... started :: 1 thread(s)
22:09:07.594 - [ INFO ] > [ExtensionHandler]. started :: 1 thread(s)
22:09:07.594 - [ INFO ] > [DeadChannelsPolicy: strict]
22:09:07.594 - [ INFO ] > Server is up and running!

希望对你有帮助。

【讨论】:

在 *.bat 中调整 java 的路径为我解决了这个问题,谢谢。

以上是关于致命错误:无法在 smartFoxServer 中创建日志文件的主要内容,如果未能解决你的问题,请参考以下文章

SmartFoxServer 无法连接到服务器

SmartFoxServer 与 Unity 日志记录问题

SmartFoxServer Basic 用户请假错误

致命错误:无法声明类错误,因为该名称已在使用中

了解致命错误:无法在写入上下文中使用临时表达式

PHP - 致命错误:无法在写入上下文中使用方法返回值