Author |
Message
|
kiran_tala |
Posted: Tue Nov 09, 2004 1:26 pm Post subject: Problem with container managed MDB with JTA transaction |
|
|
Novice
Joined: 16 Jul 2004 Posts: 14
|
In WAS 5.0 we are trying to use container managed MDB's. since we are
doing JDBC calls in the MDB we had to deal with JTA two phase commit transaction.we are having a problem with this and it says
setTransactionIsolationLevel() is null.
I tried setting up the parameter <trans-attrtibute> to Required on the MDB's onMessage() method. Still no luck.
In the debug mode I found out that it is not finding the UserTransaction using JNDI look up.
when we changed the MDB to bean managed everything working fine like reading the message from the queue and updating the database and issuing the two phase commit.
we have no problem with the container managed session beans to send the messages like update the database and send a message using the JTA transaction.
Please help me on this. I am sure I am doing something wrong in the WAS 5.0 assembly descriptor settings but I don't know what it is.
Thanks,
kiran. |
|
Back to top |
|
 |
kiran_tala |
Posted: Tue Nov 09, 2004 1:30 pm Post subject: I am sorry not to mention this |
|
|
Novice
Joined: 16 Jul 2004 Posts: 14
|
We are using XADatasource to access DB2 to support the two phase commit.
kiran |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Nov 09, 2004 1:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Check the setup for the Queue Connection Factory
In the WAS setup there is a checkbox for XA support.
Make sure it is checked.
Hope this helps
 |
|
Back to top |
|
 |
kiran_tala |
Posted: Tue Nov 09, 2004 2:04 pm Post subject: Can you let me know where this option might be in WSAD 5.0 |
|
|
Novice
Joined: 16 Jul 2004 Posts: 14
|
Thanks for the reply. Right now I am testing in WSAD 5.0 . Can you know where this check box might be to set the XA support.
kiran |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Nov 09, 2004 2:08 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You have to go to the admin console and check
"Websphere MQ JMS" for the QCF definition.
Check the QCF definition details screen. The check box should be there somewhere. |
|
Back to top |
|
 |
kiran_tala |
Posted: Tue Nov 09, 2004 2:26 pm Post subject: Its checked |
|
|
Novice
Joined: 16 Jul 2004 Posts: 14
|
Hello fjb_saper,
I double checked the QueueConnectionFactory and enable XASupport check box is checked.
If you have some more suggestions please let me know.
Thanks,
kiran. |
|
Back to top |
|
 |
kiran_tala |
Posted: Wed Nov 10, 2004 6:42 am Post subject: Please post the suggestions |
|
|
Novice
Joined: 16 Jul 2004 Posts: 14
|
Please post some more suggestions... |
|
Back to top |
|
 |
JLRowe |
Posted: Thu Nov 11, 2004 2:21 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
Post your code and your deployment descriptor. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 11, 2004 2:32 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Post as well your QCF setup as well as your JAAS security setup for MQ (no passwd needed)
Let us know the name of the user running Websphere.
Show us as well the EJB security set up as in the deployment descriptor
Thanks
F.J. |
|
Back to top |
|
 |
