pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
8+ messages / 5 participants
[nested] [flat]

* [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2021-03-29 10:34 "stuartwdouglas (@stuartwdouglas)" <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: stuartwdouglas (@stuartwdouglas) @ 2021-03-29 10:34 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>


**Describe the issue**
Some code in the driver uses `Class.forName(String)` rather than `Class.forName(String, boolean, ClassLoader)` passing in the Thread context class loader as a parameter. This can cause issues for environments where the class being loaded is not in the same ClassLoader as the driver.

**Driver Version?** 

42.2.19

**To Reproduce**

We have an issue in Quarkus here: https://github.com/quarkusio/quarkus/issues/15782

Basically the SocketFactory is loaded from the same CL as the driver, while in our environment it is availilble in the Thread context ClassLoader.

**Expected behaviour**

The class to be loaded from the Thread context CL, possibly with a fallback to  the driver CL.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2023-02-24 12:12 ` "jhonnyman (@jhonnyman)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: jhonnyman (@jhonnyman) @ 2023-02-24 12:12 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Hello, I am recently developing applications on Quarkus framework and facing the exact same issue. Is there a possibility to unlock this fix? Thank you :pray: 

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2023-02-24 12:18 ` "davecramer (@davecramer)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: davecramer (@davecramer) @ 2023-02-24 12:18 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

@jhonnyman what version of the driver are you using ?


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2023-02-24 12:25 ` "jhonnyman (@jhonnyman)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: jhonnyman (@jhonnyman) @ 2023-02-24 12:25 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

I'm not sure which version it is.
I was following the guides on Quarkus [deploying-to-google-cloud](https://quarkus.io/guides/deploying-to-google-cloud#using-cloud-sql) and using the recommended configuration I got the error that brought me here [Unable to use Postgres Socket Factory on dev mode](https://github.com/quarkusio/quarkus/issues/15782).

Maybe  @stuartwdouglas can you help here? I'm on quarkus version 2.16.1.Final

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2023-07-13 20:16 ` "mikhail-chystsiakou (@mikhail-chystsiakou)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: mikhail-chystsiakou (@mikhail-chystsiakou) @ 2023-07-13 20:16 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Hi people, +1 unhappy developer here (also from quarkus project)

I created minimal project to reproduce the issue, hope it will help you
https://github.com/mikhail-chystsiakou/pgjdbc-15782

Driver version is `org.postgresql:postgresql:42.6.0`

@davecramer , can you please take a look?

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2023-07-24 15:27 ` "davecramer (@davecramer)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: davecramer (@davecramer) @ 2023-07-24 15:27 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

I think we have discussed this before. 
The challenge isn't in fixing it, the challenge here is understanding what it will break.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2024-05-05 23:42 ` "stuartwdouglas (@stuartwdouglas)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: stuartwdouglas (@stuartwdouglas) @ 2024-05-05 23:42 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

Re-visiting this would you be open to a fix that allows this behaviour to be controlled by a config property of some kind (e.g. a system property, or some other form of config)?

Personally I don't believe that my PR will break anything, as any environment that has set the TCCL would be expecting it to be used, and the fallback means it will continue to work in environments where it is not set, but if this is a concern then I think a config option is the only way to fix this.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths
@ 2025-06-23 10:58 ` "geoand (@geoand)" <[email protected]>
  6 siblings, 0 replies; 8+ messages in thread

From: geoand (@geoand) @ 2025-06-23 10:58 UTC (permalink / raw)
  To: pgjdbc/pgjdbc <[email protected]>

+1

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2025-06-23 10:58 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 10:34 [pgjdbc/pgjdbc] issue #2112: Single argument version of Class.forName is used to load classes, which can cause problems with non-flat class paths "stuartwdouglas (@stuartwdouglas)" <[email protected]>
2023-02-24 12:12 ` "jhonnyman (@jhonnyman)" <[email protected]>
2023-02-24 12:18 ` "davecramer (@davecramer)" <[email protected]>
2023-02-24 12:25 ` "jhonnyman (@jhonnyman)" <[email protected]>
2023-07-13 20:16 ` "mikhail-chystsiakou (@mikhail-chystsiakou)" <[email protected]>
2023-07-24 15:27 ` "davecramer (@davecramer)" <[email protected]>
2024-05-05 23:42 ` "stuartwdouglas (@stuartwdouglas)" <[email protected]>
2025-06-23 10:58 ` "geoand (@geoand)" <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox