recursive call into SystemOutandErrhandler

感情迁移 提交于 2019-12-11 14:16:07

问题


this problem makes me crazy.

I'm using glassfish V2.1 and JDK 1.6.0_27 on Kubuntu 12.04. If i start the server i got this exception

    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.

The server runs without problems but the logging doesnt work. I reinstalled glassfish and java too. But it doesnt help. If i comment out the handlers line in the file /etc/java-6-openjdk/logging.properties the server starts without exceptions but the logging doesnt work furthermore.

handlers= java.util.logging.ConsoleHandler

I dont know if this occured to the ConsoleHandler class.

Thanks in advance for your help.


回答1:


Looks like you need to upgrade to GlassFish V3. See: GLASSFISH-8822 and GlassFish 3 means no GlassFish 2.1.2

From GLASSFISH-6164 the workaround is listed as:

If I reset System.out and System.err to point to a temporary file before calling readConfiguration and don't reset them to point to the logger then everything works fine.

You might be able to create a custom LogManager that performs that workaround when readConfiguration is called. Then install the custom LogManager by using the java.util.logging.manager system property on startup.



来源:https://stackoverflow.com/questions/18059535/recursive-call-into-systemoutanderrhandler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!