2013-08-05 95 views
0

這個問題讓我發瘋。遞歸調用SystemOutandErrhandler

我在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類。

在此先感謝您的幫助。

+1

聽起來像一個錯誤。看起來,嘗試記錄一些文本的觸發器和錯誤會嘗試記錄更多文本。 –

回答

0

看起來您需要升級到GlassFish V3。請參閱:GLASSFISH-8822和從GLASSFISH-6164解決辦法被列爲GlassFish 3 means no GlassFish 2.1.2

如果我重置的System.out和System.err調用 readConfiguration前指向一個臨時文件,不把它們重置指向記錄器,然後一切 工作正常。

您可能可以創建一個自定義LogManager,它在調用readConfiguration時執行該解決方法。然後在啓動時使用java.util.logging.manager系統屬性安裝自定義LogManager。

+0

你能告訴我可以下載v2.1.2嗎?我找不到它。這是官方的glassfish版本嗎? – sylo

+0

編輯並添加鏈接。 – jmehrens