aspose file tools*
The moose likes Web Services and the fly likes Problem in running Fibonacci Web Service Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem in running Fibonacci Web Service Example" Watch "Problem in running Fibonacci Web Service Example" New topic
Author

Problem in running Fibonacci Web Service Example

Mike Thomson
Ranch Hand

Joined: Nov 07, 2007
Posts: 115
I am trying the web services example from this site and following the instructions as per this site:
http://www.onjava.com/lpt/a/1578

I am trying the fibonacci example:

I have created a separate folder in D:\fibonacci and placed my Fibonacci.java and FibonacciImpl.java and complied it successfully and placed the class files are also in the same folder.
Now I want to generate the WSDL from java and I have used the following cmd and I am getting this error:


D:\>java -cp %AXISCLASSPATH% org.apache.axis.wsdl.Java2WSDL -o fib.wsdl -l"http
://localhost:8080/axis/services/fibonacci" -n urn:fibonacci -p"fibonacci" urn:fi
bonacci fibonacci.Fibonacci
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/wsdl/extensions
/ExtensibilityElement
at org.apache.axis.wsdl.Java2WSDL.createEmitter(Java2WSDL.java:279)
at org.apache.axis.wsdl.Java2WSDL.<init>(Java2WSDL.java:270)
at org.apache.axis.wsdl.Java2WSDL.main(Java2WSDL.java:680)

My Classpath Settings:

AXIS_HOME = D:\axis-1_4
AXIS_LIB = %AXIS_HOME%\lib
AXISCLASSPATH = %AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery-0.2.jar;%AXIS_LIB%\commons-logging-1.0.4.jar;
%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\activation.jar;
%AXIS_LIB%\mailapi.jar;
JAVA_HOME = D:\Program Files\Java\jdk1.5.0_01
PATH = D:\Program Files\Java\jdk1.5.0_01\bin
CLASSPATH = .;D:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;D:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;
D:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;D:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;
D:\PROGRA~1\IBM\SQLLIB\bin;D:\PROGRA~1\IBM\SQLLIB\java\common.jar

[ November 13, 2007: Message edited by: Mike Thomson ]

[ UD: inserted newlines to keep the layout intact ]
[ November 13, 2007: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
The Axis versions I have seen come with a library called "wsdl4j-X.Y.Z.jar" which contains those classes. Your AXISCLASSPATH seems to be missing that jar.


Ping & DNS - updated with new look and Ping home screen widget
Mike Thomson
Ranch Hand

Joined: Nov 07, 2007
Posts: 115
Thanks for your reply and it's compiling now and I can able to generate the WSDL.

After deploying the fib.jar,I have gone to see whether my java program is being exposed as services, but it's displying the follwing error:


I am having all the class files generated in D:\fibonacci\ws


But, when I tried to call the service I am getting this error:

[ November 13, 2007: Message edited by: Mike Thomson ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Is the FibonacciSoapBindingImpl.class file inside a directory called "fibonacci/ws/" in the jar file? Have you restarted Axis after re-deploying the jar file?

As to the second problem, check the source code whether the class of object "service" has a method called "getFibonacci()".
Mike Thomson
Ranch Hand

Joined: Nov 07, 2007
Posts: 115
After restarting the tomcat server I am getting the below error:



How to resolve it? I can't able to Validate,List the services..
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
  • Is your CATALINA_HOME environment variable set to your Tomcat deployment directory? e.g. CATALINA_HOME=C:\etc\tomcat55 (at the system level: Control Panel -> System -> Advanced -> Environment Variables)
  • There is no need for having "D:\Program Files\Java\jdk1.5.0_01\bin" twice in your PATH.
  • The variables indicate that you have Java 1.5 deployed - yet Tomcat seems to be directed to get the Crimson XML parser (Xerces is the Java 1.5 XML parser - also Xerces is preferred by Apache)


  • Something seems to be setting the javax.xml.parsers.DocumentFactory property to "org.apache.crimson.jaxp.DocumentBuilderFactory" and then none of the jars in the CLASSPATH have it. Sun's Java 1.5 deployment has "com.sun.org.apache.xerces.internal.jaxp.DocumentFactoryImpl" in rt.jar (which is automatically loaded).

    Elliotte Rusty Harold: How JAXP chooses Parsers

    (maybe whatever installed those D:\Program Files\IBM\sqllib jars modified the default parser without including the parser in the CLASSPATH - "org.apache.crimson.jaxp.DocumentBuilderFactory" is in the Java 1.4 rt.jar, so there would be no jar for it in the class path)

    When you want to start up Tomcat, open a console window and change directory to the bin directory, e.g. C:\etc\tomcat55\bin and run the startup.bat script; to shut Tomcat down in an orderly fashion run the shutdown.bat script in the same directory.

    I would also include the AXISCLASSPATH in the CLASSPATH e.g.: .;%AXISCLASSPATH%;


    "Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
    Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
    Mike Thomson
    Ranch Hand

    Joined: Nov 07, 2007
    Posts: 115
    Yes, Your right the problem is due to Crimson.jar. I have tried to enable the SOAP Monitor which asks for compilation of SOAPMonitorApllet.java and while compiling it gives error NoClassDefFoundExcpetion and I have searched for the Node class in goolge and it seenms to be in Crimson.jar. Now i hane removed the crimson.jar and i can able to start the tomcat server and now I can't able to deploy it and I am getting the following error:

    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    Where did you get that activation.jar? The one from here works with the Sun Java 1.5 SDK.
    Mike Thomson
    Ranch Hand

    Joined: Nov 07, 2007
    Posts: 115
    I have downloaded the activation.jar from the same site mentioned by you (jaf-1_1_1). First time, I have not encountered this problem and i was able to deploy and after while I am trying to enable the SOAP monitor, I can't able to deploy. I have downloaded one additional crimson.jar and it caused the tomact server error and i removed that, but now i am facing the same problem:


    My Env variables:



    Jars used in D:\axis-1_4\webapps\axis\WEB-INF\lib



    Any help..?

    [ UD: added a few linebreaks to prevent horizontal scrolling ]
    [ November 15, 2007: Message edited by: Ulf Dittmer ]
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    It simply makes no sense that Tomcat is trying to access the crimson parser - it could suggest that a 1.4 JRE is getting fired up somewhere (try a "java -version" at the command prompt where you start Tomcat). There could still be an old java.exe in C:\WINDOWS\system32 or one of the other directories listed in your path.

    At this point I'd be tempted to strip out the existing Java SDK environment(s) and install the JDK 5.0 Update 14.
    [ November 15, 2007: Message edited by: Peer Reynders ]
     
    Don't get me started about those stupid light bulbs.
     
    subject: Problem in running Fibonacci Web Service Example
     
    Similar Threads
    Problem with Sample application Fibonacci
    Is this wsdl somehow wrong? - Help please!
    Java2WSDL in AXIS 1.4 - java.lang.NoClassDefFoundError
    Web service - NoClassDefFoundError exception
    Axis webservice access ASP.NET client