Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Module mode integration problems

Hello,

In java16 when I try to integrate jgit in eclipse with eclipse builder. I use Modules model. Env Archlinux.

I see JGit does not have module-info.java.

In HTTP All is good ...
I have a problem when I use it with "git@..." (note that the command git clone git@xxxxxxxxxx:eclipse/jgit.git work well)

My program:
============
package org.test.plouf;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.api.errors.TransportException;
public class basicTest {
public static void main(final String[] args) throws InvalidRemoteException, TransportException, GitAPIException {
Git git = Git.cloneRepository()
 .setURI( "git@xxxxxxxxxx:eclipse/jgit.git" )
 .setBranch("master")
 .call();
}
}

Test 1
============
I add in "Module path": org.eclipse.jgit-5.12.0.202106070339-r.jar
and add "requires org.eclipse.jgit;" in my module-info.java
==> the program compile, but at the run I have:
Exception in thread "main" org.eclipse.jgit.api.errors.TransportException: git@xxxxxxxxxx:eclipse/jgit.git: remote hung up unexpectedly
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:224)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:303)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:178)
at test.jgit.module/org.test.plouf.basicTest.main(basicTest.java:20)
Caused by: org.eclipse.jgit.errors.TransportException: git@xxxxxxxxxx:eclipse/jgit.git: remote hung up unexpectedly
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:313)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:153)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:142)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:94)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.Transport.fetch(Transport.java:1309)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:213)
... 3 more
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.jgit.transport.SshSessionFactory.getSession(org.eclipse.jgit.transport.URIish, org.eclipse.jgit.transport.CredentialsProvider, org.eclipse.jgit.util.FS, int)" because "this.sch" is null
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:107)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:281)
... 8 more

Mission jsch (maybe) ==> OK

Test 2
============
I add in "Module path": org.eclipse.jgit-5.12.0.202106070339-r.jar and org.eclipse.jgit.ssh.jsch-5.12.0.202106070339-r.jar
and add "requires org.eclipse.jgit;" in my module-info.java
==> the program compile, but at the run I have:
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module org.eclipse.jgit contains package org.eclipse.jgit.transport, module org.eclipse.jgit.ssh.jsch exports package org.eclipse.jgit.transport to org.eclipse.jgit

==> Package define in multiple JAR ... arf... 

Test 3
============
I add in "Module path": org.eclipse.jgit-5.12.0.202106070339-r.jar
I add in "ClassPath": org.eclipse.jgit.ssh.jsch-5.12.0.202106070339-r.jar
and add "requires org.eclipse.jgit;" in my module-info.java
==> the program compile, but at the run I have:
Exception in thread "main" java.util.ServiceConfigurationError: org.eclipse.jgit.transport.SshSessionFactory: Provider org.eclipse.jgit.transport.JschConfigSessionFactory not found
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:589)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1211)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1220)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1383)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.SshSessionFactory.loadSshSessionFactory(SshSessionFactory.java:44)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.SshSessionFactory.<clinit>(SshSessionFactory.java:39)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.SshTransport.<init>(SshTransport.java:48)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.TransportGitSsh.<init>(TransportGitSsh.java:116)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.TransportGitSsh$1.open(TransportGitSsh.java:106)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.Transport.open(Transport.java:521)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.Transport.open(Transport.java:397)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.Transport.open(Transport.java:276)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.transport.Transport.open(Transport.java:244)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:205)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:303)
at org.eclipse.jgit@5.12.0.202106070339-r/org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:178)
at test.jgit.module/org.test.plouf.basicTest.main(basicTest.java:20)

I try to fision the 2 jars with no results...

OK, now I have no more hypothesis...

I do not find what is wrong, Have someone an idea of solution ?

An other question, is it in planing to migrate jgit in Modules?

Thank you very much.
Best reagards.

Edouard DUPIN

Back to the top