Skip to content

Conversation

@lmuppidi
Copy link

From examples, FirstHop doesn't work as is from GitHub when 2.22.x is installed.
Made changes to pom.xml to address following issues

  1. JDK version
  2. Added dependency for missing jackrabbit-jcr-commons
  3. Added version for 1.7.36
  4. Added org.apache.derby version as 10.14.2.0 to address missing EmbeddedDriver class issue while running FirstHop.java using the command mvn exec:java -Dexec.mainClass="org.apache.jackrabbit.firsthops.FirstHop"

Using the latest stable release Apache Jackrabbit 2.22.x (Java 11 and later), I am trying to run example FirstHop.java and it failed with several errors. Including JDK version, which was given as 1.5 in the pom before, missing dependency for jackrabbit-jcr-commons.
Another Problem was Derby 10.15.2.0 had EmbeddedDriver class location changes which resulted in javax.jcr.RepositoryException: Cannot instantiate persistence manager org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager 
Caused by: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
Made changes to pom.xml file to Derby 10.14.2.0 for compatibility reasons.
Copy link
Author

@lmuppidi lmuppidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the changes.

@reschke
Copy link
Contributor

reschke commented Oct 14, 2025

Thanks for the report. Seems it hasb't been tried for ages.

I fixed a few things in #302 (branch: JCR-5198), but I'm not sure about your Derby issue.

How do I check that?

@lmuppidi
Copy link
Author

I got this runtime error while trying to run the FirstHop example class.
mvn exec:java -Dexec.mainClass="org.apache.jackrabbit.firsthops.FirstHop"

Exception:-
java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
javax.jcr.RepositoryException: Cannot instantiate persistence manager

Attached the complete stack trace.
FirstHop Exception Stack Trace.rtf

@reschke
Copy link
Contributor

reschke commented Oct 14, 2025

I am (with my changes) getting:

[WARNING]
java.lang.Exception: The specified mainClass doesn't contain a main method with appropriate signature.
    at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0 (ExecJavaMojo.java:294)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.lang.NoSuchMethodException: No suitable main method found for class org.apache.jackrabbit.firsthops.FirstHop, and not Runnable
    at org.codehaus.mojo.exec.ExecJavaMojo.doExec (ExecJavaMojo.java:404)
    at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0 (ExecJavaMojo.java:289)
    at java.lang.Thread.run (Thread.java:834)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.082 s
[INFO] Finished at: 2025-10-14T18:29:47+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.6.1:java (default-cli) on project jackrabbit-firsthops: An exception occurred while executing the Java class. The specified mainClass doesn't contain a main method with appropriate signature.: No suitable main method found for class org.apache.jackrabbit.firsthops.FirstHop, and not Runnable -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[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

@lmuppidi
Copy link
Author

I do see the main method in the Java file (Github). Are you compiling it in Jdk11?

public static void main(String[] args) throws Exception { Repository repository = JcrUtils.getRepository(); Session session = repository.login(new GuestCredentials()); try { String user = session.getUserID(); String name = repository.getDescriptor(Repository.REP_NAME_DESC); System.out.println("Logged in as " + user + " to a " + name + " repository."); } finally { session.logout(); } }

@reschke
Copy link
Contributor

reschke commented Oct 14, 2025

Yes.

$ echo $JAVA_HOME/
/lib/jvm/jdk-11.0.27/

This is really strange.

@lmuppidi
Copy link
Author

Did you apply the pom.xml changes from this pull request for running FirstHop locally.
pom.xml was using java 1.5 before the change. Also check the version for exec-maven-plugin

@reschke
Copy link
Contributor

reschke commented Oct 14, 2025

Please check with my changes in https://issues.apache.org/jira/browse/JCR-5198 (#302)

@lmuppidi
Copy link
Author

Yes I get the same error with your pom.xml changes. May be classloading issue with the Maven exec plugin...

Ran the commands in the following sequence.

mvn clean compile,

mvn dependency:build-classpath -Dmdep.outputFile=classpath.txt 

java -cp "target/classes:$(cat classpath.txt)" org.apache.jackrabbit.firsthops.FirstHop
and received the expected output.
Logged in as anonymous to a Jackrabbit repository.
@lmuppidi
Copy link
Author

Please review the changes again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants