WebSphere Application Server的SystemOut.log的日志中发现J2CA0075W的警告

环境:
产品:WebSphere Application Server(以下简称WAS)
版本:5.0.x 5.1.x
平台:平台无关

问题描述:
用户在WAS V5的SystemOut.log的日志中发现类似如下的错误:
[4/11/03 11:53:41:711 PDT] 891a0 ConnectionMan W J2CA0075W: An active transaction should be present while processing method allocateMCWrapper.
[4/11/03 11:53:41:815 PDT] 891a0 ConnectionMan W J2CA0075W: An active transaction should be present while processing method initializeForUOW.

解答:
这一信息产生的原因是用户使用了不受支持的环境。在J2EE 1.3的规范中禁止EJB自身线程派生出来的线程去访问数据库。但是对于Servlet自身线程派生出来的线程去访问数据库,当前的J2EE 1.3的规范中没有明确是否禁止,所以在WAS V5中我们是允许这种情况发生的。
由于,产品的设计人员不想鼓励这种不受保护的线程去访问数据库,所以当这种情况发生的时候WAS V5将会在日志中产生上面的警告信息。虽然这种信息会充满整个系统日志,但是产品的设计者正是希望如此提醒用户其应用程序存在不合理的设计。用户应该更改程序的不合理设计以消除这些警告信息。
当然,对于不能通过更改应用设计的用户可以通过如下的方法解决这一问题:

1. 用文本编辑器打开如下的文件:
<WAS_HOME>/properties/j2c.properties
*其中<WAS_HOME>代表的是WAS的安装目录

2. 在文件中添加如下的一行:
<logMissingTranContext>false</logMissingTranContext>

Problem
Application gets the following warning messages in the SystemOut.log:

[4/11/03 11:53:41:711 PDT] 891a0 ConnectionMan W J2CA0075W: An active transaction should be present while processing method allocateMCWrapper.
[4/11/03 11:53:41:815 PDT] 891a0 ConnectionMan W J2CA0075W: An active transaction should be present while processing method initializeForUOW.
 
Cause
These messages are being produced due to an "unsupported" environment. When application has spun its own threads from an EJB, accessing a database is not supported (per the J2EE specification). If a Servlet is spinning its own threads and accessing a database, the J2EE specification is not clear on this, so WebSphere Application Server 5.0 will allow it at this time. IBM is working with Sun to clarify this in the specification, so eventually (i.e. J2EE 1.4) spun threads from a Servlet accessing a database outside of a transaction will not be supported either.

Since we don't want to promote the usage of these "naked" threads accessing databases, we are producing the warning messages. Although they may be filling up the logs, we feel that these are necessary to warn the user that they are doing something not in-line with the intended usage. Customers should consider changing their application to comply with the
J2EE specification.

 
Solution
The temporary fix to suppress these warning messages from log file is to modify the file j2c.properties which can be found in the $WAS_HOME/properties directory ($WAS_HOME is the directory where WebSphere Application Server 5.0.x is installed) and
add the following line to the file:

    <logMissingTranContext>false</logMissingTranContext>

你可能感兴趣的:(WebSphere Application Server的SystemOut.log的日志中发现J2CA0075W的警告)