Re: Jdbc drivers not found on Tomcat 10

2022-01-06 Thread hantsy bai
HI Christopher, not sure we are on the same page. The problem I encountered
was that a Spring 6 war app with pg driver(42.3.1) could not deploy on
Tomcat 10, but worked well when downupgraded to Spring 5/Tomcat 9.  But on
the jetty 11 and WildFly preview 26, Spring 6/pg war package are also
working.
I checked the source code of Spring DriverMangerDataSource, it will search
the drivers when calling getConnection at the first time, the work is
delegated to the underlay DriverManager class. There is a security check
wrapping the operations, not sure this affects the actions on Tomcat 10.

Regards,

*Hantsy Bai*

Self-employed consultant, fullstack developer, agile coach

GitHub: https://github.com/hantsy

Twitter: https://twitter.com/@hantsy
Medium: https://medium.com/@hantsy


On Fri, Jan 7, 2022 at 12:42 AM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Hantsy,
>
> On 1/5/22 23:31, hantsy bai wrote:
> > I finally resolved this issue. Exclude the pg driver from war, and copy
> it
> > to tomcat/lib, it works.
> >
> > I remember in the past years,  I preferred tomcat for Java Web
> applications
> > because I did not need to register a Jdbc driver but  it is tedious work
> in
> > Java EE application servers, such as Glassfish, etc. But since Java EE 7,
> > it supports packaging Jdbc drivers into war and register it automatically
> > when deploying the application to the application servers.
> >
> > What happened in the tomcat classloader and war application classloader
> of
> > Tomcat 10?
>
> They still exist. The detailed answer to your question is on Stack
> Overflow. What about that answer do you not understand? It explains what
> you would need to do in order to get the driver to work when placed in
> your WAR bundle.
>
> The problem is not Tomcat; the problem is the way that DriverManager
> works, and Tomcat has no control over that.
>
> -chris
>
> > On Mon, Jan 3, 2022 at 12:02 PM hantsy bai  wrote:
> >
> >> I have tried to update myself  Spring 6/Jakarta EE9/Java 17, etc, and
> >> created a simple war application, when deployed to Tomcat 10, failed,
> due
> >> to the famous *no suitable drivers*.
> >>
> >> I have created a detailed post on stackoverflow:
> >>
> >>
> >>
> https://stackoverflow.com/questions/70554119/no-suitable-drivers-available-when-deploying-a-spring-6-war-to-tomcat-10
> >>
> >> Any suggestion is welcome.
> >> Thanks.
> >>
> >> *Hantsy Bai*
> >>
> >> Self-employed consultant, fullstack developer, agile coach
> >>
> >> GitHub: https://github.com/hantsy
> >>
> >> Twitter: https://twitter.com/@hantsy
> >> Medium: https://medium.com/@hantsy
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Jdbc drivers not found on Tomcat 10

2022-01-06 Thread Christopher Schultz

Hantsy,

On 1/5/22 23:31, hantsy bai wrote:

I finally resolved this issue. Exclude the pg driver from war, and copy it
to tomcat/lib, it works.

I remember in the past years,  I preferred tomcat for Java Web applications
because I did not need to register a Jdbc driver but  it is tedious work in
Java EE application servers, such as Glassfish, etc. But since Java EE 7,
it supports packaging Jdbc drivers into war and register it automatically
when deploying the application to the application servers.

What happened in the tomcat classloader and war application classloader of
Tomcat 10?


They still exist. The detailed answer to your question is on Stack 
Overflow. What about that answer do you not understand? It explains what 
you would need to do in order to get the driver to work when placed in 
your WAR bundle.


The problem is not Tomcat; the problem is the way that DriverManager 
works, and Tomcat has no control over that.


-chris


On Mon, Jan 3, 2022 at 12:02 PM hantsy bai  wrote:


I have tried to update myself  Spring 6/Jakarta EE9/Java 17, etc, and
created a simple war application, when deployed to Tomcat 10, failed, due
to the famous *no suitable drivers*.

I have created a detailed post on stackoverflow:


https://stackoverflow.com/questions/70554119/no-suitable-drivers-available-when-deploying-a-spring-6-war-to-tomcat-10

Any suggestion is welcome.
Thanks.

*Hantsy Bai*

Self-employed consultant, fullstack developer, agile coach

GitHub: https://github.com/hantsy

Twitter: https://twitter.com/@hantsy
Medium: https://medium.com/@hantsy





-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Jdbc drivers not found on Tomcat 10

2022-01-05 Thread hantsy bai
I finally resolved this issue. Exclude the pg driver from war, and copy it
to tomcat/lib, it works.

I remember in the past years,  I preferred tomcat for Java Web applications
because I did not need to register a Jdbc driver but  it is tedious work in
Java EE application servers, such as Glassfish, etc. But since Java EE 7,
it supports packaging Jdbc drivers into war and register it automatically
when deploying the application to the application servers.

What happened in the tomcat classloader and war application classloader of
Tomcat 10?

*Hantsy Bai*

Self-employed consultant, fullstack developer, agile coach

GitHub: https://github.com/hantsy

Twitter: https://twitter.com/@hantsy
Medium: https://medium.com/@hantsy


On Mon, Jan 3, 2022 at 12:02 PM hantsy bai  wrote:

> I have tried to update myself  Spring 6/Jakarta EE9/Java 17, etc, and
> created a simple war application, when deployed to Tomcat 10, failed, due
> to the famous *no suitable drivers*.
>
> I have created a detailed post on stackoverflow:
>
>
> https://stackoverflow.com/questions/70554119/no-suitable-drivers-available-when-deploying-a-spring-6-war-to-tomcat-10
>
> Any suggestion is welcome.
> Thanks.
>
> *Hantsy Bai*
>
> Self-employed consultant, fullstack developer, agile coach
>
> GitHub: https://github.com/hantsy
>
> Twitter: https://twitter.com/@hantsy
> Medium: https://medium.com/@hantsy
>