Configuring MongoDB connector in MuleStudio when authentication is disabled - "failed to connect" error

TheKilly

I'm writing some flows in MuleStudio that save to and query a MongoDB database. The flows work fine when pointed at a database that has one user with dbAdmin and userAdmin roles and is configured with that user's credentials. However, when I point it to a different database with no users added, I get the error below. I kept the username and password in the MongoDB connector config in Mule, as dummy text as is suggested in the documentation, then took them out, but to no avail. I'm using 3.3.1 CE runtime.

Error message with dummy credentials:

ERROR 2013-10-10 14:48:08,176 [[sso-mds].connector.http.mule.default.receiver.02] org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor. Root Exception was: Could not create a validated object, cause: Couldn't connect with the given credentials. Type: class java.util.NoSuchElementException
ERROR 2013-10-10 14:48:08,181 [[sso-mds].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to invoke findObjectsUsingQueryMap. Message payload is of type: LinkedHashMap
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Could not create a validated object, cause: Couldn't connect with the given credentials (java.util.NoSuchElementException)
  org.apache.commons.pool.impl.GenericKeyedObjectPool:1219 (null)
2. Failed to invoke findObjectsUsingQueryMap. Message payload is of type: LinkedHashMap (org.mule.api.MessagingException)
  org.mule.module.mongo.processors.FindObjectsUsingQueryMapMessageProcessor:177 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.util.NoSuchElementException: Could not create a validated object, cause: Couldn't connect with the given credentials
    at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1219)
    at org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionManager.acquireConnection(MongoCloudConnectorConnectionManager.java:437)
    at org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionManager.acquireConnection(MongoCloudConnectorConnectionManager.java:27)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

Error message with no credentials:

