0

这个问题让我抓狂。

我在 Kubuntu 12.04 上使用 glassfish V2.1 和 JDK 1.6.0_27。如果我启动服务器我得到了这个异常

    Starting Domain domain1, please wait.
Default Log location is /usr/share/glassfish-v2.1-b60e/domains/domain1/logs/server.log.
Redirecting output to /usr/share/glassfish-v2.1-b60e/domains/domain1/logs/server.log
recursive call into SystemOutandErrhandler
java.lang.RuntimeException: recursivecall
        at com.sun.enterprise.server.logging.SystemOutandErrHandler$LoggingByteArrayOutputStream.flush(SystemOutandErrHandler.java:359)
        at java.io.PrintStream.write(PrintStream.java:449)
        at com.sun.enterprise.server.logging.SystemOutandErrHandler$LoggingPrintStream.write(SystemOutandErrHandler.java:293)
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220)
        at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:134)
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:220)
        at java.io.Writer.write(Writer.java:157)
        at java.util.logging.StreamHandler.publish(StreamHandler.java:209)
        at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:105)
        at java.util.logging.Logger.log(Logger.java:530)
        at java.util.logging.Logger.doLog(Logger.java:552)
        at java.util.logging.Logger.log(Logger.java:575)
        at com.sun.enterprise.server.logging.SystemOutandErrHandler$LoggingByteArrayOutputStream.flush(SystemOutandErrHandler.java:368)
        at java.io.PrintStream.write(PrintStream.java:449)
        at com.sun.enterprise.server.logging.SystemOutandErrHandler$LoggingPrintStream.write(SystemOutandErrHandler.java:293)
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220)
        at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:290)
        at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:294)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:140)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
        at java.util.logging.StreamHandler.flush(StreamHandler.java:242)
        at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:106)
        at java.util.logging.Logger.log(Logger.java:530)
        at java.util.logging.Logger.doLog(Logger.java:552)
        at java.util.logging.Logger.log(Logger.java:616)
        at com.sun.enterprise.server.ApplicationServer.printStartupInfo(ApplicationServer.java:618)
        at com.sun.enterprise.server.ApplicationServer.onInitialization(ApplicationServer.java:170)
        at com.sun.enterprise.server.ondemand.OnDemandServer.onInitialization(OnDemandServer.java:103)
        at com.sun.enterprise.server.PEMain.run(PEMain.java:399)
        at com.sun.enterprise.server.PEMain.main(PEMain.java:336)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at com.sun.enterprise.server.PELaunch.main(PELaunch.java:415)
Domain domain1 is ready to receive client requests. Additional services are being started in background. 
Domain [domain1] is running [Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)] with its configuration and logs at: [/usr/share/glassfish-v2.1-b60e/domains].
Admin Console is available at [http://localhost:4848].
Use the same port [4848] for "asadmin" commands.
User web applications are available at these URLs:
[http://localhost:8080 https://localhost:8181 ].
Following web-contexts are available:
[/web1  /__wstx-services /jamon ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://calvi:8686/jmxrmi] for domain management purposes.
Domain listens on at least following ports for connections:
[8080 8181 4848 3700 3820 3920 8686 ].
Domain does not support application server clusters and other standalone instances.

服务器运行没有问题,但日志记录不起作用。我也重新安装了 glassfish 和 java。但它没有帮助。如果我注释掉文件 /etc/java-6-openjdk/logging.properties 中的处理程序行,则服务器无异常启动,但日志记录不再起作用。

handlers= java.util.logging.ConsoleHandler

我不知道这是否发生在 ConsoleHandler 类中。

在此先感谢您的帮助。

4

1 回答 1

0

看起来您需要升级到 GlassFish V3。请参阅:GLASSFISH-8822GlassFish 3 意味着没有 GlassFish 2.1.2

GLASSFISH-6164中,解决方法被列为:

如果我在调用 readConfiguration 之前将 System.out 和 System.err 重置为指向一个临时文件,并且不将它们重置为指向记录器,那么一切正常。

您可能能够创建一个自定义LogManager,在调用 readConfiguration 时执行该解决方法。然后在启动时使用 java.util.logging.manager 系统属性安装自定义 LogManager。

于 2013-08-05T14:34:06.443 回答