2015-02-13 3 views
0

При выполнении основной операции вставки в базе данных Infinitum возникает следующая ошибка. Я уверен, что у меня есть база данных, так как я могу подключиться к ней и работать с ней через CLI.com.blobcity.db.exceptions.InternalAdapterException: Не удается связаться с базой данных в это время

Сообщение об ошибке:

Exception in thread "main" com.blobcity.db.exceptions.InternalAdapterException: Unable to communicate with the database at this time 
 
\t at com.blobcity.db.QueryExecuter.executeQuery(QueryExecuter.java:71) 
 
\t at com.blobcity.db.QueryExecuter.executeBql(QueryExecuter.java:30) 
 
\t at com.blobcity.db.CloudStorage.postRequest(CloudStorage.java:728) 
 
\t at com.blobcity.db.CloudStorage.insert(CloudStorage.java:650) 
 
\t at com.blobcity.db.CloudStorage.insert(CloudStorage.java:381) 
 
\t at com.blobcity.Main.main(Main.java:23) 
 
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://localhost/rest/bquery 
 
\t at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
 
\t at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
 
\t at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
 
\t at java.lang.reflect.Constructor.newInstance(Constructor.java:408) 
 
\t at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1888) 
 
\t at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1883) 
 
\t at java.security.AccessController.doPrivileged(Native Method) 
 
\t at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1882) 
 
\t at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1455) 
 
\t at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) 
 
\t at com.blobcity.db.QueryExecuter.executeQuery(QueryExecuter.java:57) 
 
\t ... 5 more 
 
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://localhost/rest/bquery 
 
\t at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838) 
 
\t at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) 
 
\t at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) 
 
\t at com.blobcity.db.QueryExecuter.executeQuery(QueryExecuter.java:55) 
 
\t ... 5 more

Мой основной метод, который создает ошибку является:

package com.blobcity; 
 

 
import com.blobcity.db.config.Credentials; 
 
import java.util.Random; 
 

 
public class Main { 
 
    public static void main(String[] args) { 
 
     Credentials.init("localhost", "root", "root", "mydb"); 
 
     
 
     Hello hello = new Hello(); 
 
     hello.setId("1"); 
 
     hello.setRandom(new Random().nextInt()); 
 
     hello.insert(); 
 
    } 
 
}

И лицо класс, для которого я создал соответствующую таблицу является:

package com.blobcity; 
 

 
import com.blobcity.db.CloudStorage; 
 
import com.blobcity.db.annotations.Entity; 
 
import com.blobcity.db.annotations.Primary; 
 

 
@Entity 
 
public class Hello extends CloudStorage{ 
 
    @Primary 
 
    public String id; 
 
    public int random; 
 

 
    public String getId() { 
 
     return id; 
 
    } 
 

 
    public void setId(String id) { 
 
     this.id = id; 
 
    } 
 

 
    public int getRandom() { 
 
     return random; 
 
    } 
 

 
    public void setRandom(int random) { 
 
     this.random = random; 
 
    } 
 
}

ответ

0

Вы отсутствующий номер порта при установке Credentials. По умолчанию порта для подключения к базе данных Infinitum является 10111, если вы не изменили этот порт должен работать

Credentials.init("localhost:10111", "root", "root", "mydb");

Смежные вопросы