Friday, April 11

String is immutable in java


Yes, it true that string is immutable in java which means that the String object doesn't change.
But that can't be true because we have seen many occasions in the program where the String variable is changed.

Yes its true, but we have our understanding of String a bit wrong here. Actually unlike C program, in Java, String is not a primitive variable but a special Class. So in our code  actually we are creating a String object for new character sequence.

For more understanding go to this link String can't be immutable in java

Friday, April 4

Neo4j Community Build Error


To build the neo4j community,  I am following  the steps as done in Travis CI link here.

But i am getting the error below
[ERROR] Failed to execute goal org.neo4j.build.plugins:license-maven-plugin:3:check (check-licenses) on project neo4j-kernel: Some files do not have the expected license header -> [Help 1] 
To solve this "Build the community/license-check submodule first." as suggested in SO link here.

But still i am getting the same error.

Please check whether my steps taken are correct or not.


/$ mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_30, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-60-generic", arch: "amd64", family: "unix"



/$ cd ~/Workspace/neo4jdev/community-experiments/licensecheck-config/
~/Workspace/neo4jdev/community-experiments/licensecheck-config$ mvn install

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.239s
[INFO] Finished at: Fri Apr 04 15:06:07 IST 2014
[INFO] Final Memory: 14M/148M



~/Workspace/neo4jdev/community-experiments/licensecheck-config$ cd ..
~/Workspace/neo4jdev/community-experiments$ MAVEN_OPTS="-Xss2m -Xmx1G"
~/Workspace/neo4jdev/community-experiments$ mvn install -DskipTests

[INFO] --- license-maven-plugin:3:check (check-licenses) @ neo4j-kernel ---
[INFO] Checking licenses...

[INFO] [INFO] Missing header in: /~/Workspace/neo4jdev/community-experiments/kernel/src/test/java/org/neo4j/unsafe/batchinsert/BatchInserterImplTest.java
[INFO] Missing header in: /~/Workspace/neo4jdev/community-experiments/kernel/src/test/java/org/neo4j/kernel/RaceBetweenCommitAndGetMoreRelationshipsIT.java
[INFO] Missing header in: /~/Workspace/neo4jdev/community-experiments/kernel/src/main/java/org/neo4j/tooling/GlobalGraphOperations.java

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Neo4j - Graph Database Kernel ..................... FAILURE [1.719s]
[INFO] Neo4j - JMX support ............................... SKIPPED
[INFO] Neo4j - Usage Data Collection ..................... SKIPPED
[INFO] Neo4j - Graphviz generation ....................... SKIPPED
[INFO] Neo4j - Lucene Index .............................. SKIPPED
[INFO] Neo4j - Graph Algorithms .......................... SKIPPED
[INFO] Neo4j - Graph Matching ............................ SKIPPED
[INFO] Neo4j - Cypher .................................... SKIPPED
[INFO] Neo4j Community ................................... SKIPPED
[INFO] Neo4j Community ................................... SKIPPED
[INFO] Neo4j - Generic shell ............................. SKIPPED
[INFO] Neo4j Examples .................................... SKIPPED
[INFO] Neo4j Server API .................................. SKIPPED
[INFO] Neo4j Server ...................................... SKIPPED
[INFO] Neo4j Server Examples ............................. SKIPPED
[INFO] Licensing configuration ........................... SKIPPED
[INFO] Neo4j Community Build ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.427s
[INFO] Finished at: Fri Apr 04 15:08:26 IST 2014
[INFO] Final Memory: 14M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.neo4j.build.plugins:license-maven-plugin:3:check (check-licenses) on project neo4j-kernel: Some files do not have the expected license header -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


Resolved

The license check is failing may because of some repository url may have changed,  which we have no control of so its better to skip the license check.

The following command will help to skip license check and build sucessfully.
$ mvn install -DskipTests -Dlicensing.skip

In linux os, it build successfully but in windows there were some issues in project "neo4j-browser" so i skipped that project to successfully  build in windows too.

Below is the error in windows in project neo4j-browser
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Licensing configuration ........................... SUCCESS [  2.796 s]
[INFO] Neo4j - Primitive Collections ..................... SUCCESS [  0.794 s]
[INFO] Neo4j - Graph Database Kernel ..................... SUCCESS [01:34 min]
[INFO] Neo4j - JMX support ............................... SUCCESS [  1.362 s]
[INFO] Neo4j - Usage Data Collection ..................... SUCCESS [  3.880 s]
[INFO] Neo4j - Monitor Logging ........................... SUCCESS [  1.120 s]
[INFO] Neo4j - Graphviz generation ....................... SUCCESS [  1.592 s]
[INFO] Neo4j - Lucene Index .............................. SUCCESS [  4.390 s]
[INFO] Neo4j - Graph Algorithms .......................... SUCCESS [  2.070 s]
[INFO] Neo4j - Graph Matching ............................ SUCCESS [  1.230 s]
[INFO] Neo4j Community Cypher Build ...................... SUCCESS [ 11.080 s]
[INFO] Neo4j - Cypher Commons ............................ SUCCESS [ 50.804 s]
[INFO] Neo4j - Cypher Compiler 2.1 ....................... SUCCESS [03:45 min]
[INFO] Neo4j - Cypher .................................... SUCCESS [ 37.636 s]
[INFO] Neo4j Community ................................... SUCCESS [  1.420 s]
[INFO] Neo4j GraphGist ................................... SUCCESS [  6.780 s]
[INFO] Neo4j - Cypher Documentation ...................... SUCCESS [ 36.070 s]
[INFO] Neo4j Community ................................... SUCCESS [  0.750 s]
[INFO] Neo4j - Generic shell ............................. SUCCESS [  3.550 s]
[INFO] Neo4j Examples .................................... SUCCESS [  1.790 s]
[INFO] Neo4j Server API .................................. SUCCESS [  1.920 s]
[INFO] Neo4j Browser ..................................... FAILURE [  0.430 s]
[INFO] Neo4j Server ...................................... SKIPPED
[INFO] Neo4j - Server Plugin Tests ....................... SKIPPED
[INFO] Neo4j Server Examples ............................. SKIPPED
[INFO] Neo4j Community Build ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:15 min
[INFO] Finished at: 2014-04-11T17:08:08+05:30
[INFO] Final Memory: 54M/302M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (default) on project neo4j-browser: An An
t BuildException has occured: unless=cmdsuccess -> [Help 1]

Now if you want to continue by skipping the project "Neo4j Browser", follow the below command
$ mvn install -DskipTests -Dlicensing.skip -e -rf :neo4j-server


Atlas, successfully build
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Neo4j Server ...................................... SUCCESS [01:55 min]
[INFO] Neo4j - Server Plugin Tests ....................... SUCCESS [  3.482 s]
[INFO] Neo4j Server Examples ............................. SUCCESS [  1.880 s]
[INFO] Neo4j Community Build ............................. SUCCESS [  0.440 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:05 min
[INFO] Finished at: 2014-04-11T17:20:07+05:30
[INFO] Final Memory: 46M/227M
[INFO] ------------------------------------------------------------------------