Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use Axis2/Java to consume web services. In particular, I'm trying to generate Java skeleton code from a WSDL file.

I installed the libaxis-java package, but the package doesn't contain the script I was expecting. I tried to generate the Java code by doing:

java -cp /usr/share/java/axis.jar org.apache.axis.wsdl.WSDL2Java foo.wsdl

But I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory
        at org.apache.axis.components.logger.LogFactory.class$(
        at org.apache.axis.components.logger.LogFactory$
        at Method)
        at org.apache.axis.components.logger.LogFactory.getLogFactory(
        at org.apache.axis.components.logger.LogFactory.<clinit>(
        at org.apache.axis.i18n.ProjectResourceBundle.<clinit>(
        at org.apache.axis.i18n.MessagesConstants.<clinit>(
        at org.apache.axis.utils.Messages.<clinit>(
        at org.apache.axis.wsdl.WSDL2Java.<clinit>(
Could not find the main class: org.apache.axis.wsdl.WSDL2Java. Program will exit.
share|improve this question
Looks like you're missing a jar on the classpath. – suhridk Oct 14 '10 at 19:06

You seem to be lacking the commons-logging jar in your classpath:

  1. Install Ubuntu package libcommons-logging-java:

    sudo apt-get install libcommons-logging-java

  2. Append /usr/share/java/commons-logging.jar and its relatives to your classpath:

    java -cp /usr/share/java/axis.jar:/usr/share/java/commons-logging.jar:/usr/share/java/commons-logging-api.jar:/usr/share/java/commons-logging-adapters.jar org.apache.axis.wsdl.WSDL2Java foo.wsdl

It's quite likely that there will be other dependencies missing; you might want to use the JarAnalyizer tool to find them and add to the classpath.

share|improve this answer
up vote 1 down vote accepted

Based on Riccardo Murri's answer, I was able to determine all the jar files required for the classpath:

java -cp /usr/share/java/axis.jar:/usr/share/java/commons-logging.jar:/usr/share/java/commons-logging-api.jar:/usr/share/java/commons-logging-adapters.jar:/usr/share/java/commons-discovery.jar:/usr/share/java/jaxrpc.jar:/usr/share/java/wsdl4j.jar org.apache.axis.wsdl.WSDL2Java foo.wsdl
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.