ERROR 2013-10-10 14:19:48,572 [[sso-mds].connector.http.mule.default.receiver.02] org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor. Root Exception was: null. Type: class java.lang.NullPointerException
ERROR 2013-10-10 14:19:48,574 [[sso-mds].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to invoke findObjectsUsingQueryMap. Message payload is of type: LinkedHashMap
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. null (java.lang.NullPointerException)
  org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionKey:86 (null)
2. Failed to invoke findObjectsUsingQueryMap. Message payload is of type: LinkedHashMap (org.mule.api.MessagingException)
  org.mule.module.mongo.processors.FindObjectsUsingQueryMapMessageProcessor:177 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.NullPointerException
    at org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionKey.hashCode(MongoCloudConnectorConnectionKey.java:86)
    at java.util.HashMap.hash(Unknown Source)
    at java.util.HashMap.getEntry(Unknown Source)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

Mule config:

<mongo:config name="Mongo_DB"  doc:name="Mongo DB" database="${mongo.db}" host="${mongo.host}" port="${mongo.port}" password="${db.password}" username="${db.username}>
    <mongo:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</mongo:config>
<flow name="user_gets_simple" doc:name="user_gets_simple">
    <composite-source doc:name="Composite Source">
        <http:inbound-endpoint exchange-pattern="request-response" host="${my.host}" port="${my.ID}" path="user/getAll" doc:name="HTTP /user/getAll"/>
        <http:inbound-endpoint exchange-pattern="request-response" host="${my.host}" port="${my.ID}" path="user/getByUsername" doc:name="HTTP /user/getByUsername"/>
        <http:inbound-endpoint exchange-pattern="request-response" host="${my.host}" port="${my.ID}" path="user/getById" doc:name="HTTP /user/getById"/>
        <http:inbound-endpoint exchange-pattern="request-response" host="${my.host}" port="${my.ID}" path="user/getByEmail" doc:name="HTTP /user/getByEmail"/>
    </composite-source>
    <flow-ref name="get_from_MongoDB" doc:name="Get from MongoDB subflow"/>
</flow>

<flow name="user_save_flow" doc:name="user_save_flow">
    <http:inbound-endpoint exchange-pattern="request-response" host="${my.host}" port="${my.ID}" path="user/save" doc:name="HTTP /user/save" />
    <byte-array-to-string-transformer doc:name="Byte Array to String"/>
    <json:json-to-object-transformer doc:name="JSON to Object" returnClass="java.util.Map"/>
    <mongo:insert-object-from-map config-ref="Mongo_DB" collection="${mongo.collection}" doc:name="Insert in Mongo DB"  >
        <mongo:element-attributes>
            <mongo:element-attribute key="firstName">#[payload.firstName]</mongo:element-attribute>
            <mongo:element-attribute key="lastName">#[payload.lastName]</mongo:element-attribute>
            <mongo:element-attribute key="location">#[payload.location]</mongo:element-attribute>
        </mongo:element-attributes>
    </mongo:insert-object-from-map>
    <set-payload value="Saved successfully" doc:name="Set Payload"/>
</flow>

<sub-flow name="get_from_MongoDB" doc:name="get_from_MongoDB">
    <byte-array-to-string-transformer doc:name="Byte Array to String"/>
    <json:json-to-object-transformer returnClass="java.util.Map" doc:name="JSON to Object"/>
    <mongo:find-objects-using-query-map config-ref="Mongo_DB" collection="${mongo.collection}" doc:name="Find objects in Mongo DB" limit="5">
        <mongo:query-attributes ref="#[payload]"/>
    </mongo:find-objects-using-query-map>
    <mongo:mongo-collection-to-json doc:name="Mongo collection to JSON"/>
</sub-flow>

Any suggestions on how I can connect to this database without adding a user?

Mudit

Hi that is an issue as the Mule ESB doesnt work without authentication... The user and the password fields are not "@optional".

for creating users in mongo and running mongo in authentication mode

http://www.mkyong.com/mongodb/mongodb-authentication-example/

and then you can put it the credentials in Mule ESB and you are good to go ....

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

GitHub - failed to connect to github 443 windows/ Failed to connect to gitHub - No Error

From Dev

MongoDB setup with node.js: Error: failed to connect to [localhost:27017]

From Dev

Selenium WebDriver Firefox error - Failed to connect

From Dev

Docker - Node.js + MongoDB - "Error: failed to connect to [localhost:27017]"

From Dev

Authentication error configuring Jenkins to work with Git Bitbucket repo

From Dev

Android Application Network Error failed to connect

From Dev

[Error: failed to connect to [localhost:27017]] . This error is occuring On mongodb

From Dev

Error: failed to connect to [undefined:27017]

From Dev

Tmux failed to connect to server error on `tmux ls` when there are no running sessions

From Dev

Instagram error: Implicit authentication is disabled

From Dev

Mongodb Error: failed to connect to [localhost:27017]

From Dev

Error: failed to connect to [localhost:27017]

From Dev

Github error: Failed to connect to 443 port

From Dev

"Fatal error: Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: /tmp/mongodb-27017.sock:0: Connection refused''"

From Dev

ERROR: failed to connect to camera service @ Android marshmallow

From Dev

Authentication error when accessing mongodb through Spring Boot app

From Dev

Authentication error when accessing mongodb through Spring Boot app

From Dev

Error when using Drupal Connector in MuleStudio

From Dev

Heroku + NodeJS + MongoHQ + MongoSync: [Error: failed to connect to [mongodb://xyz.mongohq.com]]

From Dev

Android Application Network Error failed to connect

From Dev

Error in web connector when quickbooks not running

From Dev

Failed to connect to JMX while started to use the JMX authentication on Linux

From Dev

Error When Configuring Inheritance In SQLAlchemy

From Dev

System error 111 (connection refused) , Failed to connect

From Dev

Failed to connect to port 8080 error when using socket.io and node.js on openshift even when port 8000 specified

From Dev

Error: Failed to connect to the host via ssh

From Dev

Error Handle in Rxjava : ConnectException: Failed to connect

From Dev

Why SMTP ERROR: Failed to connect to server: No route to host (65) when trying to send email with PhpMailer?

From Dev

Symfony php error when configuring users and roles

Related Related

  1. 1

    GitHub - failed to connect to github 443 windows/ Failed to connect to gitHub - No Error

  2. 2

    MongoDB setup with node.js: Error: failed to connect to [localhost:27017]

  3. 3

    Selenium WebDriver Firefox error - Failed to connect

  4. 4

    Docker - Node.js + MongoDB - "Error: failed to connect to [localhost:27017]"

  5. 5

    Authentication error configuring Jenkins to work with Git Bitbucket repo

  6. 6

    Android Application Network Error failed to connect

  7. 7

    [Error: failed to connect to [localhost:27017]] . This error is occuring On mongodb

  8. 8

    Error: failed to connect to [undefined:27017]

  9. 9

    Tmux failed to connect to server error on `tmux ls` when there are no running sessions

  10. 10

    Instagram error: Implicit authentication is disabled

  11. 11

    Mongodb Error: failed to connect to [localhost:27017]

  12. 12

    Error: failed to connect to [localhost:27017]

  13. 13

    Github error: Failed to connect to 443 port

  14. 14

    "Fatal error: Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: /tmp/mongodb-27017.sock:0: Connection refused''"

  15. 15

    ERROR: failed to connect to camera service @ Android marshmallow

  16. 16

    Authentication error when accessing mongodb through Spring Boot app

  17. 17

    Authentication error when accessing mongodb through Spring Boot app

  18. 18

    Error when using Drupal Connector in MuleStudio

  19. 19

    Heroku + NodeJS + MongoHQ + MongoSync: [Error: failed to connect to [mongodb://xyz.mongohq.com]]

  20. 20

    Android Application Network Error failed to connect

  21. 21

    Error in web connector when quickbooks not running

  22. 22

    Failed to connect to JMX while started to use the JMX authentication on Linux

  23. 23

    Error When Configuring Inheritance In SQLAlchemy

  24. 24

    System error 111 (connection refused) , Failed to connect

  25. 25

    Failed to connect to port 8080 error when using socket.io and node.js on openshift even when port 8000 specified

  26. 26

    Error: Failed to connect to the host via ssh

  27. 27

    Error Handle in Rxjava : ConnectException: Failed to connect

  28. 28

    Why SMTP ERROR: Failed to connect to server: No route to host (65) when trying to send email with PhpMailer?

  29. 29

    Symfony php error when configuring users and roles

HotTag

Archive