【Exception】Caused by: javax.naming.OperationNotSupportedException: Context is read only

阅读 61

2023-06-05


案发现场

软件

版本

OS

Mac 10.15.7

JDK

1.8

tomcat

7

Caused by: javax.naming.OperationNotSupportedException: Context is read only
        at org.apache.naming.NamingContext.checkWritable(NamingContext.java:962)
        at org.apache.naming.NamingContext.close(NamingContext.java:762)
        at com.itplh.web.context.JndiComponentContext.close(JndiComponentContext.java:424)
        ... 4 more

原因分析

由于javax.naming.Context是只读的,在关闭应用的回调函数中,我们手动调用了它的 close 方法。

通过 DEBUG 我们能发现当前 Context 的exceptionOnFailedWrite值为true

【Exception】Caused by: javax.naming.OperationNotSupportedException: Context is read only_apache

解决方案

webapp/META-INF/context.xml调整配置

<Context jndiExceptionOnFailedWrite="false">
</Context>

参考

https://www.thinbug.com/q/15340218


精彩评论(0)

0 0 举报