Ryan de Laplante wrote:
Ryan,
Thanks for your feedback. Questions and comments inline below.
> 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)
> 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?
Could you provide the Glassfish build that this is occuring on?
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).
[1]
http://wsit.dev.java.net
> 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)
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.
-Joe Fialli, Sun Microsystem
>
> Thanks,
> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>