Giter Site home page Giter Site logo

Comments (17)

dboissier avatar dboissier commented on August 26, 2024

Hi,

I use a MongoLab account to test secured access to remote Mongo server and it works fine.
Did you set the database field in the configuration panel?

Cheers,

David

from mongo4idea.

aruizca avatar aruizca commented on August 26, 2024

capture

from mongo4idea.

aruizca avatar aruizca commented on August 26, 2024

capture

from mongo4idea.

aruizca avatar aruizca commented on August 26, 2024

This trace might also help you:

Error when accessing Mongo server: command failed [$eval]: { "serverUsed" : "alex.mongohq.com/23.22.16.107:10040" , "ok" : 0.0 , "errmsg" : "unauthorized"}
com.mongodb.CommandResult$CommandFailure: command failed [$eval]: { "serverUsed" : "alex.mongohq.com/23.22.16.107:10040" , "ok" : 0.0 , "errmsg" : "unauthorized"}
    at com.mongodb.CommandResult.getException(CommandResult.java:88)
    at com.mongodb.CommandResult.throwOnError(CommandResult.java:134)
    at com.mongodb.DB.eval(DB.java:371)
    at org.codinjutsu.tools.mongo.logic.MongoManager.connectAndReturnServerVersion(MongoManager.java:63)
    at org.codinjutsu.tools.mongo.view.ServerConfigurationPanel$1.actionPerformed(ServerConfigurationPanel.java:85)

It looks to me that in your connectAndReturnServerVersion you are requesting something for which a normal user of this cloud service do not have authorization. It might be enough controlling that exception. If I have a time I'll have a look to your source code

Cheers,
Angel.

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

Hi,

actually, I look for the server version.

db.version();

Indeed, the aggregation feature is only available from mongo 2.2. In that case, aggregation query panel is displayed instead of a simple query panel.

However the mongo terminal only uses the executable defined in your path and all parameters are passed in the command line according to the man documentation.

So, I think you may have an authentication issue with your remote mongo server.

Cheers,

David

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

Hi,

Sorry for the last response. There is a bug when you want to use the console. It does not pass the database parameter.

Here below the behavior:
When a database or a collection is selected in the explorer then the console connects with the selected database
Or else it connects with the "test" database.

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

Hi,

A snapshot is available on the home page of the project and fix the above bug found whenever you want to use the console.

I am not sure if it fixes the pb you described at the begining of this conversation.

Tell me if you have more info about it.

Regards,

David

from mongo4idea.

aruizca avatar aruizca commented on August 26, 2024

Still no luck. This is the only MongoDB client that I cannot use to connect to my DB instance in MongoHQ. I connect with MongoVUE with no issues whatsoever:

rror when accessing Mongo server: command failed [$eval]: { "serverUsed" : "alex.mongohq.com/23.22.16.107:10029" , "ok" : 0.0 , "errmsg" : "unauthorized"}
com.mongodb.CommandResult$CommandFailure: command failed [$eval]: { "serverUsed" : "alex.mongohq.com/23.22.16.107:10029" , "ok" : 0.0 , "errmsg" : "unauthorized"}
    at com.mongodb.CommandResult.getException(CommandResult.java:88)
    at com.mongodb.CommandResult.throwOnError(CommandResult.java:134)
    at com.mongodb.DB.eval(DB.java:371)
    at org.codinjutsu.tools.mongo.logic.MongoManager.connectAndReturnServerVersion(MongoManager.java:63)
    at org.codinjutsu.tools.mongo.view.ServerConfigurationPanel$1.actionPerformed(ServerConfigurationPanel.java:90)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at com.intellij.ide.IdeEventQueue.d(IdeEventQueue.java:700)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:521)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:348)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:154)
    at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
    at java.awt.Dialog.show(Dialog.java:1082)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:706)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:399)
    at com.intellij.openapi.ui.DialogWrapper.showAndGetOk(DialogWrapper.java:1460)
    at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1435)
    at org.codinjutsu.tools.mongo.view.MongoConfigurable$1$3.run(MongoConfigurable.java:143)
    at org.codinjutsu.tools.mongo.view.MongoConfigurable$1$3.run(MongoConfigurable.java:134)
    at com.intellij.ui.ToolbarDecorator$4.doAdd(ToolbarDecorator.java:427)
    at com.intellij.ui.CommonActionsPanel$Buttons.performAction(CommonActionsPanel.java:65)
    at com.intellij.ui.CommonActionsPanel$MyActionButton.actionPerformed(CommonActionsPanel.java:222)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:162)
    at com.intellij.openapi.actionSystem.impl.ActionButton.a(ActionButton.java:169)
    at com.intellij.openapi.actionSystem.impl.ActionButton.a(ActionButton.java:132)
    at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:310)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at com.intellij.ide.IdeEventQueue.d(IdeEventQueue.java:700)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:521)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:348)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:154)
    at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
    at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
    at java.awt.Dialog.show(Dialog.java:1082)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:706)
    at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:399)
    at com.intellij.openapi.ui.DialogWrapper.showAndGetOk(DialogWrapper.java:1460)
    at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1435)
    at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:104)
    at org.codinjutsu.tools.mongo.view.action.OpenPluginSettingsAction.showSettingsFor(OpenPluginSettingsAction.java:45)
    at org.codinjutsu.tools.mongo.view.action.OpenPluginSettingsAction.actionPerformed(OpenPluginSettingsAction.java:41)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:162)
    at com.intellij.openapi.actionSystem.impl.ActionButton.a(ActionButton.java:169)
    at com.intellij.openapi.actionSystem.impl.ActionButton.a(ActionButton.java:132)
    at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:310)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at com.intellij.ide.IdeEventQueue.d(IdeEventQueue.java:700)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:521)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:348)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

Hi Alex,

I see a kind of IP address in the mongo URL : alex.mongohq.com/ 23.22.16.107 :10029

I am not sure to understand this. Do you have any info about it?

Thanks,

David

from mongo4idea.

baklinger avatar baklinger commented on August 26, 2024

I've tried to use the new snapshot but the problem with default connection to "test" database still occur. I think the problem is in the org.codinjutsu.tools.mongo.logic.MongoManager. The "createMongoClient" should get the third parameter i.e. "String userDatabase" and the "textURI" variable inside that method should take into account this parameter:

String textURI = String.format("mongodb://%s:%s%s", serverName, serverPort,
(userDatabase != null && !userDatabase.equals("")) ? "/" + userDatabase : "");

Any "createMongoClient" call should be also updated.

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

Hi,

Thanks for reporting that.

Actually, MongoLab allows to connect to your account without specifiying the database. So I did in that way and make the authentication to the user database after.

I suppose MongoHQ only allows full mongo URI.

I will update the code. A snapshot should be available in a couple of hours.

Regards,

David

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

Hi,

Please download the latest snapshot and tell me if it works.

Regards,

David

from mongo4idea.

baklinger avatar baklinger commented on August 26, 2024

Unfortunately the problem seems to be deeper. I still have the same "unauthorised" exception:

Error when accessing Mongo server: command failed [$eval]: { "serverUsed" : "localhost/127.0.0.1:27017" , "ok" : 0.0 , "errmsg" : "unauthorized"}
com.mongodb.CommandResult$CommandFailure: command failed [$eval]: { "serverUsed" : "localhost/127.0.0.1:27017" , "ok" : 0.0 , "errmsg" : "unauthorized"}
at com.mongodb.CommandResult.getException(CommandResult.java:88)
at com.mongodb.CommandResult.throwOnError(CommandResult.java:134)
at com.mongodb.DB.eval(DB.java:371)
at org.codinjutsu.tools.mongo.logic.MongoManager.connectAndReturnServerVersion(MongoManager.java:63)
at org.codinjutsu.tools.mongo.logic.MongoManager.connect(MongoManager.java:43)
at org.codinjutsu.tools.mongo.view.MongoExplorerPanel$1.run(MongoExplorerPanel.java:119)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:343)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at com.intellij.ide.IdeEventQueue.d(IdeEventQueue.java:700)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:525)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:348)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

On the MongoDB side I've got:

