marklogic-community / ml-jdbc-driver

Making JDBC connections to MarkLogic SQL/ODBC Server
Other
2 stars 4 forks source link

Unable to authenticate using Kerberos. #26

Open mwarnes opened 1 year ago

mwarnes commented 1 year ago

When using the postgresql-42.1.4.jar driver, the JDBC Client can successfully authenticate using Kerberos to a MarkLogic App server.

However, when using the mljdbc-42.1.4 driver, authentication fails with the following error.

Dec 01, 2022 2:16:09 AM com.marklogic.Driver connect
FINE: Connecting with URL: jdbc:marklogic://ivapp1188788.devin1.ms.com:40113/?loggerLevel=TRACE&loggerFile=/v/global/user/r/re/reddyrag/Cognos/pgjdbc-trace.log
Dec 01, 2022 2:16:09 AM org.postgresql.jdbc.PgConnection <init>
FINE: MarkLogic JDBC Driver 0.6
Dec 01, 2022 2:16:09 AM org.postgresql.jdbc.PgConnection setDefaultFetchSize
FINE:   setDefaultFetchSize = 0
Dec 01, 2022 2:16:09 AM org.postgresql.jdbc.PgConnection setPrepareThreshold
FINE:   setPrepareThreshold = 5
Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
FINE: Trying to establish a protocol version 3 connection to ivapp1188788.devin1.ms.com:40113
Dec 01, 2022 2:16:09 AM org.postgresql.core.Encoding <init>
FINEST: Creating new Encoding UTF-8 with fastASCIINumbers true
Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
FINE: Receive Buffer Size is 183,680
Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl
FINE: Send Buffer Size is 43,520
Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl sendStartupPacket
FINEST:  FE=> StartupPacket(user=dvlcrd, database=, client_encoding=UTF8, DateStyle=ISO, TimeZone=GMT+05:00, extra_float_digits=2)
Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl doAuthentication
FINEST:  <=BE ErrorMessage(ERROR: XDMP-INTERNAL: Internal error: Unknown server security setting
  Server SQLState: 08000)
Dec 01, 2022 2:16:09 AM com.marklogic.Driver connect
SEVERE: Connection error: 
org.postgresql.util.PSQLException: ERROR: XDMP-INTERNAL: Internal error: Unknown server security setting
  Server SQLState: 08000
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:419)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:206)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
    at com.marklogic.Driver.makeConnection(Driver.java:451)
    at com.marklogic.Driver.connect(Driver.java:253)
    at com.compositesw.common.pool.jdbc.JdbcConnectionInitiator.createConnection(JdbcConnectionInitiator.java:60)
    at com.compositesw.common.pool.jdbc.JdbcConnectionInitiator.initiateConnection(JdbcConnectionInitiator.java:50)
    at com.compositesw.common.pool.jdbc.JdbcConnectionFactory.initiateConnection(JdbcConnectionFactory.java:147)
    at com.compositesw.common.pool.jdbc.JdbcConnectionFactory.create(JdbcConnectionFactory.java:104)
    at com.compositesw.cdms.ds.jdbc.JdbcDataSource.getPoolFactoryWithValidation(JdbcDataSource.java:213)
    at com.compositesw.cdms.ds.jdbc.JdbcDataSource.getPoolFactoryWithValidation(JdbcDataSource.java:54)
    at com.compositesw.cdms.datasource.PhysicalConnectionPoolManager.createPool(PhysicalConnectionPoolManager.java:96)
    at com.compositesw.cdms.datasource.PhysicalConnectionPoolManager.getPool(PhysicalConnectionPoolManager.java:62)
    at com.compositesw.cdms.ds.jdbc.AbstractRelationalDataSource.getPool(AbstractRelationalDataSource.java:832)
    at com.compositesw.cdms.ds.jdbc.AbstractRelationalDataSource.validateConnection(AbstractRelationalDataSource.java:872)
    at com.compositesw.cdms.datasource.DefaultDataSourceManager.testConn(DefaultDataSourceManager.java:546)
    at com.compositesw.cdms.datasource.DefaultDataSourceManager.testConnectivity(DefaultDataSourceManager.java:481)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.compositesw.common.services.ServiceResolver$1.invoke(ServiceResolver.java:18)
    at com.sun.proxy.$Proxy9.testConnectivity(Unknown Source)
    at com.compositesw.cdms.webapi.service.WDataSourceImpl.testConnection(WDataSourceImpl.java:248)
    at com.compositesw.cdms.webapi.service.WMetaDataImpl.datasource_testConnection(WMetaDataImpl.java:431)
    at com.compositesw.cdms.webapi.service.WMetaDataSvc_Tie.invoke_datasource_testConnection(WMetaDataSvc_Tie.java:6326)
    at com.compositesw.cdms.webapi.service.WMetaDataSvc_Tie.processingHook(WMetaDataSvc_Tie.java:21777)
    at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:350)
    at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:465)
    at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
    at com.compositesw.server.services.SecurityHeadersFilter.doFilter(SecurityHeadersFilter.java:97)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.base/java.lang.Thread.run(Thread.java:834)
bobstarbird commented 1 year ago

Please try the latest 42.5.1 project found here: https://github.com/bobstarbird/pgjdbc/tree/feature/initial-migration You will need to download the source and run 'gradlew assemble' And then use the driver from the assemble found here: pgjdbc\build\libs\postgresql-42.5.1-SNAPSHOT.jar

I believe that the SSPI Security_Support_Provider_Interface was removed from the community build and may cause Kerberos problems. This new project is on a much more recent code base of pgjdbc.

