Hi Philip, what version of the Neo Shell are you using? I tried running with the b6 version and ran into the same problem as you did. However, everything seems to run fine using the trunk code, even the latest RC1-SNAPSHOTS work fine (e.g. http://m2.neo4j.org/org/neo4j/shell/1.0-rc1-SNAPSHOT/shell-1.0-rc1-20080319.221229-7.jar), running against neo4j-1.0-b6. So, i think the docu should just be updated with pointing out that b6 of the shell is not working as expected.
As for the starting code for the NeoServer, I can't see a Transaction being committed before the LocalNeoServer can accept NeoShell remote requests ... at least not in the NeoShell code (see e.g. StartRemoteClient,java, starting a LocalNeoShellServer.java which does roughly what you have in the NeoTest code). Not sure why this has to be there, what was the error you got without doing that? WDYT? /peter On Sun, Apr 27, 2008 at 9:24 PM, Philip Jägenstedt <[EMAIL PROTECTED]> wrote: > With some hand-holding from Tobias I've come up with this minimal code > to get the thing working: > > public class NeoTest { > > public enum MyRelationshipTypes implements RelationshipType { > KNOWS > > } > > public static void main(String[] args) { > final NeoService neo = new EmbeddedNeo("neobase"); > > Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { > public void run() { > System.out.println("Shutting down..."); > neo.shutdown(); > } > })); > > neo.enableRemoteShell(); > > // It appears that some transaction must be done for the shell > // to work, so we get the reference node. > Transaction tx = Transaction.begin(); > try { > Node referenceNode = neo.getReferenceNode(); > tx.success(); > } finally { > tx.finish(); > } > > while(true) { > try{ > Thread.sleep(100); > } catch (InterruptedException e) { > // ignore > } > } > } > } > > Perhaps the wiki should be updated with a complete example such as > this, since the instructions for "Running the shell client without an > externally running neo service" are also broken. > > > > Philip > > On 4/27/08, Philip Jägenstedt <[EMAIL PROTECTED]> wrote: > > OK, > > > > Frustration was running hight just now, so before anyone answers: > > > > I'm not sure in what way, but I messed up my classpath. I've updated > > http://wiki.neo4j.org/content/Neo_Shell_Guide to use the jar names > > that are included in the current versions so that might help some. > > > > However, I'm still getting > > > > $ java -cp neo-1.0-b6.jar:jta-spec1_0_1.jar:shell-1.0-b6.jar > > > > org.neo4j.util.shell.StartRemoteClient neobase/ > > Can't start client shell: java.lang.NumberFormatException: For input > > string: "neobase/" > > > > > > It seems that the first argument is being interpreted as an integer -- > > port number maybe? > > > > Also, adding lines to the code that actuall "do" something > > (neo.getReferenceNode()) seems to have made things less strange, the > > program is now returning. Most people are probably wondering, like me, > > how to get keep Java running and how to make it shut down nicely > > (something about a timeout loop and a shutdown signal?) so adding that > > to the example code would be helpful. > > > > > > Philip > > > > > > On 4/27/08, Philip Jägenstedt <[EMAIL PROTECTED]> wrote: > > > Greetings. > > > > > > Concerning http://wiki.neo4j.org/content/Neo_Shell_Guide > > > > > > This document is very difficult to understand for me as someone who > > > has just studied a Java course on university level and written a few > > > smaller things. I just can't get it working. > > > > > > The two lines of code I get are > > > > > > NeoService neo = new EmbeddedNeo( "neo" ); > > > neo.enableRemoteShell(); > > > > > > My first guess for a main-function (class called NeoShell) > > > > > > public static void main(String[] args) { > > > NeoService neo = new EmbeddedNeo("neobase"); > > > neo.enableRemoteShell(); > > > } > > > > > > $ java -classpath .:shell-1.0-b6.jar NeoShell > > > > > > INFO: Shell library not available. Neo shell not started. Please add > > > the Neo4j shell jar to the classpath > > > > > > OK, why can't I use the classpath flag? I copy the jar to > > > /usr/lib/jvm/java-1.5.0-sun-1.5.0.13/jre/lib/ext/ and move along. > > > Starting the second time the program doesn't return. Seems good. > > > > > > $ java -jar shell-1.0-b6.jar (only after also putting the jar in > ext...) > > > > > > NOTE: No port or RMI name specified, using default port 1337 and name > 'shell'. > > > Welcome to NeoShell > > > Available commands: quit > > > Use man <command> for info about each command. > > > org.neo4j.impl.persistence.PersistenceException: > > > org.neo4j.impl.transaction.NotInTransactionException: No transaction > > > found for current thread > > > > > > The last message prints forever... > > > > > > In the other terminal (where I started NeoShell) I get this: > > > > > > Apr 27, 2008 7:37:56 PM org.neo4j.impl.core.NodeManager getNodeById > > > SEVERE: Persistence error while trying to get node #0 by id. > > > org.neo4j.impl.persistence.PersistenceException: > > > org.neo4j.impl.transaction.NotInTransactionException: No transaction > > > found for current thread > > > > > > Until I kill the shell or NeoShell. > > > > > > Last hope: > > > > > > $ java -cp neo-1.0-rc1.jar:jta-1.0.1.jar:shell-1.0-rc1.jar > > > org.neo4j.util.shell.StartRemoteClient neobase/ > > > Can't start client shell: java.lang.NumberFormatException: For input > > > string: "neobase/" > > > > > > I've tried adding a line with "Transaction tx = Transaction.begin();" > > > to all of 3 possible positions (first/between/after the two existing > > > lines), all failing in spectacular ways. > > > > > > Also, how can I shut down NeoShell in a nice way? Just killing is of > > > course bad, and messages to that effect (rebuilding/fsck/whatever) > > > when starting. > > > > > > What am I doing so wrong? I should note that the database doesn't have > > > a single node or relation in it, I just wanted to play with the shell. > > > > > > > > > Philip... > > > > > > _______________________________________________ > Neo mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > > -- GTalk: neubauer.peter Skype peter.neubauer ICQ 18762544 GTalk neubauer.peter Phone +46704 106975 LinkedIn http://www.linkedin.com/in/neubauer http://www.neo4j.org - New Energy for Data - the Graph Database. http://www.ops4j.org - New Energy for OSS Communities - Open Participation Software. http://www.qi4j.org - New Energy for Java - Domain Driven Development. _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user