Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with mongo-java-driver on MacOSX
    text
    copied!<p>I can't connect to MongoDB from Groovy script.</p> <p><strong>Env</strong>:</p> <pre><code>trnls-mbpro:test trnl$ sw_vers ProductName: Mac OS X ProductVersion: 10.6.5 BuildVersion: 10H574 trnls-mbpro:test trnl$ java -version java version "1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261) Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode) trnls-mbpro:test trnl$ groovy -version Groovy Version: 1.7.5 JVM: 1.6.0_22 trnls-mbpro:test trnl$ mongod -version db version v1.6.4, pdfile version 4.5 Sun Dec 12 03:34:32 git version: 4f5c02f8d92ff213b71b88f5eb643b7f62b50abc trnls-mbpro:test trnl$ trnls-mbpro:env trnl$ mongod -noauth -vvv </code></pre> <p><strong>Script test.groovy</strong>:</p> <pre><code>Mongo m = new Mongo("localhost", 27107); DB db = m.getDB("test"); BasicDBObject info = new BasicDBObject(); info.put("x", 203); info.put("y", 102); DBCollection collection = db.getCollection('user'); collection.insert(info); </code></pre> <p><strong>Results:</strong></p> <pre><code>trnls-mbpro:test trnl$ groovy -cp mongo-2.1.jar test.groovy Caught: com.mongodb.MongoException$Network: can't say something at test.run(test.groovy:16) trnls-mbpro:test trnl$ groovy -cp mongo-2.2.jar test.groovy Dec 12, 2010 3:30:24 AM com.mongodb.DBTCPConnector$MyPort error SEVERE: MyPort.error called java.io.IOException: couldn't connect to [trnls-mbpro.local/192.168.1.3:27107] bc:java.net.ConnectException: Connection refused at com.mongodb.DBPort._open(DBPort.java:172) at com.mongodb.DBPort.go(DBPort.java:79) at com.mongodb.DBPort.say(DBPort.java:60) at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:151) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:154) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:110) at com.mongodb.DBCollection.insert(DBCollection.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:188) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124) at test.run(test.groovy:16) at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:264) at groovy.lang.GroovyShell.run(GroovyShell.java:227) at groovy.lang.GroovyShell.run(GroovyShell.java:157) at groovy.ui.GroovyMain.processOnce(GroovyMain.java:496) at groovy.ui.GroovyMain.run(GroovyMain.java:311) at groovy.ui.GroovyMain.process(GroovyMain.java:297) at groovy.ui.GroovyMain.processArgs(GroovyMain.java:112) at groovy.ui.GroovyMain.main(GroovyMain.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:108) at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130) Caught: com.mongodb.MongoException$Network: can't say something at test.run(test.groovy:16) trnls-mbpro:test trnl$ groovy -cp mongo-2.3.jar test.groovy Caught: com.mongodb.MongoInternalException: DBPort.findOne failed at test.run(test.groovy:6) trnls-mbpro:test trnl$ </code></pre> <p>Any help is appreciated.</p> <p>-vova</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload