【问题标题】:Jersey ServletContainer Hangs when logging errors in Errors.logErrorsJersey ServletContainer 在 Errors.logErrors 中记录错误时挂起
【发布时间】:2016-07-24 15:26:48
【问题描述】:

当我们重新加载 resourceConfig 时,我们面临一个严重的问题,即 Jersey 容器进入挂起状态。 重新加载球衣容器的代码是 container.reload(ResourceConfig.forApplication(application));

我们无法找到此问题的根本原因,它现在阻止了我们的发布。

我们使用的是球衣版本 2.13。

我们收到的堆栈跟踪如下

Thread [DefaultMessageListenerContainer-1] (Suspended)  
owns: BufferedOutputStream  (id=3280)   
owns: PrintStream  (id=3281)    
owns: LoggingConfigurationHelper$2  (id=3282)   
owns: OutputStreamWriter  (id=3283) 
owns: ConsoleHandler  (id=3284) 
owns: RestfulConnector  (id=2845)   
FileOutputStream.writeBytes(byte[], int, int, boolean) line: not available [native method]  
FileOutputStream.write(byte[], int, int) line: not available    
BufferedOutputStream.write(byte[], int, int) line: not available    
PrintStream.write(byte[], int, int) line: not available 
LoggingConfigurationHelper$2(PrintStream).write(byte[], int, int) line: not available   
StreamEncoder.writeBytes() line: not available  
StreamEncoder.implFlushBuffer() line: not available 
StreamEncoder.implFlush() line: not available   
StreamEncoder.flush() line: not available   
OutputStreamWriter.flush() line: not available  
ConsoleHandler(StreamHandler).flush() line: not available   
ConsoleHandler.publish(LogRecord) line: not available   
Logger.log(LogRecord) line: not available   
Logger.doLog(LogRecord) line: not available 
Logger.log(Level, String) line: not available   
Logger.warning(String) line: not available  
Errors.logErrors(Collection<ErrorMessage>) line: 191    
Errors.processErrors(boolean) line: 132 
Errors.postProcess(boolean) line: 423   
Errors.process(Callable<T>, boolean) line: 320  
Errors.process(Producer<T>, boolean) line: 297  
Errors.processWithException(Runnable) line: 286 
ApplicationHandler.<init>(Application, Binder, ServiceLocator) line: 320    
ApplicationHandler.<init>(Application, Binder) line: 285    
WebComponent.<init>(WebConfig, ResourceConfig) line: 311    
ServletContainer.reload(ResourceConfig) line: 578

我们也有一名嫌疑人。在我们的 REST 资源之一中,我们返回 List。我们在球衣日志中观察到以下警告,在此日志之后容器进入不可用状态。

WARNING: The following warnings have been detected: 
WARNING: Return type, java.util.List<SomeObject>, of method, public java.util.List<SomeObject> myResource.get(javax.ws.rs.core.UriInfo,java.lang.String,java.lang.String), is not resolvable to a concrete type.

任何帮助都会有很大帮助! 如果您需要更多信息,请告诉我。 非常感谢。

【问题讨论】:

    标签: java rest jersey


    【解决方案1】:

    我们可以通过配置日志记录来解决这个问题。现在,日志被定向到文件。

    【讨论】:

      猜你喜欢
      • 2013-03-12
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 1970-01-01
      • 2022-01-16
      • 2018-01-17
      • 2013-06-23
      • 1970-01-01
      相关资源
      最近更新 更多