On Fri, Dec 2, 2022 at 1:48 AM mwarnes @.***> wrote:

When using the postgresql-42.1.4.jar https://jdbc.postgresql.org/download/postgresql-42.1.4.jar driver, the JDBC Client can successfully authenticate using Kerberos to a MarkLogic App server.

However, when using the mljdbc-42.1.4 driver, authentication fails with the following error.

Dec 01, 2022 2:16:09 AM com.marklogic.Driver connect FINE: Connecting with URL: jdbc:marklogic://ivapp1188788.devin1.ms.com:40113/?loggerLevel=TRACE&loggerFile=/v/global/user/r/re/reddyrag/Cognos/pgjdbc-trace.log Dec 01, 2022 2:16:09 AM org.postgresql.jdbc.PgConnection FINE: MarkLogic JDBC Driver 0.6 Dec 01, 2022 2:16:09 AM org.postgresql.jdbc.PgConnection setDefaultFetchSize FINE: setDefaultFetchSize = 0 Dec 01, 2022 2:16:09 AM org.postgresql.jdbc.PgConnection setPrepareThreshold FINE: setPrepareThreshold = 5 Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl FINE: Trying to establish a protocol version 3 connection to ivapp1188788.devin1.ms.com:40113 Dec 01, 2022 2:16:09 AM org.postgresql.core.Encoding FINEST: Creating new Encoding UTF-8 with fastASCIINumbers true Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl FINE: Receive Buffer Size is 183,680 Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl openConnectionImpl FINE: Send Buffer Size is 43,520 Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl sendStartupPacket FINEST: FE=> StartupPacket(user=dvlcrd, database=, client_encoding=UTF8, DateStyle=ISO, TimeZone=GMT+05:00, extra_float_digits=2) Dec 01, 2022 2:16:09 AM org.postgresql.core.v3.ConnectionFactoryImpl doAuthentication FINEST: <=BE ErrorMessage(ERROR: XDMP-INTERNAL: Internal error: Unknown server security setting Server SQLState: 08000) Dec 01, 2022 2:16:09 AM com.marklogic.Driver connect SEVERE: Connection error: org.postgresql.util.PSQLException: ERROR: XDMP-INTERNAL: Internal error: Unknown server security setting Server SQLState: 08000 at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:419) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:206) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) at org.postgresql.jdbc.PgConnection.(PgConnection.java:195) at com.marklogic.Driver.makeConnection(Driver.java:451) at com.marklogic.Driver.connect(Driver.java:253) at com.compositesw.common.pool.jdbc.JdbcConnectionInitiator.createConnection(JdbcConnectionInitiator.java:60) at com.compositesw.common.pool.jdbc.JdbcConnectionInitiator.initiateConnection(JdbcConnectionInitiator.java:50) at com.compositesw.common.pool.jdbc.JdbcConnectionFactory.initiateConnection(JdbcConnectionFactory.java:147) at com.compositesw.common.pool.jdbc.JdbcConnectionFactory.create(JdbcConnectionFactory.java:104) at com.compositesw.cdms.ds.jdbc.JdbcDataSource.getPoolFactoryWithValidation(JdbcDataSource.java:213) at com.compositesw.cdms.ds.jdbc.JdbcDataSource.getPoolFactoryWithValidation(JdbcDataSource.java:54) at com.compositesw.cdms.datasource.PhysicalConnectionPoolManager.createPool(PhysicalConnectionPoolManager.java:96) at com.compositesw.cdms.datasource.PhysicalConnectionPoolManager.getPool(PhysicalConnectionPoolManager.java:62) at com.compositesw.cdms.ds.jdbc.AbstractRelationalDataSource.getPool(AbstractRelationalDataSource.java:832) at com.compositesw.cdms.ds.jdbc.AbstractRelationalDataSource.validateConnection(AbstractRelationalDataSource.java:872) at com.compositesw.cdms.datasource.DefaultDataSourceManager.testConn(DefaultDataSourceManager.java:546) at com.compositesw.cdms.datasource.DefaultDataSourceManager.testConnectivity(DefaultDataSourceManager.java:481) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.compositesw.common.services.ServiceResolver$1.invoke(ServiceResolver.java:18) at com.sun.proxy.$Proxy9.testConnectivity(Unknown Source) at com.compositesw.cdms.webapi.service.WDataSourceImpl.testConnection(WDataSourceImpl.java:248) at com.compositesw.cdms.webapi.service.WMetaDataImpl.datasource_testConnection(WMetaDataImpl.java:431) at com.compositesw.cdms.webapi.service.WMetaDataSvc_Tie.invoke_datasource_testConnection(WMetaDataSvc_Tie.java:6326) at com.compositesw.cdms.webapi.service.WMetaDataSvc_Tie.processingHook(WMetaDataSvc_Tie.java:21777) at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:350) at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:465) at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at com.compositesw.server.services.SecurityHeadersFilter.doFilter(SecurityHeadersFilter.java:97) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.base/java.lang.Thread.run(Thread.java:834)

— Reply to this email directly, view it on GitHub https://github.com/marklogic-community/ml-jdbc-driver/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOG6G2VKPJGK24LKWGEVNDWLGLVFANCNFSM6AAAAAASRS4EQA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Robert Starbird Software Professional Services Cell: (781) 548-9427 @.*** http://www.linkedin.com/in/robertstarbird

RaghunadhaReddy1983 commented 1 year ago

Thank you Robert. We are looking for the fix on mljdbc-42.1.4 driver for Kerberos to work. This custom driver provided by the marklogic for us and it is working non-kerberos connections. We need a solution for Kerberos authentication on this ML JDBC driver. Pls suggest.