Error 13038: Can't find any special indices: 2d (needs index), 2dsphere (needs index) - mongodb

I've been searching for this for so many hours. Everytime I call the 'near' method on my Model, it gives the following error:
2.0.0p247 :001 > Status.near(#coordinates, 10).to_a
Moped::Errors::QueryFailure: The operation: #<Moped::Protocol::Query
#length=157
#request_id=3
#response_to=0
#op_code=2004
#flags=[:slave_ok]
#full_collection_name="howsmycity_development.statuses"
#skip=0
#limit=0
#selector={"deleted_at"=>nil, "coordinates"=>{"$nearSphere"=>[74.3344609, 31.5130751], "$maxDistance"=>0.002526046147566618}}
#fields=nil>
failed with error 13038: "can't find any special indices: 2d (needs index), 2dsphere (needs index), for: { deleted_at: null, coordinates: { $nearSphere: [ 74.3344609, 31.5130751 ], $maxDistance: 0.002526046147566618 } }"
I've already tried running: rake db:mongoid:create_indexes
Using Ruby 2, Rails 4, Mongoid 4, MongoDB 2.4.4 and Geocoder 1.1.8. And BTW I'm using Mongoid-Paranoia Gem too. I've also tried pointing all gems to their github repos with no luck. I've opened an issue here as well.
Any help appreciated.

With countless hours of debugging, I've found that installing the Geocoder Gem from HEAD actually fixed the problem, as the Gem's Author said:
gem 'geocoder', github: 'alexreisner/geocoder'
But at the time it didn't work for me. I think my database was corrupted. I say that because I had to completely remove all DBs from my Local Machine and also Remove & Add the MongoHQ addon again to my Heroku instance as well, just to make it work (since the problem persisted on Heroku as well).
Once I did that, I just re-did rake db:mongoid:create_indexes and everything was working perfectly.

Related

JPAM Configuration for Apache Drill

I'm trying to configure PLAIN authentification based on JPAM 1.1 and am going crazy since it doesnt work after x times checking my syntax and settings. When I start drill with cluster-id and zk-connect only, it works, but with both options of PLAIN authentification it fails. Since I started with pam4j and tried JPAM later on, I kept JPAM for this post. In general I don't have any preferences. I just want to get it done. I'm running Drill on CentOS in embedded mode.
I've done anything required due to the official documentation:
I downloaded JPAM 1.1, uncompressed it and put libjpam.so into a specific folder (/opt/pamfile/)
I've edited drill-env.sh with:
export DRILLBIT_JAVA_OPTS="-Djava.library.path=/opt/pamfile/"
I edited drill-override.conf with:
drill.exec: {
cluster-id: "drillbits1",
zk.connect: "local",
impersonation: {
enabled: true,
max_chained_user_hops: 3
},
security: {
auth.mechanisms: ["PLAIN"],
},
security.user.auth: {
enabled: true,
packages += "org.apache.drill.exec.rpc.user.security",
impl: "pam",
pam_profiles: [ "sudo", "login" ]
}
}
It throws the subsequent error:
Error: Failure in starting embedded Drillbit: org.apache.drill.exec.exception.DrillbitStartupException: Problem in finding the native library of JPAM (Pluggable Authenticator Module API). Make sure to set Drillbit JVM option 'java.library.path' to point to the directory where the native JPAM exists.:no jpam in java.library.path (state=,code=0)
I've run that *.sh file by hand to make sure that the necessary path is exported since I don't know if Drill is expecting that. The path to libjpam should be know known. I've started Sqlline with sudo et cetera. No chance. Documentation doesn't help. I don't get it why it's so bad and imo incomplete. Sadly there is 0 explanation how to troubleshoot or configure basic user authentification in detail.
Or do I have to do something which is not told but expected? Are there any Prerequsites concerning PLAIN authentification which aren't mentioned by Apache Drill itself?
Try change:
export DRILLBIT_JAVA_OPTS="-Djava.library.path=/opt/pamfile/"
to:
export DRILL_JAVA_OPTS="$DRILL_JAVA_OPTS -Djava.library.path=/opt/pamfile/"
It works for me.

TYPO3 Upgrade Wizard Fails on DatabaseRowsUpdateWizard

i updated a project from TYPO3 7.6 to ^8 by following the official guide. latest steps were the composer update. i removed extensions/packages not compatible with ^8 and updated the ones available for ^8. im able to reach the install tool, the TYPO3 admin backend and the frontend (with errors).
so i ended up at the step were i should use the upgrade wizards provided by the install tool. i completed a few wizards without any issues but then faces a pretty one - first i tried to run DatabaseRowsUpdateWizard within the install tool but that failed with a memory error - i tried the cli approach with
php -d memory_limit=-1 vendor/bin/typo3cms upgrade:wizard DatabaseRowsUpdateWizard
the processing worked but it ended up with following error:
[ Helhum\Typo3Console\Mvc\Cli\FailedSubProcessCommandException ]
#1485130941: Executing command "upgrade:subprocess" failed (exit code: "1")
thrown in file vendor/helhum/typo3-console/Classes/Install/Upgrade/UpgradeHandling.php
in line 284
the command initially failed is:
'/usr/bin/php7.2' 'vendor/bin/typo3cms' 'upgrade:subprocess' '--command' 'executeWizard' '--arguments' 'a:3:{i:0;s:24:"DatabaseRowsUpdateWizard";i:1;a:0:{}i:2;b:0;}'
and here is the subprocess exception:
[ Sub-process exception: TYPO3\CMS\Core\Resource\Exception\InvalidPathException ]
#1320286857: File ../disclaimer_de.html is not valid (".." and "//" is not allowed in path).
thrown in file typo3/sysext/core/Classes/Resource/Driver/AbstractHierarchicalFilesystemDriver.php
in line 71
im pretty much lost and dont know were to start to get this fixed - help is much appreciated
Issues like these usually stem from broken URLs in RTE fields as can be seen in the error output:
File ../disclaimer_de.html is not valid (".." and "//" is not allowed in path)
In this case you should manually prepare the database and run SQL statements which replace the broken/obsolete ../ prefix from all affected records. An example query:
UPDATE tt_content
SET bodytext = REPLACE(bodytext, 'href="../', 'href="')
WHERE bodytext LIKE '%href="../';
Notice that this query is very basic and can destroy your data, so make sure you run some SELECT statements first to make sure nothing breaks. Also keep a backup of your database at hand.
Sometime, custom or TER extension also have RTE such as tt_news where you might come across same issue. To fix that, you just need to run the same query with the according table.

install mongo with chef

I've tried to figure out how to install a mongodb 3.4 instance using this chef cookbook. Nevertheless, I've not able to get to install it.
This is my mongodb.rb file content:
node.default['mongodb']['package_version'] = '3.4'
include_recipe 'mongodb::default'
And my metadata.db: depends 'mongodb', '~> 0.16.2'.
I've tried to verify it on centos-72 platform using kitchen verify centos-72. I'm getting this message:
ERROR: yum_package[mongodb-org] (mongodb::install line 77) had an error: Chef::Exceptions::Package: Version ["3.4"] of ["mongodb-org"] not found. Did you specify both version and release? (version-release, e.g. 1.84-10.fc6)
I'm realizing this cookbook tries to add this yum_repository:
yum_repository 'mongodb' do
description 'mongodb RPM Repository'
baseurl "http://downloads-distro.mongodb.org/repo/redhat/os/#{node['kernel']['machine'] =~ /x86_64/ ? 'x86_64' : 'i686'}"
action :create
gpgcheck false
enabled true
end
And according to this mongo documentation the link repository should have to be:
https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
instead of
"http://downloads-distro.mongodb.org/repo/redhat/os/..."
The repo you are using does not have version 3.4 available. You can verify this manually by just looking at the RPMs in http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/RPMS/

Failed to start Neo4j service

I am using neo4j enterprise 3.0.3 version for windows. Following the operations manual 3.0, I have installed the neo4j service with bin\neo4j install-service. But I can't start it with bin\neo4j start. It said
Invoke-Neo4j : Failed to start service 'Neo4j Graph Database - neo4j (neo4j)'.
And I can't start the neo4j service in windows serice either. Maybe anyone have encountered this case before?
I had the same problem: I am using neo4j community 3.1.2 for windows and installed the service with the neo4j.bat file without any problems.Then i wanted to start the service with neo4j.bat and got the same error as you
I found a solution that worked for me. My neo4j files were in a folder, where the path to the folder contained spaces (C:\Program Files\Neo4j) Then i moved the folder one level up (C:\Neo4j).
After that i could start the service without problems.
Maybe this solution helps.
I am running neo4j on windows and in my case the crux of the issue was that there was an incompatibility between the installed versions of Java (32-bit) v/s OS version. The biggest clue that led me to this is the following set of lines in neo4j-service.2018-08-03 log file
[2018-08-03 14:55:42] [info] [ 1432] Starting service...
[2018-08-03 14:55:42] [error] [ 1432] %1 is not a valid Win32 application.
[2018-08-03 14:55:42] [error] [ 1432] Failed creating java C:\JavaNew\bin\server\jvm.dll
[2018-08-03 14:55:42] [error] [ 1432] %1 is not a valid Win32 application.
[2018-08-03 14:55:42] [error] [ 1432] ServiceStart returned 1
There are a fair number of potential issues, and I have made an attempt to compile all the issues with this,
Windows services cannot deal with service names in folders that have spaces; especially if there is another folder with the same name as the one with spaces.
For example - C:\Program Files... will have issues if C:\Program\Something...
To work around this, I put Neo4j in root folder c:\Neo4j
Get-Java.ps1 (under ..\bin\Neo4j-Management folder)looks in the path variable for 'JAVA_HOME' (usually found in *nix environments). If it does not find it here, it keeps looking in registry, and finally throws up its hand!
To deal with this, I simply put in a path variable. For a good measure, I uninstalled Java and re-installed Java in the root folder under C:\JavaNew
In retrospect, this step is probably not on part of the problem, and hence can be ignored. But I am leaving it here for completeness sake.
Invoke-Neo4j.ps1 (also under ..\bin\Neo4j-Management folder) has code that determines if the OS is 32-bit (or 64-bit). Based on this it determines if it should run prunsrv-i386.exe (32-bit) or prunsrv-amd64.exe (64-bit).
This has to match the Java version installed.
Upon running java -XshowSettings:all, and inspecting the sun.arch.data.model value (32, in my case), I realized that my OS is 64 bit and the Java version is 32-bit.
To deal with this, I put in code (very klugey!). I am sure there are much better ways to get to the same outcome, but this is what I used.
switch ( (Get-WMIObject -Class Win32_Processor | Select-Object -First 1).Addresswidth ) {
32 { $PrunSrvName = 'prunsrv-i386.exe' } # 4 Bytes = 32bit
#64 { $PrunSrvName = 'prunsrv-amd64.exe' } # 8 Bytes = 64bit COMMENTED as a workaround!!!
64 { $PrunSrvName = 'prunsrv-i386.exe' } # 8 Bytes = 64bit
Now, uninstall the neo4j service, install it, and start the service.
Hope this works for you.
neo4j console
Posting for latest versions > 4.x
I had the same issue using neo4j start, Neo4j console is the right command I was looking for. It is a web-based graph that acts as an interactive tutorial.
i had the same problem , after the neo4j worked for few weeks it stoop working (without any change that i made)
i have set java_home uninstall and install and now it works
neo4j-enterprise-3.3.4
I was also having weired issue as there was no error but neo4J service did not start.
[xx#ss1 bin]$ ./neo4j console
[xx#ss1 bin]$ .
The problem was with the permission on Java directory and I tried
chmod -R 777 jdk_directory
and problem got solved.
#neo4j #neo4jnotstarting

node.js - can't get mongodb to work, may have installed wrong?

I guess this is a shot in the dark since there's not a lot of specific code I can show you...
but I'm using node and trying to use mongodb, however I can't get mongodb to connect. I've tried a couple of tutorials that should pretty much work out of the box. in several cases pages that don't seem to have any immediate reference to the database will load ok. For example, a 'posts/new' page will load. but '/' which likely makes reference to showing posts, will just hang silently (the browser shows page loading).
If for example I got so submit a new post the browser hangs and in the terminal i get:
Express app started on port 3000
Error: Invalid ObjectId
at Function.fromString (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js:27:11)
at ObjectId.cast (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/schema/objectid.js:99:16)
at ObjectId.castForQuery (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/schema/objectid.js:133:17)
at Query.cast (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/query.js:249:32)
at Query.findOne (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/query.js:851:10)
at Function.findOne (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/model.js:714:16)
at /Users/xxx/Node_projects/noobjs/routes/articles.js:13:13
at paramCallback (/Users/xxx/Node_projects/noobjs/node_modules/express/lib/router/index.js:259:7)
at param (/Users/xxx/Node_projects/noobjs/node_modules/express/lib/router/index.js:241:11)
at pass (/Users/xxx/Node_projects/noobjs/node_modules/express/lib/router/index.js:253:5)
GET /article/new 500
GET /articles/new 200
if it helps at all, here's the package.json for the tutorial app used above:
{
"name": "noobjs"
, "description": "A demo app in nodejs illustrating use of express, jade and mongoose"
, "version": "2.0.0"
, "private": true
, "author": "Madhusudhan M S (http://twitter.com/madhums)"
, "engines": {
"node": ">= 0.4.10"
}
, "dependencies": {
"express" : ">= 2.3.12"
, "jade" : ">= 0.12.4"
, "mongoose": ">= 1.4.0"
, "stylus" : ">= 0.13.7"
, "express-csrf" : ">= 0.3.3"
, "gzippo" : ">= 0.0.4"
, "express-messages" : ">= 0.0.2"
}
}
Also when I do ./mongod from the command line i get -bash: ./mongod: No such file or directory. Anything else I try from the terminal or browser doesnt seem to communicate with mongodb at all.
Let me know if there's anything I can do to diagnose/change my installation.
Step 0: ensure that MongoDB is running ps -ef | grep mongod. If it's not started, check the log file for the reason it failed.
Step 1: ensure that you can connect to MongoDB from the command line.
Step 2: check your connection method, there are several ways to do this, but ensure the you have the correct servername:post/dbname
Here's a blog post I wrote. That walks through a simple setup with Node.JS + MongoDB + Cloudfoundry. The simple setup works locally and on Cloudfoundry, so you should be able to ignore the Cloudfoundry steps and still get something working.