Skip to main content

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

Hello,

Thank you for your answer.

You said : "recommended ssh implementation in jgit which is based on Apache Mina sshd. " ==> How Can I select the back-end used by jgit? I have do nothing to select "jsch".

Best regards

- Edouard


Le dim. 11 juil. 2021 à 11:58, Matthias Sohn <matthias.sohn@xxxxxxxxx> a écrit :
On Thu, Jul 1, 2021 at 1:44 PM Heero Yui <yui.heero@xxxxxxxxx> wrote:
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.

JGit is still built on Java 8 [1] which doesn't have modules. JGit 6.0 will update to Java 11 [2]. 
JGit is modularized using OSGi since Eclipse IDE is based on OSGi runtime.
All JGit bundles declare the manifest header Automatic-Module-Name which JPMS uses to determine
module names if there is no module-info [3].

AFAICS JPMS does not allow split packages. This means you can't use org.eclipse.jgit.ssh.jsch which has
some classes in package org.eclipse.jgit.transport which is otherwise owned by the bundle org.eclipse.jgit.
This was done to avoid breaking clients when the jsch specific implementation was split out into a separate bundle [4].

You can use org.eclipse.jgit.ssh.apache instead which is the new, recommended ssh implementation in jgit
which is based on Apache Mina sshd. The old jsch based implementation org.eclipse.jgit.ssh.jsch is still around
but will be removed in a future release since jsch caused a number of issues and does not accept contributions [5]. 


-Matthias

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
_______________________________________________
jgit-dev mailing list
jgit-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jgit-dev

Back to the top