Wednesday, 20 January 2010

Azureus/Vuze fails to start - java.lang.NoClassDefFoundError: org/apache/log4j/Layout

Think bit torrent and most people think illegal file downloads. However, many OpenSource products and vendors use bit torrent distribution and it is part of the backbone of the OpenSource movement.

Azureus or Vuze is one of the best bit torrent clients out there. Written in Java, it is cross platform and the developers are Java gurus who have brought the best of Java to the best of OpenSource in a truly fanstastic bit of software.

However, as with most things Java, when an installation or upgrade fails, most users are left out there in the cold. And one of the most common ways for an Azureus upgrade or installation to fail is with this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout

Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Layout

at java.net.URLClassLoader$1.run(URLClassLoader.java:217)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:205)

at java.lang.ClassLoader.loadClass(ClassLoader.java:323)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)

at java.lang.ClassLoader.loadClass(ClassLoader.java:268)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)

Could not find the main class: org.gudy.azureus2.ui.common.Main. Program will exit.


It looks nasty, but actually the problem is very simple. What this is telling you is that the Azureus startup cannot find the jar file that has log4j in it. For example, log4j-1.2.15.jar. The solution is to tell the JVM where to find this on your system when Azureus starts up.

In kubuntu, which we prefer to use at Kieser.net, the azureus startup command is a shell script located here:

/usr/bin/azureus

The contents of this script look like something this (it will differ slightly in each installation depending on the Java that you have installed):

#!/bin/sh

JAVA='/usr/lib/jvm/java-6-openjdk/jre/bin/java -Xmx1024M'

/usr/share/java-config/libswt-3.4-java

if [ -z $VUZE ]; then

UI=-Dforce.ui=az2

fi

exec $JAVA -Djava.library.path=/usr/lib/jni:/usr/lib \

-classpath /usr/share/java/Azureus2.jar:$JARS \

-Dazureus.install.path="$HOME/.azureus" \

$UI \

org.gudy.azureus2.ui.common.Main "$@"


Note the line

./usr/share/java-config/libswt-3.4-java


This sets the variable $JARS which is passed as the classpath to the Java command. We need to add out log4j.jar path to that variable. This is what the file /usr/share/java-config/libswt-3.4-java looks like on our desktops:

JARS=/usr/share/java/swt-gtk-3.4.jar

So, locate where your log4j jar file is, then add it to this list. Here is what ours looks like:

JARS=/usr/share/java/swt-gtk-3.4.jar:/usr/share/java/log4j-1.2.15.jar

Now you can start up Azureus and all will be well!

If you haven't got log4j installed on your system, then you need to install it first. Most linux distributions have packages for log4j and you simply need to install that package using the package manager. But don't expect that installation to then add the jar file to the Azureus startup! It doesn't know to do that, so you need to manually edit the script that runs Azureus and sets the classpath as we have shown above.

Please note that Kieser.net is strictly against illegal file sharing. We support only legal and legitimate use of this technology, preferably use that promotes and helps OpenSource software adoption.

Honeypot: spam@kieser.net

