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 <phil.ste...@gmail.com> wrote: > On Tue, Sep 26, 2023 at 4:50 AM Gary Gregory <garydgreg...@gmail.com> > 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 <gregh3...@gmail.com> wrote: > > > > > If I am understanding this correctly, I replace > > > > > > <!-- For managed connections --> > > > <dependency> > > > <groupId>jakarta.transaction</groupId> > > > <artifactId>jakarta.transaction-api</artifactId> > > > <version>1.3.1</version> > > > </dependency> > > > > > > with > > > > > > <dependency> > > > <groupId>org.apache.geronimo.specs</groupId> > > > <artifactId>geronimo-jta_1.1_spec</artifactId> > > > <version>1.1.1</version> > > > <optional>true</optional> > > > </dependency> > > > > > > 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 > > > > > > > > <dependency> > > > > <groupId>org.apache.geronimo.specs</groupId> > > > > <artifactId>geronimo-jta_1.1_spec</artifactId> > > > > <version>1.1.1</version> > > > > <optional>true</optional> > > > > </dependency> > > > > > > > > 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 <gregh3...@gmail.com> > > 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 <code>SessionFactoryImplementor</code> > > > >> required by the > > > >> * super constructor. > > > >> */ > > > >> public ThreadLocalSessionContextNoAutoClose( > > > >> SessionFactoryImplementor factory) { > > > >> super(factory); > > > >> } > > > >> > > > >> /** > > > >> * Returns <code>false</code> to prevent auto closing. > > > >> * > > > >> * @return <code>false</code> to prevent auto closing. > > > >> */ > > > >> protected boolean isAutoCloseEnabled() { > > > >> return false; > > > >> } > > > >> > > > >> /** > > > >> * Returns <code>false</code> to prevent auto flushing. > > > >> * > > > >> * @return <code>false</code> to prevent auto flushing. > > > >> */ > > > >> protected boolean isAutoFlushEnabled() { > > > >> return false; > > > >> } > > > >> > > > >> /** > > > >> * Uses <code>super.buildOrObtainSession()</code>, then sets > the > > > >> resulting > > > >> * <code>Session</code>'s flush mode to > > > <code>FlushMode.NEVER</code> > > > >> to > > > >> * prevent auto-flushing. > > > >> * > > > >> * @return A session configured with > > <code>FlushMode.NEVER</code>. > > > >> */ > > > >> protected Session buildOrObtainSession() { > > > >> Session s = super.buildOrObtainSession(); > > > >> s.setHibernateFlushMode(FlushMode.MANUAL); > > > >> return s; > > > >> } > > > >> > > > >> /** > > > >> * Returns an instance of <code>CleanupSynch</code> which > > prevents > > > >> auto > > > >> * closing and unbinding. > > > >> * > > > >> * @return A <code>CleanupSynch</code> which prevents auto > > > closing and > > > >> * unbinding. > > > >> */ > > > >> protected CleanupSync buildCleanupSynch() { > > > >> return new NoCleanupSynch(factory()); > > > >> } > > > >> > > > >> /** > > > >> * A simple extension of <code>CleanupSynch</code> 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 <code>SessionFactory</code> > > > that is > > > >> * passed to the super constructor. > > > >> */ > > > >> public NoCleanupSynch(SessionFactory factory) { > > > >> super(factory); > > > >> } > > > >> > > > >> /** > > > >> * Does nothing, thus helping to prevent session closing > > > and/or > > > >> * unbinding. > > > >> */ > > > >> public void beforeCompletion() { > > > >> // do nothing > > > >> } > > > >> > > > >> /** > > > >> * Does nothing, thus helping to prevent session closing > > > and/or > > > >> * unbinding. > > > >> * > > > >> * @param i > > > >> */ > > > >> public void afterCompletion(int i) { > > > >> // do nothing > > > >> } > > > >> } > > > >> > > > >> } > > > >> > > > >> Thanks. > > > >> > > > >> On 24/09/2023 20:34, Phil Steitz wrote: > > > >>> On Sun, Sep 24, 2023 at 10:28 AM Greg Huber<gregh3...@gmail.com> > > > wrote: > > > >>> > > > >>>> Forgot to add, I use hibernate 6. > > > >>>> > > > >>> I suspect this is a side effect of the change to use the jakarta > spec > > > jar > > > >>> > > > >>> In 2.10, we have > > > >>> > > > >>> <dependency> > > > >>> <groupId>jakarta.transaction</groupId> > > > >>> <artifactId>jakarta.transaction-api</artifactId> > > > >>> <version>1.3.1</version> > > > >>> </dependency> > > > >>> > > > >>> vs > > > >>> > > > >>> <dependency> > > > >>> <groupId>org.apache.geronimo.specs</groupId> > > > >>> <artifactId>geronimo-jta_1.1_spec</artifactId> > > > >>> <version>1.1.1</version> > > > >>> <optional>true</optional> > > > >>> </dependency> > > > >>> > > > >>> in 2.9. What I don't get is where Greg's code is picking > > > >>> up jakarta.transaction.Synchronization because the jakarta version > we > > > >>> "upgraded" to still exports the javax classes and these are what > dbcp > > > >>> uses. Greg - does your code maybe bring in the 2.0 jakarta spec > jar? > > > >>> > > > >>> Phil > > > >>> > > > >>> > > > >>>> Cheers. > > > >>>> > > > >>>> On Sun, 24 Sept 2023 at 12:49, Gary Gregory< > garydgreg...@gmail.com> > > > >>>> wrote: > > > >>>> > > > >>>>> What else has changed in your app? > > > >>>>> > > > >>>>> Gary > > > >>>>> > > > >>>>> On Sun, Sep 24, 2023 at 5:13 AM Greg Huber<gregh3...@gmail.com> > > > >> wrote: > > > >>>>>> Hello, > > > >>>>>> > > > >>>>>> On upgrading from 2.9.0 I get this message and my class won't > > > compile. > > > >>>>>> > > > >>>>>> I get this error > > > >>>>>> > > > >>>>>> The type jakarta.transaction.Synchronization cannot be resolved. > > It > > > is > > > >>>>>> indirectly referenced from required type > > > >>>>>> > > org.hibernate.context.internal.ThreadLocalSessionContext.CleanupSync > > > >>>>>> > > > >>>>>> I am on : > > > >>>>>> > > > >>>>>> openjdk version "11.0.19" 2023-04-18 LTS > > > >>>>>> OpenJDK Runtime Environment Zulu11.64+19-CA (build > 11.0.19+7-LTS) > > > >>>>>> OpenJDK 64-Bit Server VM Zulu11.64+19-CA (build 11.0.19+7-LTS, > > mixed > > > >>>>> mode) > > > >>>>>> Not too sure what I need to do to fix this. > > > >>>>>> > > > >>>>>> Cheers > > > >>>>>> > > > >>>>>> On 03/09/2023 22:51, Gary Gregory wrote: > > > >>>>>>> The Apache Commons DBCP team is pleased to announce the release > > of > > > >>>>>>> Apache Commons DBCP 2.10.0. > > > >>>>>>> > > > >>>>>>> Apache Commons DBCP software implements Database Connection > > > Pooling. > > > >>>>>>> > > > >>>>>>> This is a minor release, including bug fixes and enhancements: > > > >>>>>>> > > > >> > > > > > > https://commons.apache.org/proper/commons-dbcp/changes-report.html#a2.10.0 > > > >>>>>>> For complete information on Apache Commons DBCP, including > > > >>>>>>> instructions on how to submit bug reports, patches, or > > suggestions > > > >>>> for > > > >>>>>>> improvement, see the Apache Commons DBCP website: > > > >>>>>>> > > > >>>>>>> https://commons.apache.org/dbcp/ > > > >>>>>>> > > > >>>>>>> Download page: > https://commons.apache.org/dbcp/download_dbcp.cgi > > > >>>>>>> > > > >>>>>>> Gary Gregory > > > >>>>>>> Apache Commons > > > >>>>>>> > > > >>>>>>> > > > --------------------------------------------------------------------- > > > >>>>>>> To unsubscribe, e-mail:user-unsubscr...@commons.apache.org > > > >>>>>>> For additional commands, e-mail:user-h...@commons.apache.org > > > >>>>>>> > > > >>>>>> > > > --------------------------------------------------------------------- > > > >>>>>> To unsubscribe, e-mail:user-unsubscr...@commons.apache.org > > > >>>>>> For additional commands, e-mail:user-h...@commons.apache.org > > > >>>>>> > > > >>>>> > > --------------------------------------------------------------------- > > > >>>>> To unsubscribe, e-mail:user-unsubscr...@commons.apache.org > > > >>>>> For additional commands, e-mail:user-h...@commons.apache.org > > > >>>>> > > > >>>>> > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > > > For additional commands, e-mail: user-h...@commons.apache.org > > > > > > > > >