[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jfriends-ml 11015] RE: EJB デザインパ ターンを読む会第 1 回議事録



  高橋(智)です。

k-suke nakamura wrote:
> 
> 中村です。
> 
> >   ◆トランザクションの属性のデフォルト値があったかも知れない
> >     --> 配布ディスクリプタ(.xml)に何も書かなかったとどうなるのか?
> >        --> 配布時に検証でエラーになる?
> >        --> EJBの仕様は?
> >        --> 宿題!!
> 
> 先日は、お疲れ様でした。
> 上記の宿題についてですが、
> 以下のURLにトランザクションの属性のデフォルト値は、
> Requiredと記載されていました。
> http://d.hatena.ne.jp/kadakada/20040122
> でも、EJBの仕様書を見て確かめたほうが良いかも。。。

  結論から言うと「デプロイ」レベルでは、配布ディスクリプタ(ejb-jar.xml)への
記述が必須であり「デフォルト値はない」と思います。(※もちろんコンテナ管理の
トランザクションの場合の話です)

  以下、「EJB2.0の仕様書」とJ2EE1.3準拠の「Borland Enterprise Server5.2.1」
で確認した結果を掲載します。

[ejb-2_0-fr-spec.pdf]から引用
------------------------------------------------------------------------
[Chapter 17 Support for Transactions]
With container-managed transaction demarcation, the Container demarcates
transactions per instructions provided by the Application Assembler in the
deployment descriptor.
...
...
17.2.5 Container-managed demarcation
Whenever a client invokes a method on the home or component interface of an
enterprise Bean, the container interposes on the method invocation. The
interposition allows the container to control transaction demarcation
declaratively through the transaction attribute set by the Application
Assembler.
...
...
17.3.6 Declaration in deployment descriptor
...
The Bean Provider of an enterprise bean with container-managed transaction
demarcation may optionally specify the transaction attributes for the
enterprise bean's methods. See Subsection 17.4.1.
...
17.4.1 Transaction attributes
Note: The transaction attributes may be specified either by the Bean Provider
or by the Application Assembler. 
...
Providing the transaction attributes for an enterprise bean is an optional
requirement for the Application Assembler, because, for a given enterprise
bean, the Application Assembler must either specify a value of the transaction
attribute for all the methods for which a transaction attribute must be
specified, or the Assembler must specify none. If the transaction attributes
are not specified for the methods of an enterprise bean, the Deployer will
have to specify them.
...
...
17.5 Deployer's responsibilities
The Deployer is responsible for ensuring that the methods of the deployed
enterprise beans with container-managed transaction demarcation have been
assigned a transaction attribute. If the transaction attributes have not
been assigned previously by the Assembler, they must be assigned by the
Deployer.
------------------------------------------------------------------------


コンテナトランザクションの属性が抜けている[ejb-xml]
------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
             JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd";>
<ejb-jar>
  <display-name>EJBModule1</display-name>
  <enterprise-beans>
    <session>
      <display-name>Enterprise1</display-name>
      <ejb-name>Enterprise1</ejb-name>
      <home>bes521.Enterprise1Home</home>
      <remote>bes521.Enterprise1</remote>
      <ejb-class>bes521.Enterprise1Bean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>
</ejb-jar>
------------------------------------------------------------------------

Borland Enterprise Server 5.2.1を使用して
ロール[開発者] でEJBの.jarファイルをベリファイ(検証)をした結果
------------------------------------------------------------------------
 EJBModule1 / 2004/02/03 23:40:00 JST を検証中...
Verifying ejb module C:/home/ken/bes521/EJBModule1.jar [role=developer]
0 errors, 0 warnings
------------------------------------------------------------------------

Borland Enterprise Server 5.2.1を使用して
ロール[アセンブラ]or[デプロイヤ]でEJBの.jarファイルをベリファイ(検証)をした結果
------------------------------------------------------------------------
 EJBModule1 / 2004/02/03 23:42:11 JST を検証中...