42 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete
  2. listen came on this site today and sat down prime free casino slots Here I was able to relax and have a good time.

    ReplyDelete
  3. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.
    I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Java training in Indira nagar
    Java training in Rajaji nagar
    Java training in Marathahalli
    Java training in Btm layout
    Java training in Marathahalli

    ReplyDelete
  4. Awesome post. You Post is very informative. Thanks for Sharing.
    .Net Course in Noida

    ReplyDelete
  5. Good job! Fruitful article. I like this very much. It is very useful for my research. It shows your interest in this topic very well. I hope you will post some more information about the software. Please keep sharing!!
    Java Training in Chennai
    Java Training in Coimbatore
    Java Training in Bangalore

    ReplyDelete
  6. Awesome blog thanks for sharing Masters of building brands, Adhuntt Media is making waves in the Chennai digital market! Known for their out of their box ideas, if a creative overhaul for your brand is what you need, you’ve come to the right place.
    digital marketing company in chennai
    seo service in chennai
    web designing company in chennai
    social media marketing company in chennai

    ReplyDelete
  7. Nice blog thanks for sharing Wondering where to buy healthy garden plants in Chennai for your home? Karuna Nursery Gardens offers you with tons of variety and organic choices suitable for our tropical climate. Make your garden fabulous with Karuna Nursery.
    plant nursery in chennai
    rental plants in chennai
    corporate gardening service in chennai

    ReplyDelete
  8. Excellent blog thanks for sharing Buy the best beauty parlour products wholesale in Chennai at Pixies Beauty Shop. Thousands of global top-tier brands to choose from and friendly faces all over, we would love to make your Salon journey, one the world recognizes.
    beauty Shop in Chennai

    ReplyDelete
  9. Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here.
    Advertising Agency
    3d Animation Services
    Branding services
    Web Design Services in Chennai
    Advertising Company in Chennai

    ReplyDelete
  10. keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
    digital marketing training in bangalore | https://www.excelr.com/digital-marketing-training-in-bangalore

    ReplyDelete
  11. Very useful blog thanks for sharing IndPac India the German technology Packaging and sealing machines in India is the leading manufacturer and exporter of Packing Machines in India.

    ReplyDelete
  12. Here is the details of BMIT (Medical Imaging Technology) colleges in Bangalore. If you are looking to study BMIT in Bangalore, the below will help you to find the best BMIT colleges in Bangalore.
    BSc Medical Imaging Technology Colleges in Bangalore | Medical Imaging Technology Colleges in Bangalore |

    ReplyDelete
  13. Here is the details of B.Sc Optometry colleges in Bangalore. If you are looking to study BSc Optometry in Bangalore, the below will help you to find the best Optometry colleges in Bangalore.
    BSc Optometry Colleges in Bangalore | Optometry Colleges in Bangalore |

    ReplyDelete
  14. Here is the details of B.Sc Renal Dialysis Technology colleges in Bangalore. If you are looking to study BSc Renal Dialysis Technology in Bangalore, the below will help you to find the best Renal Dialysis Technology colleges in Bangalore.
    BSc Renal Dialysis Colleges in Bangalore | Renal Dialysis Technology Colleges in Bangalore |

    ReplyDelete
  15. Here is the details of B.Sc Respiratory Care Technology colleges in Bangalore. If you are looking to study BSc Respiratory Care Technology in Bangalore, the below will help you to find the best Respiratory Technology colleges in Bangalore.
    BSc Respiratory Care Technology Colleges in Bangalore | Respiratory Care Colleges in Bangalore |

    ReplyDelete
  16. Here is the details of B.Sc Cardiac Care Technology colleges in Bangalore. If you are looking to study BSc Cardiac Care Technology in Bangalore, the below will help you to find the best Cardiac Care Technology colleges in Bangalore.
    BSc Cardiac Care Technology Colleges in Bangalore | Cardiac Care Colleges in Bangalore |

    ReplyDelete
  17. Here is the details of B.Sc Perfusion Technology colleges in Bangalore. If you are looking to study BSc Perfusion Technology in Bangalore, the below will help you to find the best Perfusion Technology colleges in Bangalore.
    BSc Perfusion Technology Colleges in Bangalore | Perfusion Technology Colleges in Bangalore |

    ReplyDelete
  18. Thanks for the interesting blog that you have implemented here. Very helpful and innovative. Waiting for your next upcoming article.
    Java training in chennai
    Java training institute in chennai
    Java course in chennai
    Java training classes
    Java training
    Java programming classes
    core java coure
    <a

    ReplyDelete
  19. Thanks for the interesting blog that you have implemented here. Very helpful and innovative. Waiting for your next upcoming article.
    Digital Marketing Course In Kolkata

    ReplyDelete