axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yu Liu" <y...@micromuse.com>
Subject axis Hashtable problem
Date Wed, 04 Sep 2002 16:17:23 GMT
Hi,

I could not compile the stub codes generated by Java2WSDL and WSDL2Java
tools. I guess the problem was caused by Axis' auto generated
java.util.Hashtable class. Here are my classes:

public class MyCache {
  private Hashtable caches;
  public Hashtable getCaches() {
    return caches;
  }
  public void setCaches( Hashtable table ) {
    caches = table;
  }
  public String otherMethod() {
    return "this is something else";
  }
}

public interface MyInterface {
  public MyCache getData(String name);
}

After compiled the above claesses with Java2WSDL and WSDL2Java, I got a
bunch of stub and skeleton classes, as well as an Axis generated new
java.util.Hashtable class which put in java/util/ directory. Here is the new
Hashtable:

public class Hashtable extends java.util.Dictionary  implements
java.io.Serializable {
    public Hashtable() {
    }
    private Object __equalsCalc = null;
    public synchronized boolean equals(Object obj) {
        if (!(obj instanceof Hashtable)) return false;
        Hashtable other = (Hashtable) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = super.equals(obj);
        __equalsCalc = null;
        return _equals;
    }
    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = super.hashCode();
        __hashCodeCalc = false;
        return _hashCode;
    }
    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           String mechType,
           Class _javaType,
           javax.xml.rpc.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType,null);
    };

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           String mechType,
           Class _javaType,
           javax.xml.rpc.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType,null);
    };
}

But when I tried to compile another auto generated stub class,
MyServiceSoapBingingStub.java, I got the following error:

MyServiceSoapBindingStub.java:95 can not resolve symbol  symbol: method
keys()
location: classs java.util.Enumeration keys = super.cachedProperties.keys();

Because MyServiceSoapBindingStub extends org.apache.axis.client.Stub, so its
cachedProperites field is java.util.Properties, which extends
java.util.Hashtable. Since the Axis auto generated new Hashtable class does
not have "keys()" method, so I guess the above compilation error was caused
by axis' java.util.Hashtable in the classpath.

So my questions are:  anybody has seen the similar error happened and how to
solve it? why Axis generated a new Hashtable class and put it in java.util
package instead of in some other package to avoid any naming conflict with
the original java lib's Hashtable ? Is there any other WSDL2Java command
option I can use to require Axis not to create its own Hashtable class for
serialization purpose?

Yu


Mime
View raw message