Wednesday, August 3, 2011

How to Fix Ant Build Error: "Could not load a dependent class com/jcraft/jsch/Logger. It is not enough to have Ant's optional JARs"

If you get an error message like this while running a problematic Ant build script file :

remote.flush:

BUILD FAILED
/home/ceefour/git/magento-id/build.xml:13: The following error occurred while executing this line:
/home/ceefour/git/magento-id/build.xml:22: Problem: failed to create task or type sshexec
Cause: Could not load a dependent class com/jcraft/jsch/Logger
       It is not enough to have Ant's optional JARs
       you need the JAR files that the optional tasks depend upon.
       Ant's optional task dependencies are listed in the manual.
Action: Determine what extra JAR files are needed, and place them in one of:
        -/home/opt/eclipse_web/plugins/org.apache.ant_1.8.2.v20110505-1300/lib
        -/home/ceefour/.ant/lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem


It means your Ant build script file using optional Ant libraries and need to tell Ant where to find them.

In my case, it needs jsch.jar aka libjsch-java package in Debian/Ubuntu Linux.

First you need to install ant-optional package for Ant optional libraries support :
sudo apt-get install ant-optional

Then the libjsch-java Debian/Ubuntu package:
sudo apt-get install libjsch-java

Then put it in correct directories so that Ant can find them :

sudo ln -s /usr/share/java/jsch.jar /usr/share/ant/lib/
mkdir -vp ~/.ant/lib
ln -s /usr/share/java/jsch.jar ~/.ant/lib/

Ubuntu's Ant look for libraries in /usr/share/ant/lib folder, while Eclipse IDE's Ant look for optional Ant libraries in $HOME/.ant/lib folder.

Note that for Eclipse IDE, you may need to refresh Eclipse Ant Plug-in's Runtime Classpath, by going to Window > Preferences > Ant > Runtime, and clicking "Restore Defaults".
Make sure that the required libraries are now listed under "Global Entries".

Ant build system is frequently used in typical Java EE 6 enterprise application development. I highly recommend The Java EE 6 Tutorial: Basic Concepts (4th Edition) for a practical guide to the Java EE 6 technology.

10 comments:

  1. A great presentation. Very open and enlightening.You have attractively presented your concept in this webpage blog post.
    Who wrote the sonnet of seaside romance? Guess Shakespeare would feel wordless at the sight of marine motif wedding dresses 2012. Amber’s beach cheap wedding dresses plus size unfold pictures of sea-inspired details like pearl beading, shelly appliqué and metallic embroidery. A profusion of drapes, bubbles, pleating and ruffling echoes to the very physique of the beach and the sea.

    ReplyDelete
  2. Very interesting article. Esp. the stands used to support the head. I would not have noticed it on my own. Will have to look carefully at old photographs to see this feature.

    ReplyDelete
  3. Worth it to read post.Buy RS Gold Esp. the actual holders accustomed to secure the head. I wouldn't have seen the idea on my own. Should look carefully at outdated pictures to determine this particularBuy MapleStory Mesos feature.

    ReplyDelete
  4. The person that has been serving to you with the driving faculty should be able to supply you with some hints regarding cnc602a fuel injector cleaner tester how to cope with the problem.. You will also discover from expertise as you proceed to implement these tools. This is a important element of possessing and driving a car.

    ReplyDelete
  5. In my expertise, a 4- or 5-star rating is really a reliable thumbs-up. A score of two or three stars implies window anytime upgrade key “Meh.” And also a 1-star ranking is the equal of a raised center finger. Should you read the evaluations that accompany windows anytime upgrade key ultimate1-star rankings, you are going to locate equivalent components rage and buyer’s regret.

    ReplyDelete
  6. Cheap D3 Gold Pertaining to training to work, it needs to be done efficiently. Normally, GW2 Gold just putting things off in terms of transforming into a better person moves.

    ReplyDelete
  7. thank you .your article helped me to resolve the dependency issue. thanks

    ReplyDelete
  8. How to Fix ‘Failed to Load Resource’ Error in WordPress? Have you seen ‘Failed to load resource error’ in your WordPress website or browsers inspect tool? Many users find it difficult to figure out the issue for which resource or files are not loading and most importantly why it is not loading properly. For more information visit here:-
    403 forbidden error wordpress wp-admin
    wordpress admin ajax php 403 error
    wordpress 403 forbidden nginx
    failed to load resource the server responded with a status of 403 forbidden wordpress
    wordpress http 403 error
    wordpress multisite 403 error



    ReplyDelete
  9. Thanks for posting nice blog with us. Personalization has become vital for businesses to ensure they have a unique brand image. Choose PrintMagic to create Customized Pearl Metallic Presentation Folders that stand out from the competition and give you a distinct and professional look. We offer several options to create a unique and completely customized product with size, paper stock, and Folder pocket options. Get full-color CMYK printing that is fade-resistant and long-lasting, offering products that do justice to your brand!

    ReplyDelete