I spent hours trying to solve this bug and the solution was so simple. 
My rpcpassword in my bitcoin.conf file contained a '#' character.

Prevent this from happening, by outputting this an error or warning when users run bitcoind.

Right now, you can have a # character as a password and it will work on the command line but will fail when you JSON-RPC.
{
public:
    CInit()
    {
        
        ppmutexOpenSSL.reset(new CCriticalSection[CRYPTO_num_locks()]);
        CRYPTO_set_locking_callback(locking_callback);
        
        
        
        
        
        OPENSSL_no_config();
#ifdef WIN32
        
        RAND_screen();
#endif
        
        RandAddSeed();
    }
    ~CInit()