Home > other >  Consult: spring - mongo. After uploaded to the cloud foundry cannot manipulate data after reconfigur
Consult: spring - mongo. After uploaded to the cloud foundry cannot manipulate data after reconfigur

Time:10-02

Such as: the SPRING configuration is as follows:
 mongo: mongo host="localhost" port="27017" & gt;  

JAVA database operation code is as follows:
 mongoTemplate. GetDb () getName (); 
MongoTemplate. Save (obj, obj. GetClass () getSimpleName ());

The first sentence can be normal for the DB, there is no problem, but when the second sentence operation data, throw an exception:
Com. The mongo. MongoException $Network: can 't say something
Java. IO. IOException: couldn 't connect to [/127.0.0.1:27017] bc:java.net.ConnectException: Connection refused
Com. The mongo. DBPort. _open (DBPort. Java: 214)
Com. The mongo. DBPort. Go (DBPort. Java: 107)
Com. The mongo. DBPort. Go (DBPort. Java: 84)
Com. The mongo. DBPort. Say (DBPort. Java: 79)
Com. The mongo. DBTCPConnector. Say (DBTCPConnector. Java: 181)
Com. The mongo. DBTCPConnector. Say (DBTCPConnector. Java: 155)
Com. The mongo. DBApiLayer $MyCollection. Update (DBApiLayer. Java: 349)
Com. The mongo. DBCollection. Update (DBCollection. Java: 177)
Com. The mongo. DBCollection. Save (DBCollection. Java: 817)
Com. The mongo. DBCollection. Save (DBCollection. Java: 785)
Org. Springframework. Data. The mongo. Core. MongoTemplate $11. DoInCollection (MongoTemplate. Java: 791)
Org. Springframework. Data. The mongo. Core. MongoTemplate. Execute (MongoTemplate. Java: 369)
Org. Springframework. Data. The mongo. Core. MongoTemplate. SaveDBObject (MongoTemplate. Java: 785)
Org. Springframework. Data. The mongo. Core. MongoTemplate. DoSave (MongoTemplate. Java: 721)
Org. Springframework. Data. The mongo. Core. MongoTemplate. Save (MongoTemplate. Java: 708)
Whether permission problems? No permissions DB operation? Ask god for help,

CodePudding user response:

App upload cloudfoundry is to go to the database information in the reading vcap_service first, and then to use this service,

CodePudding user response:

Newcomer to report, get some points first, ha ha
  • Related