I'm guessing the class name should be "myapp.StockQuoteService".  Also
make sure that your package structure matches your directory structure,
so you have a "myapp" directory that resides in the current directory,
and the "myapp" directory contains the "StockQuoteService.class" file.
 
This is just a simple example, but generally doing something like "-cp
." is odd. You probably don't want to run this from the root of your
class tree, you want to reference the class tree directory, but do it
somewhere else.


________________________________

        From: shekhar bhat [mailto:[EMAIL PROTECTED] 
        Sent: Tuesday, August 07, 2007 5:17 PM
        To: [email protected]
        Subject: Re: java.lang.NoClassDefFoundError while using
java2wsdl
        
        

                HEllo,
                 
                I'm trying to create WSDL for the simple java program
below. 
                 
                package myapp;
                import java.util.HashMap;
                public class StockQuoteService {
                    private HashMap map = new HashMap();
                    public double getPrice(String symbol) {
                        Double price = (Double) map.get(symbol);
                        if(price != null){
                            return price.doubleValue();
                        }
                        return 42.00;
                    }
                    public void update(String symbol, double price) {
                        map.put(symbol, new Double(price));
                    }
                }
                 
                I compiled it to generate the class file and tried
creating the WSDL file. I get the errors below. It works if the first
line (package myapp) is commented. with package, prefixing class name
with "myapp" also gives an error. 
                 
                E:\Program Files\Apache Software
Foundation\axis2-1.2\samples\mytest>java2wsdl -
                cp . -cn StockQuoteService
                Using AXIS2_HOME:   E:\Program Files\Apache Software
Foundation\axis2-1.2
                Using JAVA_HOME:    E:\Program Files\Java\jdk1.5.0_06
                Exception in thread "main"
java.lang.NoClassDefFoundError: StockQuoteService (wr
                ong name: myapp/StockQuoteService)
                        at java.lang.ClassLoader.defineClass1(Native
Method)
                        at
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
                        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
                4)
                        at
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
                 
                 
                Can some one tell what am I doing wrong? 
                 
                Regards
                --Shekhar
________________________________

                Luggage? GPS? Comic books? 
                Check out fitting gifts for grads
<http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni
_on_mail&p=graduation+gifts&cs=bz>  at Yahoo! Search.


        
________________________________

        Yahoo! oneSearch: Finally, mobile search that gives answers
<http://us.rd.yahoo.com/evt=48252/*http://mobile.yahoo.com/mobileweb/one
search?refer=1ONXIC> , not web links. 

Reply via email to