[seasar-dotnet:1781] 複数データソース指定で、 Transaction 属性を付けたメソッドでアカウントロックエラー発生

[E-MAIL ADDRESS DELETED] [E-MAIL ADDRESS DELETED]
2010年 7月 15日 (木) 20:31:41 JST


ナガイシです。

また質問で恐縮ですが

Dao設定クラスを作成し、DaoインターフェースのS2Dao属性で設定し
データソースの切替を行っています。

データソースの切替には成功しましたが
Transaction属性付きのメソッドを最初に実行すると
「ORA-28000: アカウントがロックされています。」とエラーが発生します。
一度,Transaction属性の無いメソッドを実行すると正常に処理が行われ
それ以降はTransaction属性付きのメソッドも正常に処理されます。

エラー内容は以下の通りです。
場所 Seasar.Framework.Util.DataSourceUtil.GetConnection(IDataSource dataSource)
  ---> System.Data.DataException: コネクションのオープンに失敗しました。
    データベースは起動しているか?接続文字列、プロバイダの設定は正しいか?
    ご確認をお願いします。
    ---> Oracle.DataAccess.Client.OracleException ORA-28000: アカウントがロックされています。
      場所 Oracle.DataAccess.Client.OracleException.HandleErrorHelper
         (Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, 
           OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure)


データソースをS2Dao属性に設定しない場合は上記のエラーは発生せず
正常に処理が行われます。


サンプルソースは以下に記述していますが
Dao設定クラスのソースをここに記述します。

<<Dao設定クラス>>
Namespace Dao

    Public Class DS1DaoSetting
        Inherits Seasar.Quill.Dao.Impl.TypicalDaoSetting

        Public Overrides ReadOnly Property DataSourceName() As String
            Get
                Return "DS1"
            End Get
        End Property

    End Class

    Public Class DS2DaoSetting
        Inherits Seasar.Quill.Dao.Impl.TypicalDaoSetting

        Public Overrides ReadOnly Property DataSourceName() As String
            Get
                Return "DS2"
            End Get
        End Property

    End Class


Seasar.NetのHPを見て、作成してみましたが
ソース上何か問題はありますでしょうか?

ご助言などございましたら、ご返信をお願い致します。

Seasar.NetのDllは前回の質問で頂いた修正版のソースから
コンパイルしたものを使用しています。



ソースはスレッドの1760、1770の改造版なのですが
違いは、Quillの設定ファイルをWeb.configから
独自ファイル(Seasar.Net.Quill.config)に変更

WebServiceのGlobal.asaxのApplication_Startメソッドで
QuillConfig.ConfigPathに指定。

データソースの設定を2つ(DS1、DS2)設定し、DS1は接続エラーになる設定で
S2Dao属性でDS2を指定しています。


開発環境
Windows XP SP3
VisualBasic 2008 (.Net Framework3.5)
S2Container.Net 1.3.17 (Quill)
Oracle11.2.0.1
ODP.NET 2.112.1.0

構成は以下の通りです。
(1)Windows Form (SampleFormクラス)
 ↓
(2)ASP.NET XML Service (SampleWebServiceクラス)
 ↓
(3)BusinessLogic (SampleBusinessLogicImplクラス
   (←ISampleBusinessLogicインターフェース)) ※トランザクション属性
 ↓
(4)DAO Interface (IM_TESTdaoインターフェース)


<<Windows Form>>
Public Class SampleForm

Private Sub btnExec_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnExec.Click

Dim _SampleWebService As New SampleWebService.SampleWebService
Dim _entity As New SampleWebService.M_TESTentity
Dim _entityList() As SampleWebService.M_TESTentity

With _entity
.Seqid = txtID.Text
.Name = txtNAME.Text
.Birth = CDate(dtpBirth.Value)
.Biko = txtBIKO.Text
End With

Select Case True
Case rdoInsert.Checked
If _SampleWebService.DataInsert(_entity) Then
MessageBox.Show("正常")
Else
MessageBox.Show("異常")
End If
Case rdoUpdate.Checked
If _SampleWebService.DataUpdate(_entity) Then
MessageBox.Show("正常")
Else
MessageBox.Show("異常")
End If
Case rdoDelete.Checked
If _SampleWebService.DataDelete(_entity) Then
MessageBox.Show("正常")
Else
MessageBox.Show("異常")
End If
End Select
End Sub

<<Web Service>>
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)> _
Public Class SampleWebService
Inherits System.Web.Services.WebService

Protected injector As QuillInjector = QuillInjector.GetInstance
Protected SampleClass As ISampleBusinessLogic

Public Sub New()
injector.Inject(Me)
End Sub

<WebMethod()> _
Public Function DataInsert(ByVal entity As M_TESTentity) As Boolean
Return SampleClass.DataInsert(entity)
End Function

