Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Error pushing to remote

Matthias,

Thank you for replying. 

I have added JavaEWAH to the class path as well. Also, I'm Java 6. I still get the same error. In fact, the first time I run the project after deployment, I get the following errror:

Caused by: java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException
at org.eclipse.jgit.transport.Transport.<clinit>(Transport.java:112) [org.eclipse.jgit-3.1.0.201310021548-r.jar:3.1.0.201310021548-r]
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:144) [org.eclipse.jgit-3.1.0.201310021548-r.jar:3.1.0.201310021548-r]

If I do a project "Clean" in Eclipse, I get the "Could not initialize class org.eclipse.jgit.transport.Transport" error stated previously. 



On Fri, Nov 22, 2013 at 9:51 AM, Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
On Fri, Nov 22, 2013 at 4:37 PM, Gaurav Sharma <gsharma@xxxxxxxxxxxxxxxxx> wrote:
I'm using the jgit.jar in a custom web application. I'm using the following code to push local repo changes to master:

String remote = "origin";
String branch = "refs/heads/master";
String trackingBranch = "refs/remotes/" + remote + "/master";
RefSpec spec = new RefSpec(branch + ":" + branch);
Iterable<PushResult> resultIterable = git.push().setRemote(remote)
.setRefSpecs(spec).call();
PushResult result = resultIterable.iterator().next();
TrackingRefUpdate trackingRefUpdate = result
.getTrackingRefUpdate(trackingBranch);

When I use this code in a standalone java class (i.e. with  public static void main method), it works just fine. But when I incorporate this into my project, it fails with the following error:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jgit.transport.Transport
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:144) [org.eclipse.jgit-3.1.0.201310021548-r.jar:3.1.0.201310021548-r]

I have jsch.jar in the class path as well. Not sure why this is failing.


org.eclipse.jgit 3.1.0 has the following dependencies

      <dependency>
        <groupId>com.jcraft</groupId>
        <artifactId>jsch</artifactId>
        <version>0.1.46</version>
      </dependency>

      <dependency>
        <groupId>com.googlecode.javaewah</groupId>
        <artifactId>JavaEWAH</artifactId>
        <version>0.5.6</version>
      </dependency>

I'd recommend to use jsch 0.1.50 instead AFAIR there are some
problems using older versions on Java 7

--
Matthias



--
Gaurav Sharma | Consultant
Direct: 319.294.6097 | E: gsharma@xxxxxxxxxxxxxxxxx


 

Back to the top