Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WildFly server won't start using code after the 12.9.0 preview due to error with ConfigurableRetryLogic #2621

Closed
jocstar opened this issue Feb 28, 2025 · 6 comments · Fixed by #2622
Assignees

Comments

@jocstar
Copy link

jocstar commented Feb 28, 2025

Driver version

This is actually a personal build using the code from the date of this post - the released 12.9.0 preview actually works, but the latest code as of 28/Feb/2025 does not.

SQL Server version

Microsoft SQL Server 2022 (RTM-CU15-GDR) (KB5046862) - 16.0.4155.4 (X64) Oct 18 2024 16:16:11 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Enterprise 10.0 (Build 19045: ) (Hypervisor)

Client Operating System

Windows10

JAVA/JVM version

Adoptium-jdk-21.0.5+11

Table schema

N/A

Problem description

I deployed my own build of the driver based on the latest 12.9.0 preview version to a WildFly server to test out a patch I was working on but the server fails to start up because of an error thrown from the JDBC driver which means it cannot create db connections.

Expected behavior

I don't expect an error looking for a configuration file(?) to prevent the driver from being used

Actual behavior

The WildFly server throws an error and cannot create a database connection at startup.

Error message/stack trace

10:16:39,326 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ServerService Thread Pool -- 103) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection
at org.jboss.ironjacamar.jdbcadapters@1.4.35.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:364)
at org.jboss.ironjacamar.jdbcadapters@1.4.35.Final//
<< .. snip - truncated for brevity >>
Caused by: java.nio.file.FileSystemNotFoundException
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:156)
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:142)
at java.base/java.nio.file.Path.of(Path.java:209)
at java.base/java.nio.file.Paths.get(Paths.java:98)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic.getCurrentClassPath(ConfigurableRetryLogic.java:293)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic.readFromFile(ConfigurableRetryLogic.java:320)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic.setUpStatementRules(ConfigurableRetryLogic.java:204)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic.(ConfigurableRetryLogic.java:86)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic.getInstance(ConfigurableRetryLogic.java:103)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2592)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:2199)
at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1320)
at org.jboss.ironjacamar.jdbcadapters@1.4.35.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:335)

Any other details that can be helpful

The key part here is the FileSystemNotFoundException coming from ConfigurableRetryLogic.getCurrentClassPath.
It is failing on the line :
if (Files.isDirectory(Paths
.get(ConfigurableRetryLogic.class.getProtectionDomain().getCodeSource().getLocation().toURI()))) {

The URL has the form jar:file:c:...\mssql-jdbc-12.9.0.jre21-preview.jar and seems to be failing because toURL() is trying to use a ZipFileSystem but doesn't find one registered for the jar file.
When I run the JUnit tests in a dev environment, the URL has the form file:c:...\mssql-jdbc-12.9.0.jre21-preview.jar so is only looking at the file system, not within a jar and so there I don't see the problem.

JDBC trace logs

N/A as its getting a connection that is failing

@github-project-automation github-project-automation bot moved this to To be triaged in MSSQL JDBC Feb 28, 2025
@jocstar jocstar changed the title WildFly server won't start using driver 12.9.0 due to error with ConfigurableRetryLogic WildFly server won't start using code post the 12.9.0 preview due to error with ConfigurableRetryLogic Feb 28, 2025
@jocstar jocstar changed the title WildFly server won't start using code post the 12.9.0 preview due to error with ConfigurableRetryLogic WildFly server won't start using code after the 12.9.0 preview due to error with ConfigurableRetryLogic Feb 28, 2025
@jocstar
Copy link
Author

jocstar commented Feb 28, 2025

I rolled back Commit 83072af in my development version of the driver and Wildfly started without error.

@machavan machavan self-assigned this Feb 28, 2025
@machavan
Copy link
Contributor

Hi @jocstar

This issue has been likely addressed as part of PR # #2579

Can you please confirm and let us know?

@machavan machavan added the Waiting for Response Waiting for a reply from the original poster, or affiliated party label Feb 28, 2025
@jocstar
Copy link
Author

jocstar commented Feb 28, 2025

Hi @machavan
That actually seems to be the commit that introduced it. The error is coming from the newly added line

            if (Files.isDirectory(Paths
                    .get(ConfigurableRetryLogic.class.getProtectionDomain().getCodeSource().getLocation().toURI()))) {

and occurs at the toURI() part of that when the URI has a "jar:file:....." prefix. I'm not sure how or why the jar part is at the front of that URI, presumably something to do with the JBoss classloader, its a bit beyond my knowhow at that point.

@Jeffery-Wasty Jeffery-Wasty moved this from To be triaged to In progress in MSSQL JDBC Feb 28, 2025
@Jeffery-Wasty Jeffery-Wasty added Under Investigation Used for issues under investigation and removed Waiting for Response Waiting for a reply from the original poster, or affiliated party labels Feb 28, 2025
@Jeffery-Wasty
Copy link
Contributor

Jeffery-Wasty commented Feb 28, 2025

Hi @jocstar,

You're correct in that the issue appears to be the scheme prefix. I've made changes to the ConfigurableRetryLogic.getCurrentClassPath() code that I believe resolves the issue. If you have the opportunity, can you test the below custom driver?

mssql-jdbc-12.9.0.jre21-preview.zip

@jocstar
Copy link
Author

jocstar commented Mar 1, 2025

@Jeffery-Wasty
I tried the updated file you provided, but sadly no. The error has changed, stack trace attached below :

00:01:16,495 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ServerService Thread Pool -- 102) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection
	at org.jboss.ironjacamar.jdbcadapters@1.4.35.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:364)

<< snip >>

	... 39 more
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 3: ile:/C:/jboss/wildfly-24.0.0.Final-JAVA21/modules/system/layers/base/com/microsoft/sqlserver/jdbc/main/mssql-jdbc-12.9.0.jre21-preview.jar!
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231)
	at java.base/java.nio.file.Path.of(Path.java:148)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at com.microsoft.sqlserver.jdbc//com.microsoft.sqlserver.jdbc.ConfigurableRetryLogic.getCurrentClassPath(ConfigurableRetryLogic.java:298)
	... 47 more

looks like an "off by one" error

@Jeffery-Wasty
Copy link
Contributor

Okay thanks for the feedback! I see the mistake I made. The issue is the .getSchemeSpecificPart() method only removes the jar: or file: part, but not the entire 'jar:file: prefix that we see in your case. I've changed the code to adjust for this and are looking at merging this for the next release.

@github-project-automation github-project-automation bot moved this from In progress to Closed Issues in MSSQL JDBC Mar 3, 2025
@Jeffery-Wasty Jeffery-Wasty removed the Under Investigation Used for issues under investigation label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed Issues
Development

Successfully merging a pull request may close this issue.

3 participants