[jbossts-issues] [JBoss JIRA] (JBTM-3005) Add a quickstart showing the Tomcat and DBCP2

Michal Karm Babacek (JIRA) issues at jboss.org
Thu Apr 12 11:53:00 EDT 2018


    [ https://issues.jboss.org/browse/JBTM-3005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13560355#comment-13560355 ] 

Michal Karm Babacek commented on JBTM-3005:
-------------------------------------------

[~tomjenkinson], [~zhfeng], hi guys, I did try yesterday and then again today. Some observations:

 * My [comment|https://issues.jboss.org/browse/JBTM-3005?focusedCommentId=13558264&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13558264] is still valid. It does not work as expected. I appreciate Amos' [quickstart|https://github.com/jbosstm/quickstart/pull/221/files], but I utterly fail to understand why don't you fix/rewrite/modify [the original rudimentary recovery test|https://github.com/Karm/narayana/tree/narayana-tomcat-ts/tomcat/tomcat-jta/src/test/java/org/jboss/narayana/tomcat/jta/integration]. 
I did my best to port the quickstart to the aforementioned test suite, basically dropping the former code altogether.  See: [This web app|https://github.com/Karm/narayana/blob/narayana-tomcat-ts-WIP/tomcat/tomcat-jta/src/test/java/org/jboss/narayana/tomcat/jta/integration/app/]. (And its byteman rule in resources).

 * It does not work still, with commit causing the phase2commit flat out kill the app; I know it is not being caught in the quickstart app, but it should - [log|https://paste.fedoraproject.org/paste/q~FMpWhTbIgmqswlz1GOaw], [dbtrace|https://paste.fedoraproject.org/paste/ylEYS-SiFVxltjVALuF2KQ].

 * Connections to the DB are being exhausted: Each recovery call takes a connection and keeps it: [see log|https://paste.fedoraproject.org/paste/HLD7PIAvkG7Fjvbcx-De8Q], which leads to DB trace: [see trace|https://paste.fedoraproject.org/paste/sjhrHoMVYXQxhYlsSnum7A]

 * You can find the whole tomcat (17MB) with the web app war file (context.xml, Tomcat DBCP2 with managed package, all in it) on this [gdrive link|https://drive.google.com/file/d/1YU_wPyw7U3PofCQeZdWxZTvUajijgCoP/view?usp=sharing].  The source of the web app is [here|https://github.com/Karm/narayana/blob/narayana-tomcat-ts-WIP/tomcat/tomcat-jta/src/test/java/org/jboss/narayana/tomcat/jta/integration/app/]. Note the [TransactionalDataSourceFactory.java|https://github.com/Karm/narayana/blob/narayana-tomcat-ts-WIP/tomcat/tomcat-jta/src/main/java/org/jboss/narayana/tomcat/jta/TransactionalDataSourceFactory.java]. Also note that the Tomcat DBCP jar and Tomcat Juli jar are present in the war file and not in /lib to avoid classloader issues.

* This is how I start it: {{java -javaagent:$BYTEMAN_HOME/lib/byteman.jar=script:$BTM_SCRIPT      -Djava.security.egd=file:/dev/./urandom      -Djava.util.logging.config.file=$CATALINA_HOME/conf/logging.properties      -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager      -Djdk.tls.ephemeralDHKeySize=2048      -Djava.protocol.handler.pkgs=org.apache.catalina.webresources      -Dignore.endorsed.dirs=      -classpath $CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar      -Dcatalina.base=$CATALINA_HOME      -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$CATALINA_HOME/temp org.apache.catalina.startup.Bootstrap start}}

* The how-to on starting PostgreSQL container and its parameters (e.g. max_connections=20) is here JBTM-3004.

h3.  Call to action
I would like to kindly ask you to either clearly explain in a doc why a particular approach with Helper and enlisting is taken in the [quickstart|https://github.com/jbosstm/quickstart/pull/221/files] and not in [the original rudimentary recovery test|https://github.com/Karm/narayana/tree/narayana-tomcat-ts/tomcat/tomcat-jta/src/test/java/org/jboss/narayana/tomcat/jta/integration], or to open [the original rudimentary recovery test|https://github.com/Karm/narayana/tree/narayana-tomcat-ts/tomcat/tomcat-jta/src/test/java/org/jboss/narayana/tomcat/jta/integration] and refactor it. I naturally prefer the latter.

I would like to also ask you to at least once try with PostgreSQL and not with H2. We need at least 1 semi-real-world use case example with a real driver to a real database with a real connection pool issues. The whole thing with Docker and PostgreSQL outlined on JBTM-3004 is meant to help you to give it a spin in ~2 minutes without any DBAllocator / remote DB hassle.

The final goal is to have [the original rudimentary recovery test|https://github.com/Karm/narayana/tree/narayana-tomcat-ts/tomcat/tomcat-jta/src/test/java/org/jboss/narayana/tomcat/jta/integration] ported to the usage of the recovery helper and the new factory so as it works with Tomcat DBCP2, Byteman rules (and not things like [this|https://github.com/jbosstm/quickstart/pull/221/files#diff-c05f008e018e21d37356e3f1eceddde3R77]). I am willing to do the leg work, to move stuff around, to modify the listener on the Tomcat side, to polish the TS, but I need your help with the Narayana specifics and the current quickstart just doesn't cut it.


> Add a quickstart showing the Tomcat and DBCP2
> ---------------------------------------------
>
>                 Key: JBTM-3005
>                 URL: https://issues.jboss.org/browse/JBTM-3005
>             Project: JBoss Transaction Manager
>          Issue Type: Task
>          Components: Demonstrator
>            Reporter: Amos Feng
>            Assignee: Amos Feng
>             Fix For: 5.8.1.Final
>
>
> This quickstart needs to show how to use the DBCP2 in Tomcat to support the XA transaction.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jbossts-issues mailing list