kiran_tala |
Posted: Tue Nov 16, 2004 7:39 am Post subject: Here is my assembly descriptors |
|
|
Novice
Joined: 16 Jul 2004 Posts: 14
|
I didn't do any particular setup with EJB secutrity.
I setup the JAAS security for my datasources.No JAAS security setup other than those.
My wesphere is running with default admin user id.
I setup the security
EJB assembly descriptor :
<?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 id="ejb-jar_ID">
<display-name>MDBEJB</display-name>
<enterprise-beans>
<message-driven id="MessageDriven_1099324278797">
<ejb-name>SimpleMessage</ejb-name>
<ejb-class>com.yourcomp.test.SimpleMessageBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
<ejb-local-ref id="EJBLocalRef_1099663346469">
<description></description>
<ejb-ref-name>ejb/com/yourcomp/test/SimpleSenderLocalHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.yourcomp.test.SimpleSenderLocalHome</local-home>
<local>com.yourcomp.test.SimpleSenderLocal</local>
<ejb-link>SimpleSender</ejb-link>
</ejb-local-ref>
<resource-ref id="ResourceRef_1099325279578">
<description></description>
<res-ref-name>jdbc/aoc_pool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="ResourceRef_1099325353234">
<description></description>
<res-ref-name>Simple/jms/SimpleQCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="ResourceRef_1099417410625">
<description></description>
<res-ref-name>jdbc/aoc_pool_xa</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-env-ref id="ResourceEnvRef_1099325154125">
<description></description>
<resource-env-ref-name>Simple/jms/SimpleQ1</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
<resource-env-ref id="ResourceEnvRef_1099325208156">
<description></description>
<resource-env-ref-name>Simple/jms/SimpleQ</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
</message-driven>
<session id="SimpleSender">
<ejb-name>SimpleSender</ejb-name>
<local-home>com.yourcomp.test.SimpleSenderLocalHome</local-home>
<local>com.yourcomp.test.SimpleSenderLocal</local>
<ejb-class>com.yourcomp.test.SimpleSenderBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref id="ResourceRef_1099325458344">
<description></description>
<res-ref-name>Simple/jms/SimpleQCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-env-ref id="ResourceEnvRef_1099325404812">
<description></description>
<resource-env-ref-name>Simple/jms/SimpleQ</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>SimpleMessage</ejb-name>
<method-name>onMessage</method-name>
<method-params>
<method-param>javax.jms.Message</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
SEVER-CONFIG.xml :
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:resources.jdbc="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.jdbc.xmi" xmlns:resources.jms="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.jms.xmi" xmlns:resources.jms.internalmessaging="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.jms.internalmessaging.xmi" xmlns:resources="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.xmi" xmlns:resources.jms.mqseries="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.jms.mqseries.xmi" xmlns:resources.j2c="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.j2c.xmi" xmlns:resources.mail="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.mail.xmi" xmlns:resources.url="http://www.ibm.com/websphere/appserver/schemas/5.0/resources.url.xmi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xmi:Documentation>
<contact>{Your Contact Info}</contact>
</xmi:Documentation>
<resources.jdbc:JDBCProvider xmi:id="JDBCProvider_1" name="Cloudscape JDBC Driver" description="Cloudscape JDBC Provider" implementationClassName="com.ibm.db2j.jdbc.DB2jConnectionPoolDataSource"/>
<resources.jms:JMSProvider xmi:id="builtin_jmsprovider" name="WebSphere JMS Provider" description="Built-in WebSphere JMS Provider" externalInitialContextFactory="" externalProviderURL="">
<factories xmi:type="resources.jms.internalmessaging:WASQueueConnectionFactory" xmi:id="WASQueueConnectionFactory_1" name="MyMDBConnectionFactory" jndiName="jms/MyMDBConnectionFactory" node="localhost" serverName="server1">
<connectionPool xmi:id="ConnectionPool_3" connectionTimeout="180" maxConnections="10" minConnections="1" unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool"/>
</factories>
<factories xmi:type="resources.jms.internalmessaging:WASQueue" xmi:id="WASQueue_1" name="MyMDBQueue" jndiName="jms/MyMDBQueue" node="localhost" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED"/>
<factories xmi:type="resources.jms.internalmessaging:WASQueue" xmi:id="WASQueue_2" name="MyMDBQueue2" jndiName="jms/MyMDBQueue2" node="localhost" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED"/>
<factories xmi:type="resources.jms.internalmessaging:WASQueue" xmi:id="WASQueue_3" name="MyMDBQueue3" jndiName="jms/MyMDBQueue3" node="localhost" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED"/>
<factories xmi:type="resources.jms.internalmessaging:WASQueue" xmi:id="WASQueue_4" name="MyMDBQueue4" jndiName="jms/MyMDBQueue4" node="localhost" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED"/>
</resources.jms:JMSProvider>
<resources.jms:JMSProvider xmi:id="builtin_mqprovider" name="WebSphere MQ JMS Provider" description="WebSphere MQ JMS Provider" externalInitialContextFactory="" externalProviderURL="">
<classpath>${MQJMS_LIB_ROOT}</classpath>
<nativepath>${MQJMS_LIB_ROOT}</nativepath>
<factories xmi:type="resources.jms.mqseries:MQQueueConnectionFactory" xmi:id="MQQueueConnectionFactory_1" name="WAS_yonk_80654_server1" jndiName="jms/MyMDBConnectionFactory" authMechanismPreference="BASIC_PASSWORD" XAEnabled="true" queueManager="WAS_yonk_80654_server1" host="localhost" port="1414" transportType="BINDINGS" msgRetention="true">
<connectionPool xmi:id="ConnectionPool_1"/>
<mapping xmi:id="MappingModule_1" mappingConfigAlias="DefaultPrincipalMapping" authDataAlias=""/>
<sessionPool xmi:id="ConnectionPool_2"/>
</factories>
<factories xmi:type="resources.jms.mqseries:MQQueue" xmi:id="MQQueue_1" name="WQ_SAMPLE.JMS.Q1" jndiName="jms/MyMDBQueue" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED" baseQueueName="WQ_SAMPLE.JMS.Q1" baseQueueManagerName="WAS_yonk_80654_server1" useNativeEncoding="false" integerEncoding="Normal" decimalEncoding="Normal" floatingPointEncoding="IEEENormal" queueManagerHost="localhost" queueManagerPort="1414"/>
<factories xmi:type="resources.jms.mqseries:MQQueue" xmi:id="MQQueue_2" name="WQ_SAMPLE.JMS.Q2" jndiName="jms/MyMDBQueue2" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED" baseQueueName="WQ_SAMPLE.JMS.Q2" baseQueueManagerName="WAS_yonk_80654_server1" useNativeEncoding="false" integerEncoding="Normal" decimalEncoding="Normal" floatingPointEncoding="IEEENormal" queueManagerHost="localhost" queueManagerPort="1414"/>
<factories xmi:type="resources.jms.mqseries:MQQueue" xmi:id="MQQueue_3" name="WQ_SAMPLE.JMS.Q3" jndiName="jms/MyMDBQueue3" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED" baseQueueName="WQ_SAMPLE.JMS.Q3" baseQueueManagerName="WAS_yonk_80654_server1" useNativeEncoding="false" integerEncoding="Normal" decimalEncoding="Normal" floatingPointEncoding="IEEENormal" queueManagerHost="localhost" queueManagerPort="1414"/>
<factories xmi:type="resources.jms.mqseries:MQQueue" xmi:id="MQQueue_4" name="WQ_SAMPLE.JMS.Q4" jndiName="jms/MyMDBQueue4" persistence="APPLICATION_DEFINED" priority="APPLICATION_DEFINED" expiry="APPLICATION_DEFINED" baseQueueName="WQ_SAMPLE.JMS.Q3" baseQueueManagerName="WAS_yonk_80654_server1" useNativeEncoding="false" integerEncoding="Normal" decimalEncoding="Normal" floatingPointEncoding="IEEENormal" queueManagerHost="localhost" queueManagerPort="1414"/>
</resources.jms:JMSProvider>
<resources.j2c:J2CResourceAdapter xmi:id="builtin_rra" name="WebSphere Relational Resource Adapter" description="Built-in Relational Resource Adapter for Container Managed Persistence" archivePath="${WAS_LIBS_DIR}/rsadapter.rar">
<factories xmi:type="resources.jdbc:CMPConnectorFactory" xmi:id="CMPConnectorFactory_1" name="DB2E1_CF" authMechanismPreference="BASIC_PASSWORD" cmpDatasource="DataSource_2">
<description xsi:nil="true"/>
<authDataAlias xsi:nil="true"/>
<propertySet xmi:id="J2EEResourcePropertySet_1">
<resourceProperties xmi:id="J2EEResourceProperty_1" name="TransactionResourceRegistration" type="java.lang.String" value="dynamic" description="Type of transaction resource registration (enlistment). Valid values are either "static" (immediate) or "dynamic" (deferred).">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_2" name="InactiveConnectionSupport" type="java.lang.Boolean" value="true" description="Specify whether connection handles support implicit reactivation. (Smart Handle support). Value may be "true" or "false".">
<required xsi:nil="true"/>
</resourceProperties>
</propertySet>
<connectionPool xmi:id="ConnectionPool_5" connectionTimeout="0" maxConnections="0" minConnections="0" reapTime="0" unusedTimeout="0" agedTimeout="0" purgePolicy="EntirePool"/>
<mapping xmi:id="MappingModule_2" mappingConfigAlias="DefaultPrincipalMapping" authDataAlias="DB2E1"/>
</factories>
<propertySet xmi:id="J2EEResourcePropertySet_8">
<resourceProperties xmi:id="J2EEResourceProperty_31" name="TransactionResourceRegistration" type="java.lang.String" value="dynamic" description="Type of transaction resource registration (enlistment). Valid values are either "static" (immediate) or "dynamic" (deferred)."/>
<resourceProperties xmi:id="J2EEResourceProperty_32" name="InactiveConnectionSupport" type="java.lang.Boolean" value="true" description="Specify whether connection handles support implicit reactivation. (Smart Handle support). Value may be "true" or "false"."/>
</propertySet>
</resources.j2c:J2CResourceAdapter>
<resources.mail:MailProvider xmi:id="builtin_mailprovider" name="Built-in Mail Provider" description="The built-in mail provider">
<protocolProviders xmi:id="builtin_smtp" protocol="smtp" classname="com.sun.mail.smtp.SMTPTransport" type="TRANSPORT"/>
<protocolProviders xmi:id="builtin_pop3" protocol="pop3" classname="com.sun.mail.pop3.POP3Store" type="STORE"/>
<protocolProviders xmi:id="builtin_imap" protocol="imap" classname="com.sun.mail.imap.IMAPStore" type="STORE"/>
</resources.mail:MailProvider>
<resources.jdbc:JDBCProvider xmi:id="JDBCProvider_2" name="Default DB2 JDBC Provider" description="DB2 JDBC Provider" implementationClassName="COM.ibm.db2.jdbc.DB2XADataSource">
<classpath>${DB2_JDBC_DRIVER_PATH}/db2java.zip</classpath>
<factories xmi:type="resources.jdbc:DataSource" xmi:id="DataSource_1" name="DB2E" jndiName="jdbc/aoc_pool" description="New JDBC Datasource" category="" authDataAlias="DB2E" statementCacheSize="10" datasourceHelperClassname="com.ibm.websphere.rsadapter.DB2DataStoreHelper" relationalResourceAdapter="builtin_rra">
<propertySet xmi:id="J2EEResourcePropertySet_2">
<resourceProperties xmi:id="J2EEResourceProperty_3" name="databaseName" type="java.lang.String" value="DB2E" description="This is a required property. The database name. For example, enter sample to make your Data Source point to jdbc:db2:sample." required="true"/>
<resourceProperties xmi:id="J2EEResourceProperty_4" name="description" type="java.lang.String" value="" description="The description of this datasource.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_5" name="portNumber" type="java.lang.Integer" value="" description="The TCP/IP port number where the jdbc Provider resides.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_6" name="connectionAttribute" type="java.lang.String" value="cursorhold=1" description="The connection attributes. Refer to the DB2 reference for the list of connection attributes.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_7" name="loginTimeout" type="java.lang.Integer" value="0" description="The maximum time to attempt to connect a database. If this value is non-zero, attempt to connect to the database will timeout when this specified value is reached.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_8" name="enableMultithreadedAccessDetection" type="java.lang.Boolean" value="false" description="Indicates whether or not to detect multithreaded access to a Connection and its corresponding Statements, ResultSets, and MetaDatas.">
<required xsi:nil="true"/>
</resourceProperties>
</propertySet>
<connectionPool xmi:id="ConnectionPool_4" connectionTimeout="1800" maxConnections="10" minConnections="1" reapTime="180" unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool"/>
</factories>
<factories xmi:type="resources.jdbc:DataSource" xmi:id="DataSource_2" name="DB2E1" jndiName="jdbc/aoc_pool_xa" description="New JDBC Datasource" category="" statementCacheSize="10" datasourceHelperClassname="com.ibm.websphere.rsadapter.DB2DataStoreHelper" relationalResourceAdapter="builtin_rra">
<authDataAlias xsi:nil="true"/>
<propertySet xmi:id="J2EEResourcePropertySet_3">
<resourceProperties xmi:id="J2EEResourceProperty_9" name="databaseName" type="java.lang.String" value="DB2E" description="This is a required property. The database name. For example, enter sample to make your Data Source point to jdbc:db2:sample." required="true"/>
<resourceProperties xmi:id="J2EEResourceProperty_10" name="description" type="java.lang.String" value="" description="The description of this datasource.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_11" name="portNumber" type="java.lang.Integer" value="" description="The TCP/IP port number where the jdbc Provider resides.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_12" name="connectionAttribute" type="java.lang.String" value="cursorhold=0" description="The connection attributes. Refer to the DB2 reference for the list of connection attributes.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_13" name="loginTimeout" type="java.lang.Integer" value="0" description="The maximum time to attempt to connect a database. If this value is non-zero, attempt to connect to the database will timeout when this specified value is reached.">
<required xsi:nil="true"/>
</resourceProperties>
<resourceProperties xmi:id="J2EEResourceProperty_14" name="enableMultithreadedAccessDetection" type="java.lang.Boolean" value="false" description="Indicates whether or not to detect multithreaded access to a Connection and its corresponding Statements, ResultSets, and MetaDatas.">
<required xsi:nil="true"/>
</resourceProperties>
</propertySet>
<connectionPool xmi:id="ConnectionPool_6" connectionTimeout="1800" maxConnections="10" minConnections="1" reapTime="180" unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool"/>
<mapping xmi:id="MappingModule_3" mappingConfigAlias="DefaultPrincipalMapping" authDataAlias="DB2E1"/>
</factories>
</resources.jdbc:JDBCProvider>
<resources.url:URLProvider xmi:id="URLProvider_1" name="Default URL Provider" streamHandlerClassName="unused" protocol="unused"/>
</xmi:XMI> |
|
Back to top |
|
 |
JLRowe |
Posted: Tue Nov 16, 2004 9:27 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
This is too much of a pain to go through.
Why don't you play with some sample code or tutorials from developerworks, then work back and find what you are doing wrong?? |
|
Back to top |
|
 |
|