[jboss-user] [JBossWS] - JbossWS 1.2.0
matienzar
do-not-reply at jboss.com
Fri Mar 2 03:13:46 EST 2007
Hello,
With 1.0.4 release, i've a hibernate handler to begiun a transaction and to commit it. With this new realese, the handler is not threadsafe, and when I need to commit the transaction, it's null. I'd defined the handler (with 1.0.4) in standard-jaxrpc-endpoint-config.xml, but with this new realse i've to define it in standard-jaxws-endpoint-config.xml.
The code of the handler is:
public class HibernateWS extends GenericSOAPHandler {
UserTransaction _tx = null;
@Override
public boolean handleFault(MessageContext arg0) {
try {
_tx.rollback();
} catch (Exception e) {
Log.error("No se ha podido hacer el rollback", e);
throw new RuntimeException(e);
}
return super.handleFault(arg0);
}
protected boolean handleInbound(MessageContext msgContext) {
try {
HibernateUtil.openSession();
_tx = (UserTransaction) new InitialContext()
.lookup("java:comp/UserTransaction");
_tx.begin();
} catch (Exception e) {
Log.error("Cogiendo la transacción.", e);
}
return true;
}
protected boolean handleOutbound(MessageContext msgContext) {
try {
_tx.commit();
} catch (Exception e) {
Log.error("Haciendo el commit", e);
try {
_tx.rollback();
} catch (Exception e2) {
Log.error("Haciendo el rollback", e2);
}
throw new RuntimeException(e);
}
return true;
}
}
And the config-handler:
<endpoint-config>
<config-name>Handler hibernate gnomo</config-name>
<pre-handler-chains>
<javaee:handler-chain>
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
<javaee:handler>
<javaee:handler-name>WSHibernateHandlerInbound</javaee:handler-name>
<javaee:handler-class>org.muvale.utilidades.handlers.HibernateWS</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
</pre-handler-chains>
</endpoint-config>
A lot of thanks,
Marcial
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024562#4024562
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024562
More information about the jboss-user
mailing list