GeeCON Prague 2014*
The moose likes Web Services and the fly likes Getting problem while creating Java client from command prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "Getting problem while creating Java client from command prompt" Watch "Getting problem while creating Java client from command prompt" New topic
Author

Getting problem while creating Java client from command prompt

Pradeep Chaubey
Greenhorn

Joined: Jun 15, 2009
Posts: 20
Hello everyone,

I am trying to create a java client for a web service. I have wsdl file. I am running following commands from a batch file
set AXIS_HOME=C:\axis
set CLASSPATH=%CLASSPATH%;%AXIS_HOME%\lib\wsdl4j-1.5.1.jar
set CLASSPATH=%CLASSPATH%;%AXIS_HOME\lib\commons-logging-1.0.4.jar
set CLASSPATH=%CLASSPATH%;%AXIS_HOME%\lib\commons-discovery-0.2.jar
set CLASSPATH=%CLASSPATH%;%AXIS_HOME%\lib\jaxrpc.jar
set CLASSPATH=%CLASSPATH%;%AXIS_HOME%\lib\saaj.jar
set CLASSPATH=%CLASSPATH%;%AXIS_HOME%\lib\axis.jar
java -classpath %CLASSPATH% org.apache.axis.wsdl.WSDL2Java -v -o d:\generate C:\axis\PQSSProvisioning.wsdl


I am getting following Exception

C:\Program Files\Java\jdk1.5.0\bin>java -classpath ;C:\axis\lib\wsdl4j-1.5.1.jar
;AXIS_HOME\lib\commons-logging-1.0.4.jar;C:\axis\lib\commons-discovery-0.2.jar;C
:\axis\lib\jaxrpc.jar;C:\axis\lib\saaj.jar;C:\axis\lib\axis.jar org.apache.axis.
wsdl.WSDL2Java -v -o d:\generate C:\axis\PQSSProvisioning.wsdl
Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.commons.lo
gging.LogFactory
at org.apache.axis.components.logger.LogFactory.class$(LogFactory.java:4
5)
at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45
)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory
.java:41)
at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java
:33)
at org.apache.axis.i18n.ProjectResourceBundle.<clinit>(ProjectResourceBu
ndle.java:53)
at org.apache.axis.i18n.MessagesConstants.<clinit>(MessagesConstants.jav
a:32)
at org.apache.axis.utils.Messages.<clinit>(Messages.java:36)
at org.apache.axis.wsdl.WSDL2Java.<clinit>(WSDL2Java.java:112)

Please someone help me out, I am new to web service. Please suggest me some solution to create java client for the web service.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
It looks like you are missing the commons/logging JAR on your classpath.
The class org.apache.commons.logging.LogFactory is not found.
I see that you have included it on your classpath - is there some conflict somewhere?
Best wishes!
Pradeep Chaubey
Greenhorn

Joined: Jun 15, 2009
Posts: 20
Hi Ivan,

I have eclipse 3.4 installed on my machine. As far as conflict is concerned, what it could be. I am unable to resolve. Please help.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hello!
Try looking at the following options instead of fiddling around with a batch file:
- Command line or Ant task: http://ws.apache.org/axis2/tools/1_4_1/CodegenToolReference.html
- The Axis Eclipse plugin: http://ws.apache.org/axis2/tools/1_4_1/eclipse/wsdl2java-plugin.html
- Maven WSDL2Java plugin: http://ws.apache.org/axis2/tools/1_4_1/maven-plugins/maven-wsdl2code-plugin.html

Since you are already using Eclipse, the plugin is, most likely, the easiest alternative.

Check JBoss Tattletale for a tool that can:
* Identify dependencies between JAR files
* Find missing classes from the classpath
* Spot if a class is located in multiple JAR files
* Spot if the same JAR file is located in multiple locations
* With a list of what each JAR file requires and provides
* Verify the SerialVersionUID of a class
* Find similar JAR files that have different version numbers
* Find JAR files without a version number
* Locate a class in a JAR file
* Get the OSGi status of your project
* Remove black listed API usage

Link: http://www.jboss.org/tattletale
Best wishes!
Rory Sambrano
Greenhorn

Joined: Nov 17, 2009
Posts: 1
you missed the close % of AXIS_HOME

set CLASSPATH=%CLASSPATH%;%AXIS_HOME\lib\commons-logging-1.0.4.jar

change to

set CLASSPATH=%CLASSPATH%;%AXIS_HOME%\lib\commons-logging-1.0.4.jar
 
GeeCON Prague 2014
 
subject: Getting problem while creating Java client from command prompt