MongoDB: Can't connect to mongodb using username/password auth
--------------------------------------------------------------
Key: TEIID-4083
URL:
https://issues.jboss.org/browse/TEIID-4083
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.12.5
Environment: MongoDB 3.x
DV 6.3 ER1
Reporter: Filip Elias
Assignee: Ramesh Reddy
I can't connect to MongoDB through mongodb translator. An authentication always
fails.
Server exception:
{code}
14:14:15,304 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool]
(Worker3_QueryProcessorQueue4) mongodb-ds: getConnection(null, null) [0/20]
14:14:15,305 INFO [org.teiid.CONNECTOR] (Worker3_QueryProcessorQueue4) SELECT
smalla.INTNUM AS c_0, smalla.BIGDECIMALVALUE AS c_1, smalla.BIGINTEGERVALUE AS c_2,
smalla.BOOLEANVALUE AS c_3, smalla.BYTENUM AS c_4, smalla.CHARVALUE AS c_5,
smalla.DATEVALUE AS c_6, smalla.DOUBLENUM AS c_7, smalla.FLOATNUM AS c_8, smalla.INTKEY AS
c_9, smalla.LONGNUM AS c_10, smalla.OBJECTVALUE AS c_11, smalla.SHORTVALUE AS c_12,
smalla.STRINGKEY AS c_13, smalla.STRINGNUM AS c_14, smalla.TIMESTAMPVALUE AS c_15,
smalla.TIMEVALUE AS c_16 FROM smalla LIMIT 100
14:14:16,229 WARN [org.teiid.CONNECTOR] (Worker3_QueryProcessorQueue4) Connector worker
process failed for atomic-request=ysa307n2BRiE.1.0.1:
org.teiid.translator.TranslatorException: { "serverUsed" :
"dvqe03.mw.lab.eng.bos.redhat.com:27017" , "ok" : 0.0 ,
"errmsg" : "auth failed" , "code" : 18}
at
org.teiid.translator.mongodb.MongoDBQueryExecution.execute(MongoDBQueryExecution.java:104)
[translator-mongodb-8.12.5.redhat-2.jar:8.12.5.redhat-2]
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[rt.jar:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_45]
at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)
at com.sun.proxy.$Proxy125.execute(Unknown Source)
at
org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_45]
at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45]
Caused by: com.mongodb.CommandFailureException: { "serverUsed" :
"dvqe03.mw.lab.eng.bos.redhat.com:27017" , "ok" : 0.0 ,
"errmsg" : "auth failed" , "code" : 18}
at com.mongodb.CommandResult.getException(CommandResult.java:76)
[mongo-java-driver-2.13.1.jar:]
at com.mongodb.CommandResult.throwOnError(CommandResult.java:140)
[mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBPort$NativeAuthenticator.authenticate(DBPort.java:986)
[mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBPort.authenticate(DBPort.java:432) [mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBPort.checkAuth(DBPort.java:443) [mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:289)
[mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:269)
[mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84)
[mongo-java-driver-2.13.1.jar:]
at com.mongodb.DB.command(DB.java:320) [mongo-java-driver-2.13.1.jar:]
at com.mongodb.DB.command(DB.java:299) [mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBCollectionImpl.aggregate(DBCollectionImpl.java:99)
[mongo-java-driver-2.13.1.jar:]
at com.mongodb.DBCollection.aggregate(DBCollection.java:1649)
[mongo-java-driver-2.13.1.jar:]
at
org.teiid.translator.mongodb.MongoDBQueryExecution.execute(MongoDBQueryExecution.java:102)
[translator-mongodb-8.12.5.redhat-2.jar:8.12.5.redhat-2]
... 18 more
14:14:16,238 DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool]
(Worker2_QueryProcessorQueue5) mongodb-ds: returnConnection(12a738da, false) [1/20]
14:14:16,240 WARN [org.teiid.PROCESSOR] (Worker2_QueryProcessorQueue5) TEIID30020
{code}
MongoDB log:
{code}
16.141-0400 I ACCESS [conn704] authenticate db: bqt { authenticate: 1, user:
"dv", nonce: "xxx", key: "xxx" }
2016-03-16T09:14:16.141-0400 I ACCESS [conn704] Failed to authenticate dv@bqt with
mechanism MONGODB-CR: AuthenticationFailed: MONGODB-CR credentials missing in the user
document
{code}
You can find resource-adapter config in the corresponding bugzilla.