1. MatchManagedConnection problem. You have to match your PoolingStrategy policy to the credentials available and your adapters matching strategy. If you are using application managed security (only) you should use ByApplication or ByContainerAndApplication. I think there are some concurrency problems if the ConnectionManager gives a large set of ManagedConnections to be matched, so I've made it so it only gives one connection selected so it should match. You have to set the criteria in the PoolingStrategy. I should probably change the examples to always use ByContainerAndApplication since the others are likely to give only slight speed advantages. This should work if your matching strategy is based on equality of subject and ConnectionRequestInfo. If it is based on something else, tell me how it works.
2. This is a bug I think. Can you supply a little more info on the error (does it result in ConnectionErrorOccurred being called on the ConnectionEventListener) and a log/stack trace with logging set to trace? Please file a bug report on sourceforge.
Changing to use ByApplication fixed my problem. I tried to use ByContainerAndApplication and this didn't work. JBoss complained about requiring a non-null subject then. I would have supplied some principal mapping properties but I didn't find any examples that showed how to do this similar to those in previous releases. It almost seems that the default should be ByContainerAndApplication and that this should not complain about null subjects or application specific connection info.
For the rollback w/out begin I submitted a bug on sourceforge. Yes my connector does call connectionErrorOccurred on the ConnectionEventListener (with ConnectionEvent.CONNECTION_ERROR_OCCURRED and the exception). For the bug report I tried to enable TRACE mode (in log4j.properties) but it didn't seem to give me any more output so I supplied what I could.
I recently ran into one other strange end case where a transaction begin happens successfully, all interactions within the transaction execute succefully but the commit causes an exception (an EIS specific bug). The app server prints the exception stack trace from the commit failure but never calls rollback...
Thanks for the help.
Yet another problem. While debugging some of the EIS side code this morning I ran into a situation where the being transaction failed. This failure was never reported to the client (EJB) and the interactions that were meant to be part of the enclosing transaction were still executed. When it was all over commit was called (which also failed)....
Seems to me that container managed transactions worked better in JBoss 2.4.4
I think the "commit failure does not result in rollback being called" is correct behavior for a local tx adapter and the app server. By the time commit is called, the tm has already called prepare, and everyone in the tx voted that commit was ok. The only exceptions that can occur at this point are on the level of "system errors", there is no way for a tx participant to affect the outcome of the tx.
If you have only one tx participant this is not a problem, your work presumably did not get committed. If you have more than one participant, jta does not supply any way to end up with a consistent result. You may be able to figure out something with compensating transactions. If you have more than one participant you should have seen a warning "you are not getting the semantics you expect"
If your app is not notified that commit failure occurred, that is a problem.
This doesn't seem correct to me. My EIS does not support two phase commit and as a result my adapter only declares Local Transactional support. So there is no concept of "prepare" and a failure to commit would seem to constitute a failure of the entire transaction. In this case a rollback seems appropriate to me.
Looking at the connector spec and related documentation I haven't found a discussion of this scenario.
I can concede that interactions like begin/commit/rollback should be concrete enough as not to fail outside of some catastrophe. Mine only failed due to a development version of our EIS have class inconsistencies. The EIS should automatically rollback an exception that doesn't get commited following some logical timeout. SO despite the fact that I'd like a rollback I can understand where you're coming from.
The failure to commit however was not reported to my client so I've submited sourceforge bug id 575966.
I think there are 2 issues here:
1. JBoss is not telling your application something went wrong. This is definitely a problem, I will look into it, thanks for the bug report.
2. How should local transactions relate to the tm? The spec indicates that the tm is not responsible for consistent results when trying to manage more than one transactional resource in one jta transaction if at least one of the transactional resources only supports local tx. In principle, you can't using only the xa protocols. So, I figured the best we can do is ignore the prepare step and try to commit on commit. If your EIS throws an exception during commit, I hope it is written well enough to effectively rollback the work it is declining to commit. However, by the time it is asked to commit, the tm has to assume that commit will succeed. It can't call rollback later: commit ends the tx, no matter what the outcome.
I'm fine with 2. Our EIS does in fact deal properly with the failure to commit not applying changes made during the transaction.
My adapter currently has this problem, too. My LocalTransaction implementation doesn't roll back the transaction if commit fails. Commit can easily fail due to write-write conflicts in a transaction that hasn't been prepared, and LT has no prepare. This is very similar to commitOnePhase in XA processing. My XA resource does roll back the transaction on commit failure in commitOnePhase, so I guess I should change my LT to do the same.