Verifying ejb module C:/home/ken/bes521/EJBModule1.jar [role=deployer]
#### Error: [C:/home/ken/bes521/EJBModule1.jar] Session Bean "Enterprise1"
There must be a transaction-attribute associated with the method:
    public abstract void bes521.Enterprise1.untitledMethod1()
                                                throws java.rmi.RemoteException
1 error, 0 warnings
------------------------------------------------------------------------

Borland Enterprise Server 5.2.1へ[配布ディスクリプタを検証]しつつ配布した結果
------------------------------------------------------------------------
検証中 C:\home\ken\bes521\EJBModule1.jar
Verifying ejb module EJBModule1.jar [role=deployer]
#### Error: [EJBModule1.jar] Session Bean "Enterprise1"
There must be a transaction-attribute associated with the method:
    public abstract void bes521.Enterprise1.untitledMethod1()
                                                throws java.rmi.RemoteException
1 error, 0 warnings
------------------------------------------------------------------------

今度は、[配布ディスクリプタを検証]をスキップして配布した結果
------------------------------------------------------------------------
検証をスキップ中
パーティション standard のモジュールを配布中
EJBModule1 を bes://ttakahashixp/standard に配布中
パーティション standard のモジュールを有効化中
Error type: com.borland.enterprise.management.api.AgentException
Thread: Thread[doPopulate BasicDialog,6,main]
Stack trace:
com.borland.enterprise.management.api.AgentException: Module
[C:/BES521/var/servers/ttakahashixp/partitions/standard/ejb_jars/EJBModule1.jar] could not
be created. See Partition log for details
	at
com.borland.enterprise.management.api.impl.CORBAAgentTransport.loadEjbJar(CORBAAgentTransport.java:1246)
	at com.borland.enterprise.management.api.impl.Partition.enableEjbJar(Partition.java:650)
	at
com.borland.enterprise.management.api.impl.DeployedArchive.enable(DeployedArchive.java:153)
	at com.borland.management.tools.ModuleDeployer.load(ModuleDeployer.java:532)
	at com.borland.management.tools.ModuleDeployer.process(ModuleDeployer.java:253)
	at com.borland.management.tools.ModuleDeployer.deployModule(ModuleDeployer.java:146)
	at
com.borland.management.console.wizards.deploy.DeployWizardProgressDialog.process(DeployWizardProgressDialog.java:145)
	at
com.borland.management.console.wizards.deploy.DeployWizardProgressDialog.populateModel(DeployWizardProgressDialog.java:122)
	at com.borland.jafa.ui.BasicDialog.populate(BasicDialog.java:283)
	at com.borland.jafa.ui.BasicDialog$1.run(BasicDialog.java:266)
	at java.lang.Thread.run(Thread.java:536)
------------------------------------------------------------------------
--- Partition log ------------------------------------------------------
[Tue Feb 03 23:49:55 JST 2004] Errors or warnings were found while verifying ejb module
C:/BES521/var/servers/ttakahashixp/partitions/standard/ejb_jars/EJBModule1.jar
[Tue Feb 03 23:49:55 JST 2004] #### Error:
[C:/BES521/var/servers/ttakahashixp/partitions/standard/ejb_jars/EJBModule1.jar] Session
Bean "Enterprise1"
[Tue Feb 03 23:49:55 JST 2004] There must be a transaction-attribute associated with the
method:
[Tue Feb 03 23:49:55 JST 2004]     public abstract void
bes521.Enterprise1.untitledMethod1() throws java.rmi.RemoteException
[Tue Feb 03 23:49:55 JST 2004] Verified module EJBModule1.jar: 1 error, 0 warnings. See
error log for details.
[Tue Feb 03 23:49:55 JST 2004] Verified module EJBModule1.jar: 1 error, 0 warnings.
------------------------------------------------------------------------

-- 
高橋智宏
  Java読書会( http://www.javareading.com/bof/ )