asciidoctorj icon indicating copy to clipboard operation
asciidoctorj copied to clipboard

Oracle JDBC dependency in new inline processor Java

Open mattadamson opened this issue 8 years ago • 5 comments

I have a dependency on oracle jdbc by using DriverManager.getConnection. Whilst the java maven module compiles fine we get the error

"No suitable driver found" ..

I'm using the ascii doctor maven plug in section which has the new maven module containing the inline processor extension in. This is added as a dependency in the maven project using the plug in so ascii doctor should have access in the class path.

Is there anything else I need to do to ensure it can be found? Does it relate to the JRuby facade calling Java at all?

Thanks

mattadamson avatar Apr 29 '16 18:04 mattadamson

Is this dependency added to the plugin element or just to the dependencies of the project? I'd say it will be necessary to add it to the plugin configuration.

Cheers Robert

Am Freitag, 29. April 2016 schrieb mattadamson :

I have a dependency on oracle jdbc by using DriverManager.getConnection. Whilst the java maven module compiles fine we get the error

"No suitable driver found" ..

I'm using the ascii doctor maven plug in section which has the new maven module containing the inline processor extension in. This is added as a dependency in the maven project using the plug in so ascii doctor should have access in the class path.

Is there anything else I need to do to ensure it can be found? Does it relate to the JRuby facade calling Java at all?

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/asciidoctor/asciidoctorj/issues/454

robertpanzer avatar Apr 29 '16 20:04 robertpanzer

thanks @robertpanzer . Yes I did have this as a dependency within the plugin configuration. However I managed to get it to work only by calling Class.forName("oracle.jdbc.OracleDriver") first. I'm not sure why this has to occur as it didn't in the previous plug in I wrote for swagger2markup

mattadamson avatar Apr 29 '16 21:04 mattadamson

This should be unrelated to Maven or Asciidoctor. IIRC you always have to load the class first before getting a corresponding connection from DriverManager.

Cheers Robert

Am Freitag, 29. April 2016 schrieb mattadamson :

thanks @robertpanzer https://github.com/robertpanzer . Yes I did have this as a dependency within the plugin configuration. However I managed to get it to work only by calling Class.forName("oracle.jdbc.OracleDriver") first. I'm not sure why this has to occur as it didn't in the previous plug in I wrote for swagger2markup

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/asciidoctor/asciidoctorj/issues/454#issuecomment-215882554

robertpanzer avatar Apr 29 '16 21:04 robertpanzer

If this behaviour was required in the other plugin I'd understand however it's not which makes it strange. The swagger 2 markup plug in works without performing the forName call

mattadamson avatar Apr 30 '16 21:04 mattadamson

Hi Matt,

maybe the swagger2markup plugin already loads this class? I've not taken a look at this plugin yet, but if it works after you explicitly load the Oracle Driver class, I think it works as expected.

Cheers Robert

robertpanzer avatar May 05 '16 08:05 robertpanzer