Re: Updating Apache Commons DBCP 2.10.0
The build works on Java 8 because the moditect plug-in is only invoked on Java 11 and up. Gary On Tue, Sep 26, 2023, 4:00 PM Phil Steitz wrote: > On Tue, Sep 26, 2023 at 4:50 AM Gary Gregory > wrote: > > > (Let's stop high jacking the announcement thread.) > > > > Agreed. Sorry about that. > > > > > In the future, FYI, I plan on supporting both Java and Jakarta by > splitting > > DBCP into a multi-module Maven project. I'm not sure exactly when but > it's > > on my to do list. > > > > That sounds good. But we may need to do something before that to restore > backward compatibility (if there is in fact a problem). The build error > that Greg reports below is somehow related to the Commons Parent 62 > version. If I back rev Commons Parent to version 60 and revert the JTA > spec jar change (per below), the build works. (Greg - can you try that - > just change Commons Parent version to 60 along with the change below). > > Alternatively, maybe there is some other workaround to avoid the conflict > that Greg is reporting. I am not sure if there is in fact a backward > compat issue here. Any better ideas? > > One more thing is the EPL/GPL license on the Jakarta jars. Have these > been cleared for use (as dependencies) in ASF projects? Do we need some > kind of notice for this? > > Phil > > > > > Gary > > > > > > > > On Tue, Sep 26, 2023, 5:00 AM Greg Huber wrote: > > > > > If I am understanding this correctly, I replace > > > > > > > > > > > > jakarta.transaction > > > jakarta.transaction-api > > > 1.3.1 > > > > > > > > > with > > > > > > > > > org.apache.geronimo.specs > > > geronimo-jta_1.1_spec > > > 1.1.1 > > > true > > > > > > > > > in the source of 2.10.0 pom.xml and then mvn clean package. > > > > > > I get this error > > > > > > [ERROR] Failed to execute goal > > > org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info > > > (add-module-infos) on project commons-dbcp2: Execution add-module-infos > > > of goal org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info > > > failed: No assignedModuleName provided for jar with invalid module > name: > > > > > > ~/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar > > > > > > -> [Help 1] > > > > > > # > > > > > > > > > I did a diff of my apps /lib folder between the 2.10.0 and 2.9.0 > > > > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > > > commons-dbcp2-2.9.0.jar > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > > > commons-dbcp2-2.10.0.jar > > > > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > > > commons-pool2-2.10.0.jar > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > > > commons-pool2-2.11.1.jar > > > > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > > > jakarta.transaction-api-2.0.1.jar > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > > > jakarta.transaction-api-1.3.1.jar > > > > > > > > > If I copy lib.9: jakarta.transaction-api-2.0.1.jar to replace the > > > lib.10: jakarta.transaction-api-1.3.1.jar class > > > ThreadLocalSessionContextNoAutoClose compiles and works. > > > > > > Cheers Greg > > > > > > On 25/09/2023 18:49, Phil Steitz wrote: > > > > Thanks, Greg. I assume that dependency was there and working with > DBCP > > > > 2.9, correct? > > > > > > > > Can you try reverting the pom change above, replacing the > > > > Jakarta transactions reference with > > > > > > > > > > > >org.apache.geronimo.specs > > > >geronimo-jta_1.1_spec > > > >1.1.1 > > > >true > > > > > > > > > > > > Then recompile DBCP from 2.10 sources and test (just use mvn clean > > > package > > > > from the root of an extract of the source distribution). > > > > > > > > Phil > > > > > > > > On Mon, Sep 25, 2023 at 12:44 AM Greg Huber > > wrote: > > > > > > > >>>> does your code maybe bring in the 2.0 jakarta spec jar? > > > >> > > > >> I do have : > > > >> > > > >> jakarta.transaction-api-2.0.1.jar > > > >> > > > >> which comes from hibernate-core 6.3.1.Final. > > > >> > > > >> > > > >> > > > >> ### > > > >> > > > >> Using eclipse here are the errors > > > >> > > > >> The project was not built since its build path is incomplete. Cannot > > > >> find the class file for jakarta.transaction.Synchronization. Fix the > > > >> build path then try building this project > > > >> > > > >> The type jakarta.transaction.Synchronization cannot be resolved. It > is > > > >> indirectly referenced from required type > > > >> org.hibernate.context.internal.ThreadLocalSessionContext.CleanupSync > > > >> > > > >> > > > >> Here is the class that won't compile > > > >> > > > >> public class ThreadLocalSessionContextNoAutoClose > > > >> extends ThreadLocalSessionContext { > > > >> > > > >> private static final long serialVersionUID = > > > -9220338553393731611L; > > > >> > > > >> /** >
Re: Updating Apache Commons DBCP 2.10.0
On Tue, Sep 26, 2023 at 4:50 AM Gary Gregory wrote: > (Let's stop high jacking the announcement thread.) > Agreed. Sorry about that. > > In the future, FYI, I plan on supporting both Java and Jakarta by splitting > DBCP into a multi-module Maven project. I'm not sure exactly when but it's > on my to do list. > That sounds good. But we may need to do something before that to restore backward compatibility (if there is in fact a problem). The build error that Greg reports below is somehow related to the Commons Parent 62 version. If I back rev Commons Parent to version 60 and revert the JTA spec jar change (per below), the build works. (Greg - can you try that - just change Commons Parent version to 60 along with the change below). Alternatively, maybe there is some other workaround to avoid the conflict that Greg is reporting. I am not sure if there is in fact a backward compat issue here. Any better ideas? One more thing is the EPL/GPL license on the Jakarta jars. Have these been cleared for use (as dependencies) in ASF projects? Do we need some kind of notice for this? Phil > > Gary > > > > On Tue, Sep 26, 2023, 5:00 AM Greg Huber wrote: > > > If I am understanding this correctly, I replace > > > > > > > > jakarta.transaction > > jakarta.transaction-api > > 1.3.1 > > > > > > with > > > > > > org.apache.geronimo.specs > > geronimo-jta_1.1_spec > > 1.1.1 > > true > > > > > > in the source of 2.10.0 pom.xml and then mvn clean package. > > > > I get this error > > > > [ERROR] Failed to execute goal > > org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info > > (add-module-infos) on project commons-dbcp2: Execution add-module-infos > > of goal org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info > > failed: No assignedModuleName provided for jar with invalid module name: > > > ~/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar > > > > -> [Help 1] > > > > # > > > > > > I did a diff of my apps /lib folder between the 2.10.0 and 2.9.0 > > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > > commons-dbcp2-2.9.0.jar > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > > commons-dbcp2-2.10.0.jar > > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > > commons-pool2-2.10.0.jar > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > > commons-pool2-2.11.1.jar > > > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > > jakarta.transaction-api-2.0.1.jar > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > > jakarta.transaction-api-1.3.1.jar > > > > > > If I copy lib.9: jakarta.transaction-api-2.0.1.jar to replace the > > lib.10: jakarta.transaction-api-1.3.1.jar class > > ThreadLocalSessionContextNoAutoClose compiles and works. > > > > Cheers Greg > > > > On 25/09/2023 18:49, Phil Steitz wrote: > > > Thanks, Greg. I assume that dependency was there and working with DBCP > > > 2.9, correct? > > > > > > Can you try reverting the pom change above, replacing the > > > Jakarta transactions reference with > > > > > > > > >org.apache.geronimo.specs > > >geronimo-jta_1.1_spec > > >1.1.1 > > >true > > > > > > > > > Then recompile DBCP from 2.10 sources and test (just use mvn clean > > package > > > from the root of an extract of the source distribution). > > > > > > Phil > > > > > > On Mon, Sep 25, 2023 at 12:44 AM Greg Huber > wrote: > > > > > >>>> does your code maybe bring in the 2.0 jakarta spec jar? > > >> > > >> I do have : > > >> > > >> jakarta.transaction-api-2.0.1.jar > > >> > > >> which comes from hibernate-core 6.3.1.Final. > > >> > > >> > > >> > > >> ### > > >> > > >> Using eclipse here are the errors > > >> > > >> The project was not built since its build path is incomplete. Cannot > > >> find the class file for jakarta.transaction.Synchronization. Fix the > > >> build path then try building this project > > >> > > >> The type jakarta.transaction.Synchronization cannot be resolved. It is > > >> indirectly referenced from required type > > >> org.hibernate.context.internal.ThreadLocalSessionContext.CleanupSync > > >> > > >> > > >> Here is the class that won't compile > > >> > > >> public class ThreadLocalSessionContextNoAutoClose > > >> extends ThreadLocalSessionContext { > > >> > > >> private static final long serialVersionUID = > > -9220338553393731611L; > > >> > > >> /** > > >>* Create a new instance. > > >>* > > >>* @param factory The SessionFactoryImplementor > > >> required by the > > >>*super constructor. > > >>*/ > > >> public ThreadLocalSessionContextNoAutoClose( > > >> SessionFactoryImplementor factory) { > > >> super(factory); > > >> } > > >> > > >> /** > > >>* Returns false to prevent auto closing. > > >>
Updating Apache Commons DBCP 2.10.0
(Let's stop high jacking the announcement thread.) In the future, FYI, I plan on supporting both Java and Jakarta by splitting DBCP into a multi-module Maven project. I'm not sure exactly when but it's on my to do list. Gary On Tue, Sep 26, 2023, 5:00 AM Greg Huber wrote: > If I am understanding this correctly, I replace > > > > jakarta.transaction > jakarta.transaction-api > 1.3.1 > > > with > > > org.apache.geronimo.specs > geronimo-jta_1.1_spec > 1.1.1 > true > > > in the source of 2.10.0 pom.xml and then mvn clean package. > > I get this error > > [ERROR] Failed to execute goal > org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info > (add-module-infos) on project commons-dbcp2: Execution add-module-infos > of goal org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info > failed: No assignedModuleName provided for jar with invalid module name: > ~/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar > > -> [Help 1] > > # > > > I did a diff of my apps /lib folder between the 2.10.0 and 2.9.0 > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > commons-dbcp2-2.9.0.jar > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > commons-dbcp2-2.10.0.jar > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > commons-pool2-2.10.0.jar > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > commons-pool2-2.11.1.jar > > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: > jakarta.transaction-api-2.0.1.jar > Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: > jakarta.transaction-api-1.3.1.jar > > > If I copy lib.9: jakarta.transaction-api-2.0.1.jar to replace the > lib.10: jakarta.transaction-api-1.3.1.jar class > ThreadLocalSessionContextNoAutoClose compiles and works. > > Cheers Greg > > On 25/09/2023 18:49, Phil Steitz wrote: > > Thanks, Greg. I assume that dependency was there and working with DBCP > > 2.9, correct? > > > > Can you try reverting the pom change above, replacing the > > Jakarta transactions reference with > > > > > >org.apache.geronimo.specs > >geronimo-jta_1.1_spec > >1.1.1 > >true > > > > > > Then recompile DBCP from 2.10 sources and test (just use mvn clean > package > > from the root of an extract of the source distribution). > > > > Phil > > > > On Mon, Sep 25, 2023 at 12:44 AM Greg Huber wrote: > > > >>>> does your code maybe bring in the 2.0 jakarta spec jar? > >> > >> I do have : > >> > >> jakarta.transaction-api-2.0.1.jar > >> > >> which comes from hibernate-core 6.3.1.Final. > >> > >> > >> > >> ### > >> > >> Using eclipse here are the errors > >> > >> The project was not built since its build path is incomplete. Cannot > >> find the class file for jakarta.transaction.Synchronization. Fix the > >> build path then try building this project > >> > >> The type jakarta.transaction.Synchronization cannot be resolved. It is > >> indirectly referenced from required type > >> org.hibernate.context.internal.ThreadLocalSessionContext.CleanupSync > >> > >> > >> Here is the class that won't compile > >> > >> public class ThreadLocalSessionContextNoAutoClose > >> extends ThreadLocalSessionContext { > >> > >> private static final long serialVersionUID = > -9220338553393731611L; > >> > >> /** > >>* Create a new instance. > >>* > >>* @param factory The SessionFactoryImplementor > >> required by the > >>*super constructor. > >>*/ > >> public ThreadLocalSessionContextNoAutoClose( > >> SessionFactoryImplementor factory) { > >> super(factory); > >> } > >> > >> /** > >>* Returns false to prevent auto closing. > >>* > >>* @return false to prevent auto closing. > >>*/ > >> protected boolean isAutoCloseEnabled() { > >> return false; > >> } > >> > >> /** > >>* Returns false to prevent auto flushing. > >>* > >>* @return false to prevent auto flushing. > >>*/ > >> protected boolean isAutoFlushEnabled() { > >> return false; > >> } > >> > >> /** > >>* Uses super.buildOrObtainSession(), then sets the > >> resulting > >>* Session's flush mode to > FlushMode.NEVER > >> to > >>* prevent auto-flushing. > >>* > >>* @return A session configured with FlushMode.NEVER. > >>*/ > >> protected Session buildOrObtainSession() { > >> Session s = super.buildOrObtainSession(); > >> s.setHibernateFlushMode(FlushMode.MANUAL); > >> return s; > >> } > >> > >> /** > >>* Returns an instance of CleanupSynch which prevents > >> auto > >>* closing and unbinding. > >>* > >>* @return A CleanupSynch which prevents auto > closing and > >>*
Re: [ANNOUNCEMENT] Apache Commons DBCP 2.10.0
If I am understanding this correctly, I replace jakarta.transaction jakarta.transaction-api 1.3.1 with org.apache.geronimo.specs geronimo-jta_1.1_spec 1.1.1 true in the source of 2.10.0 pom.xml and then mvn clean package. I get this error [ERROR] Failed to execute goal org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info (add-module-infos) on project commons-dbcp2: Execution add-module-infos of goal org.moditect:moditect-maven-plugin:1.0.0.Final:add-module-info failed: No assignedModuleName provided for jar with invalid module name: ~/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar -> [Help 1] # I did a diff of my apps /lib folder between the 2.10.0 and 2.9.0 Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: commons-dbcp2-2.9.0.jar Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: commons-dbcp2-2.10.0.jar Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: commons-pool2-2.10.0.jar Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: commons-pool2-2.11.1.jar Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.9: jakarta.transaction-api-2.0.1.jar Only in ~/downloads/commons-dbcp2-2.10.0-src/target/lib.10: jakarta.transaction-api-1.3.1.jar If I copy lib.9: jakarta.transaction-api-2.0.1.jar to replace the lib.10: jakarta.transaction-api-1.3.1.jar class ThreadLocalSessionContextNoAutoClose compiles and works. Cheers Greg On 25/09/2023 18:49, Phil Steitz wrote: Thanks, Greg. I assume that dependency was there and working with DBCP 2.9, correct? Can you try reverting the pom change above, replacing the Jakarta transactions reference with org.apache.geronimo.specs geronimo-jta_1.1_spec 1.1.1 true Then recompile DBCP from 2.10 sources and test (just use mvn clean package from the root of an extract of the source distribution). Phil On Mon, Sep 25, 2023 at 12:44 AM Greg Huber wrote: >> does your code maybe bring in the 2.0 jakarta spec jar? I do have : jakarta.transaction-api-2.0.1.jar which comes from hibernate-core 6.3.1.Final. ### Using eclipse here are the errors The project was not built since its build path is incomplete. Cannot find the class file for jakarta.transaction.Synchronization. Fix the build path then try building this project The type jakarta.transaction.Synchronization cannot be resolved. It is indirectly referenced from required type org.hibernate.context.internal.ThreadLocalSessionContext.CleanupSync Here is the class that won't compile public class ThreadLocalSessionContextNoAutoClose extends ThreadLocalSessionContext { private static final long serialVersionUID = -9220338553393731611L; /** * Create a new instance. * * @param factory The SessionFactoryImplementor required by the *super constructor. */ public ThreadLocalSessionContextNoAutoClose( SessionFactoryImplementor factory) { super(factory); } /** * Returns false to prevent auto closing. * * @return false to prevent auto closing. */ protected boolean isAutoCloseEnabled() { return false; } /** * Returns false to prevent auto flushing. * * @return false to prevent auto flushing. */ protected boolean isAutoFlushEnabled() { return false; } /** * Uses super.buildOrObtainSession(), then sets the resulting * Session's flush mode to FlushMode.NEVER to * prevent auto-flushing. * * @return A session configured with FlushMode.NEVER. */ protected Session buildOrObtainSession() { Session s = super.buildOrObtainSession(); s.setHibernateFlushMode(FlushMode.MANUAL); return s; } /** * Returns an instance of CleanupSynch which prevents auto * closing and unbinding. * * @return A CleanupSynch which prevents auto closing and * unbinding. */ protected CleanupSync buildCleanupSynch() { return new NoCleanupSynch(factory()); } /** * A simple extension of CleanupSynch that prevents any cleanup * from happening. No session closing or unbinding. */ private static class NoCleanupSynch extends ThreadLocalSessionContext.CleanupSync { private static final long serialVersionUID = -6191453375299821467L; /** * Creates a new instance based on the given factory. * * @param factory The required SessionFactory that is *passed to the super constructor. */ public NoCleanupSynch(SessionFactory factory) { super(factory); } /** * Does nothing, thus