>> Hi,
>>
>> I have a JAX-WS client in an EJB session bean. It calls a web
>> service (EJB endpoint) I wrote that queries a database.
> Question: Are both client and web service in same JVM or different
> JVMs? (It should work for both cases, just wondering what your
> specific case is)
They are on two different JVMs. Client is on server #1, service is on
server #2.
>> I've noticed that it forces distributed transactions on the service,
>> and the service won't work unless I use an XA datasource to access
>> the database.
> Questions:
> Could you provide the message that required XA datasource?
I will email this to you directly.
> Could you provide the Glassfish build that this is occuring on?
Sun Java System Application Server 9.1 (build b41d-beta2)
> By default, EJB 3.0 has transactions enabled by default. All EJB's
> default to container managed transactions and transaction attribute
> REQUIRED.
> If you are using glassfiish v9.1, Project Tango[1] added support for
> enabling distributed transactions to flow to web services. This mapping
> must be manually enabled for a web service implemented as a servlet
> and it is automated for ejb web service with
> EJB 3.0 transaction annotations (REQUIRED, MANDATORY, SUPPORTED).
That makes sense. Enabling distributed transactions over JAX-WS by
default is very neat.
>> The service is querying an MS SQL Server 2005 database which doesn't
>> support two-phase commits unless you install MS Distributed
>> Transaction Coordinator (DTC) and basically fails immediately. The
>> only way I can get the XA driver to work is by enabling the "Non
>> Transactional Connections" setting on the connection pool.
>> Is there a way to disable distributed transactions with JAX-WS?
>
> You can disable WS-Atomic Transactions in the EJB Web Service with
> either of the following EJB 3.0 transaction annotations.
>
> Place either of the following annotations on the EJB web service class.
> @javax.transcation.TransactionManagement(value=TransactionManagementType.BEAN)
> // Container never creates a transaction or allows one to flow into a
> method.
>
> If you need to have a container managed transation but do not want
> Tango WS-Atomic Transaction support, the following transaction
> annotation will disable ws-atomic transaction flowing into ejb web
> service but the EJB method will execute in its own JTA transcation.
> @javax.transcation.TransactionAttribute(value=TransactionAttributeType.REQUIRES_NEW)
>
Yes, this is what I want. Thank you.
> Based on your feedback, I will file an enhancement request to add a
> mechanism to provide control over whether the
> automated mapping of an EJB web service to WS-Atomic Transactions
> should occur or not. This will provide users
> the ability to choose whether they want this automated enabling of
> WS-Atomic Transaction support for EJB web services
> or not.
Great. Will this be a setting in the web console?
Thanks,
Ryan