I am trying to access a neo4j database from my java program. I tried to create a fresh db and query it, and it ran successfully as per: http://neo4j.com/docs/java-reference/current/#tutorials-java-embedded
Code:
String DB_PATH = "C:/Users/singsand/Documents/Neo4j/newdb";
File f=new File(DB_PATH);
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(f);
try (Transaction tx=graphDb.beginTx()){
graphDb.execute("CREATE (table1:car {name:'car1'})");
tx.success();
}
But then I started this db as a server through the Neo4j community edition tool and also accessed it through my browser.
After that, when i executed the same java program I used above, it throws the following error:
Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, C:\Users\singsand\Documents\Neo4j\newdb
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:144)
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(CommunityFacadeFactory.java:40)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:108)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:100)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.lambda$createDatabaseCreator$193(GraphDatabaseFactory.java:89)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:183)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:65)
at neo4j.neo4jdemo.App.main(App.java:41)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.recovery.Recovery#62fca613' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:416)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:62)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:98)
at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:508)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.kernel.impl.transaction.state.DataSourceManager.start(DataSourceManager.java:99)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:140)
... 7 more
Caused by: java.lang.IllegalArgumentException: Unrecognized log entry version -9. At position LogPosition{logVersion=0, byteOffset=16} and entry version null
at org.neo4j.kernel.impl.transaction.log.entry.LogEntryVersion.byVersion(LogEntryVersion.java:147)
at org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader.readLogEntry(VersionAwareLogEntryReader.java:83)
at org.neo4j.kernel.impl.transaction.log.LogEntryCursor.next(LogEntryCursor.java:50)
at org.neo4j.kernel.recovery.LatestCheckPointFinder.find(LatestCheckPointFinder.java:77)
at org.neo4j.kernel.recovery.PositionToRecoverFrom.apply(PositionToRecoverFrom.java:53)
at org.neo4j.kernel.recovery.DefaultRecoverySPI.getPositionToRecoverFrom(DefaultRecoverySPI.java:112)
at org.neo4j.kernel.recovery.Recovery.init(Recovery.java:72)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:406)
... 16 more
I have seen similar errors in other Stack Overflow questions, but wasn't able to solve my issue using their solutions.
If I understand correctly. You are using embedded version of Neo4j in your app and than you are trying to start Neo4j server on your localhost. Is that right?
Neo4j Server vs Embedded mode
The thing is Neo4j embedded is running as part of your Java application. Neo4j server is standalone service which is run separately. And you can't combine those two on the same db.
If you want to use Neo4j browser with your embedded db this should help you - http://graphaware.com/neo4j/2014/11/21/neo4j-browser-with-embedded.html
Related
I am getting this error in my stacktrace of my Java Spring app:
Caused by: com.mongodb.MongoConfigurationException: Unable to look up TXT record for host <endpoint>.mongodb.net
[...]
javax.naming.NameNotFoundException: DNS name not found [response code 3]
I can verify that I can connect to this MongoDB via Robo3T with the exact same connection string but when I run this app, I get this error.
My Spring Boot version is: 2.6.6. And the dependency for Spring Data is: org.springframework.boot:spring-boot-starter-data-mongodb:2.6.6.
Things I've tried:
The issue I'm running into is very similar to this SO post. I tried updating my local Windows firewall to allow for those inbound/outbound ports (and restarted my machine) but no dice.
I then tried to update my DNS settings to use Google's 8.8.8.8 on my Windows network adapter for IPv4 but also no dice.
I also saw this fixed issue about the Java Mongo driver throwing the exact same exception above, https://jira.mongodb.org/browse/JAVA-4018. So I then tried to update my Spring Data Mongo dependencies to v2.7.0 but also no dice.
Any other suggestions?
I am calling Stored procedure from java based web-application using DB2 as database and WebSphere as server.
Most of the time SP gets executed properly but sometimes it gives following exception:
[ibm][db2][jcc][t4][2055][11259] Execution failed due to a distribution protocol error that caused deallocation of the conversation.
The command requested could not be completed because of a permanent error condition detected at the target system.
Db2jcc Driver version :
IBM DB2 JDBC Universal Driver Architecture 3.1.157 [ v9.1 FP0 (GA) ]
Please help me to sort out this issue.
Not sure if this will match your scenario, but it looks like there is a known fix for an error with the same message as the one you reported
http://www-01.ibm.com/support/docview.wss?uid=swg1IZ07622
which recommends moving up to DB2 V9.5 fixpack 5.
I created a new graph database in Java using the "normal" code
OrientGraphFactory factory = new OrientGraphFactory("plocal:/home/miguel/orientdb-community-2.1.4/databases/flora","admin","admin");
final OrientGraphNoTx graph = factory.getNoTx();
it gets created, and everything works ok in the Java app.
However, I cannot open this database from the console nor the studio. The server gives me the error:
connect remote:localhost/flora admin admin
Connecting to database [remote:localhost/flora] with user 'admin'...
Error: com.orientechnologies.orient.core.exception.OStorageException:
Cannot open local storage '/home/miguel/orientdb-community-2.1.4/databases/flora' with mode=rw
Error: com.orientechnologies.orient.core.exception.OSerializationException: Cannot load database's configuration. The database seems to be corrupted.
Error: java.lang.NullPointerException: Name is null
If I add the following line in the storages of orientdb-server-config.xml
<storage name="flora" path="plocal:/var/orientdb/databases/flora" userName="admin" userPassword="admin" loaded-at-startup="true" />
the DB opens but seems to be empty (although it's not empty when accessed from Java).
What am I missing?
It happens that I was using version 2.2.0 in Java, and version 2.1.4 in the server; the database files were not compatible.
It worked as soon as I downgraded to 2.1.4 in Java.
I've a Java project which is successfully inserting n number of records in Database in Testing env but when i deployed it in Production machine, it fails with exception "can't serialize access exception for this transaction".
I've searched on google and found that there might be other scripts running on Production machine which might be accessing the same table at that time.
For this I've changed the isolation_level from
TRANSACTION_READ_COMMITTED to TRANSACTION_SERIALIZABLE.
Will it make any difference when deploy in Production machine.
Please assist.Thanks in advance
I've created a neo4j database embedded into my java application. Creating nodes, relationships, properties and querying all of them looks fine, but now I want to visualize the database just to check if everything is okay. So I tried to load the test.db inside my neo4j-Server edition (running on the same machine), but however I get all the time the following error:
Starting Neo4j Server failed: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, C:\Users\user\workspace\neo4j_emb_test\target\test.db
Don't know what's going wrong here. Does anybody has suggestions?
Thanks in advance !
Julian
edit:
Checking the logs returned following results:
2014-05-26 14:56:30.988+0000 ERROR [o.n.k.EmbeddedGraphDatabase]: Startup failed: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#7f180826' was successfully initialized, but failed to start. Please see attached cause exception.: Component 'org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource#71fc9ad0' was successfully initialized, but failed to start. Please see attached cause exception.: 'neostore' has a store version number that we cannot upgrade from. Expected 'NeoStore v0.A.0' but file is version 'NeoStore v0.A.3'.
2014-05-26 14:56:30.988+0000 INFO [o.n.k.EmbeddedGraphDatabase]: Shutdown started
You cannot run two embedded instances against the same Neo4j database at the same time, you need to run Neo4j in stand-alone mode for that. Then you only have access to the REST API provided, and not the Java API.
I had the exact same experience a little while ago that was answered here: Disable locking of Neo4j graph database?