Search in sources :

Example 1 with UnableToStartServerException

use of org.neo4j.desktop.model.exceptions.UnableToStartServerException in project neo4j by neo4j.

the class DatabaseActions method start.

public void start() throws UnableToStartServerException {
    if (isRunning()) {
        throw new UnableToStartServerException("Already started");
    }
    Config config = model.getConfig();
    Monitors monitors = new Monitors();
    LogProvider userLogProvider = FormattedLogProvider.toOutputStream(System.out);
    GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies().userLogProvider(userLogProvider).monitors(monitors);
    server = new CommunityNeoServer(config, dependencies, userLogProvider);
    try {
        server.start();
    } catch (ServerStartupException e) {
        server = null;
        Set<Class> causes = extractCauseTypes(e);
        if (causes.contains(StoreLockException.class)) {
            throw new UnableToStartServerException("Unable to lock store. Are you running another Neo4j process against this database?");
        }
        if (causes.contains(BindException.class)) {
            throw new UnableToStartServerException("Unable to bind to port. Are you running another Neo4j process on this computer?");
        }
        throw new UnableToStartServerException(e.getMessage());
    }
}
Also used : LogProvider(org.neo4j.logging.LogProvider) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) Set(java.util.Set) HashSet(java.util.HashSet) CommunityNeoServer(org.neo4j.server.CommunityNeoServer) Config(org.neo4j.kernel.configuration.Config) ServerStartupException(org.neo4j.server.ServerStartupException) UnableToStartServerException(org.neo4j.desktop.model.exceptions.UnableToStartServerException) Monitors(org.neo4j.kernel.monitoring.Monitors) GraphDatabaseDependencies(org.neo4j.kernel.GraphDatabaseDependencies) StoreLockException(org.neo4j.kernel.StoreLockException) BindException(java.net.BindException)

Aggregations

BindException (java.net.BindException)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 UnableToStartServerException (org.neo4j.desktop.model.exceptions.UnableToStartServerException)1 GraphDatabaseDependencies (org.neo4j.kernel.GraphDatabaseDependencies)1 StoreLockException (org.neo4j.kernel.StoreLockException)1 Config (org.neo4j.kernel.configuration.Config)1 Monitors (org.neo4j.kernel.monitoring.Monitors)1 FormattedLogProvider (org.neo4j.logging.FormattedLogProvider)1 LogProvider (org.neo4j.logging.LogProvider)1 CommunityNeoServer (org.neo4j.server.CommunityNeoServer)1 ServerStartupException (org.neo4j.server.ServerStartupException)1