<WebMethod()> _
Public Function DataUpdate(ByVal entity As M_TESTentity) As Boolean
Return SampleClass.DataUpdate(entity)
End Function

<WebMethod()> _
Public Function DataDelete(ByVal entity As M_TESTentity) As Boolean
Return SampleClass.DataDelete(entity)
End Function
End Class


<<Web.config>>

  中略

  <appSettings>
    <add key ="SeasarNetSetting" value ="D:\Program Files\Source\Define\Seasar.Quill.dll.config"/>
  </appSettings>


<<Global.asax>>
Public Class Global_asax
    Inherits System.Web.HttpApplication

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' アプリケーションの起動時に呼び出されます。

        QuillConfig.ConfigPath = ConfigurationManager.AppSettings("SeasarNetSetting")

    End Sub

  以下、省略



<<Seasar.Net.Quill.config>>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="quill" type="Seasar.Quill.Xml.QuillSectionHandler, Seasar.Quill" />
  </configSections>

<quill>
<dataSources>
	<dataSource name="DS1">
	<provider>ODP</provider>
	<connectionString>"Data Source=ORA_NOT;User
	ID=notuser;Password=notpwd"</connectionString>
	<class>Seasar.Extension.Tx.Impl.TxDataSource</class>
	</dataSource>
	
	<dataSource name="DS2">
	<provider>ODP</provider>
	<connectionString>"Data Source=ORA_SAMPLE;User
	ID=sampleuser;Password=samplepwd"</connectionString>
	<class>Seasar.Extension.Tx.Impl.TxDataSource</class>
	</dataSource>
</dataSources>

<assemblys>
<assembly>Seasar</assembly>
<assembly>Seasar.Dao</assembly>
<!-- Oracle Data Provider for .NET を使用する場合に必要です。 -->
<assembly>Oracle.DataAccess, version=2.112.1.0, Culture=neutral,
PublicKeyToken=89b483f429c47342</assembly>
<!--<assembly>SampleBusinessLogic</assembly>-->
</assemblys>
</quill>
</configuration>





<<BusinessLogic>>
※インターフェース
<Implementation(GetType(SampleBusinessLogicImpl))> _
Public Interface ISampleBusinessLogic
Function DataInsert(ByVal entity As M_TESTentity) As Boolean
Function DataUpdate(ByVal entity As M_TESTentity) As Boolean
Function DataDelete(ByVal entity As M_TESTentity) As Boolean
End Interface

※クラス
Public Class SampleBusinessLogicImpl
Implements ISampleBusinessLogic

Protected daoObject As IM_TESTdao
<Transaction()>
Public Overridable Function DataInsert(ByVal entity As M_TESTentity) As
Boolean Implements ISampleBusinessLogic.DataInsert
Dim intResult As Integer
intResult = daoObject.InsertData(entity)
Return True
End Function

Public Function DataUpdate(ByVal entity As M_TESTentity) As Boolean
Implements ISampleBusinessLogic.DataUpdate
Dim intResult As Integer
intResult = daoObject.UpdateData(entity)
Return True
End Function

<Transaction()>
Public Function DataDelete(ByVal entity As M_TESTentity) As Boolean
Implements ISampleBusinessLogic.DataDelete
Dim intResult As Integer
intResult = daoObject.DeleteData(entity)
Return True
End Function
End Class


<<Dao Interface>>
※インターフェース
<Implementation()> _
<S2Dao(DS2DaoSetting)> _
<Bean(GetType(M_TESTentity))> _
Public Interface IM_TESTdao
Inherits AbstractBaseDao

Function InsertData(ByVal data As M_TESTentity) As Integer
Function UpdateData(ByVal data As M_TESTentity) As Integer
Function DeleteData(ByVal data As M_TESTentity) As Integer
End Interface

※エンティティクラス
<Table("M_TEST")> _
Public Class M_TESTentity
Inherits AbstractBaseEntity

Private _seqid As String
Private _name As String
Private _birth As Nullable(Of Date)
Private _biko As String

Public Sub New()
_seqid = ""
_name = ""
_biko = ""
End Sub

<Column("SEQID")> _
Public Property Seqid() As String
Get
Return _seqid.PadRight(5, " ") 'PrimaryKeyがChar型の場合、桁数に合わせて
空白を付加しないと自動作成SQLと連動できない
End Get
Set(ByVal value As String)
_seqid = value
End Set
End Property

<Column("NAME")> _
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property

<Column("BIRTH")> _
Public Property Birth() As Date
Get
Return _birth
End Get
Set(ByVal value As Date)
_birth = value
End Set
End Property

<Column("BIKO")> _
Public Property Biko() As String
Get
Return _biko
End Get
Set(ByVal value As String)
_biko = value
End Set
End Property

End Class


seasar-dotnet メーリングリストの案内