Wed Jun 12 13:46:00.664 [initandlisten] connection accepted from 127.0.0.1:49703 #28 (1 connection now open)
Wed Jun 12 13:46:00.664 [conn28] run command admin.$cmd { isMaster: 1 }
Wed Jun 12 13:46:00.664 [conn28] command admin.$cmd command: { isMaster: 1 } ntoreturn:1 keyUpdates:0 reslen:115 0ms
Wed Jun 12 13:46:00.665 [conn28] run command myfd.$cmd { getnonce: 1 }
Wed Jun 12 13:46:00.665 [conn28] command myfd.$cmd command: { getnonce: 1 } ntoreturn:1 keyUpdates:0 reslen:65 0ms
Wed Jun 12 13:46:00.665 [conn28] run command myfd.$cmd { authenticate: 1, user: "myfd_admin", nonce: "1dad3e1d07670bad", key: "0cff82b107990a184839911c7d9a7345" }
Wed Jun 12 13:46:00.665 [conn28] authenticate db: myfd { authenticate: 1, user: "myfd_admin", nonce: "1dad3e1d07670bad", key: "0cff82b107990a184839911c7d9a7345" }
Wed Jun 12 13:46:00.665 [conn28] command myfd.$cmd command: { authenticate: 1, user: "myfd_admin", nonce: "1dad3e1d07670bad", key: "0cff82b107990a184839911c7d9a7345" } ntoreturn:1 keyUpdates:0 locks(micros) r:152 reslen:75 0ms
Wed Jun 12 13:46:00.666 [conn28] run command myfd.$cmd { getnonce: 1 }
Wed Jun 12 13:46:00.666 [conn28] command myfd.$cmd command: { getnonce: 1 } ntoreturn:1 keyUpdates:0 reslen:65 0ms
Wed Jun 12 13:46:00.666 [conn28] run command myfd.$cmd { authenticate: 1, user: "myfd_admin", nonce: "7cc61ff6c3e152bf", key: "f94e10262b7a9c896f3ec0667b05646c" }
Wed Jun 12 13:46:00.666 [conn28] authenticate db: myfd { authenticate: 1, user: "myfd_admin", nonce: "7cc61ff6c3e152bf", key: "f94e10262b7a9c896f3ec0667b05646c" }
Wed Jun 12 13:46:00.666 [conn28] command myfd.$cmd command: { authenticate: 1, user: "myfd_admin", nonce: "7cc61ff6c3e152bf", key: "f94e10262b7a9c896f3ec0667b05646c" } ntoreturn:1 keyUpdates:0 locks(micros) r:122 reslen:75 0ms
Wed Jun 12 13:46:00.667 [conn28] run command myfd.$cmd { $eval: "db.version();", args: {} }
Wed Jun 12 13:46:00.667 [conn28] Privilege acquisition failed for myfd_admin@myfd in database : Bad database name "" (BadValue)
Wed Jun 12 13:46:00.667 [conn28] command denied: { $eval: "db.version();", args: {} }
Wed Jun 12 13:46:00.667 [conn28] command myfd.$cmd command: { $eval: "db.version();", args: {} } ntoreturn:1 keyUpdates:0 reslen:62 0ms
Wed Jun 12 13:46:00.669 [conn28] end connection 127.0.0.1:49703 (0 connections now open)

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

Hi,

Wed Jun 12 13:46:00.667 [conn28] run command myfd.$cmd { $eval: "db.version();", args: {} }
Wed Jun 12 13:46:00.667 [conn28] Privilege acquisition failed for myfd_admin@myfd in database : Bad database name "" (BadValue)

I read Bad database name (BadValue)

Any idea of that?

David

from mongo4idea.

dboissier avatar dboissier commented on August 26, 2024

A snapshot is available.

Please tell me if it is ok before I officially release 0.4.3

from mongo4idea.

baklinger avatar baklinger commented on August 26, 2024

I think it's OK. The new snapshot works well with my IntelliJ IDEA 12.1.4.
Thanks.

from mongo4idea.

aruizca avatar aruizca commented on August 26, 2024

I forgot to reply to this. It works fine now with the latest version. Thanks so much.

from mongo4idea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.