You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ji...@apache.org on 2004/03/23 11:48:58 UTC

[jira] Closed: (AXIS-1257) nullpointer exception caused by ...SOAPBindingStub.createCall

Message:

   The following issue has been closed.

   Resolver: Davanum Srinivas
       Date: Tue, 23 Mar 2004 2:47 AM

Applied Jarek's fix.
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/secure/ViewIssue.jspa?key=AXIS-1257

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1257
    Summary: nullpointer exception caused by ...SOAPBindingStub.createCall
       Type: Bug

     Status: Closed
   Priority: Major
 Resolution: FIXED

    Project: Axis
 Components: 
             WSDL processing
   Fix Fors:
             current (nightly)
   Versions:
             current (nightly)

   Assignee: 
   Reporter: Dominic Battre

    Created: Mon, 22 Mar 2004 4:06 PM
    Updated: Tue, 23 Mar 2004 2:47 AM
Environment: Gentoo Linux, blackdown-jdk 1.4.1

Description:
axis-SNAPSHOT.jar as of Jan 30 2004 produces the following exception. A current cvs version of Mar 21 2004 produces the same exceptions. I just don't want to revert my whole installation to cvs. The position where the exception is risen differs slightly. For your convenience I  have included the code snippets, where the exception is risen.

Failure trying to get the Call object; nested exception is:
        java.lang.NullPointerException
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode:
 faultString: Failure trying to get the Call object; nested exception is:
        java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:

Failure trying to get the Call object; nested exception is:
        java.lang.NullPointerException
        at
org.ggf.www.namespaces.ws_agreement.ResponderSOAPBindingStub.createCall(ResponderSOAPBindingStub.java:586)
        at
org.ggf.www.namespaces.ws_agreement.ResponderSOAPBindingStub.startNegotiation(ResponderSOAPBindingStub.java:622)
        at Test.main(Test.java:16)
Caused by: java.lang.NullPointerException
        at
org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(BaseSerializerFactory.java:270)
        at org.apache.axis.client.Call.registerTypeMapping(Call.java:2227)
        at
org.ggf.www.namespaces.ws_agreement.ResponderSOAPBindingStub.createCall(ResponderSOAPBindingStub.java:579)
        ... 2 more

ResponderSOAPBindingStub was created by WSDL2Java. The parameters of the registerTypeMapping call are:
_call.registerTypeMapping(class java.lang.Object,
{http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties}>QueryResourcePropertiesResponse, null, class org.apache.axis.encoding.ser.SimpleDeserializerFactory, false)
(just printed with System.out.println)

looking at ResponderSOAPBindingStub._initOperationDesc1() this code is generated
by WSDL2Java (current CVS version):
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("QueryResourceProperties");
        oper.addParameter(new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
"QueryResourcePropertiesRequest"), new javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
">QueryResourcePropertiesRequest"),
com.ibm.www.xmlns.stdwip.web_services.WS_ResourceProperties._QueryResourcePropertiesRequest.class,
org.apache.axis.description.ParameterDesc.IN, false, false);
        oper.setReturnType(new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
">QueryResourcePropertiesResponse"));
        oper.setReturnClass(java.lang.Object.class);
        oper.setReturnQName(new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
"QueryResourcePropertiesResponse"));
        oper.setStyle(org.apache.axis.enum.Style.DOCUMENT);
        oper.setUse(org.apache.axis.enum.Use.ENCODED);
        _operations[4] = oper;

this differs from the code that is generated by WSDL2Java (Version 1.1):
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("QueryResourceProperties");
        oper.addParameter(new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
"QueryResourcePropertiesRequest"), new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
">QueryResourcePropertiesRequest"),
com.ibm.www.xmlns.stdwip.web_services.WS_ResourceProperties._QueryResourcePropertiesRequest.class,
org.apache.axis.description.ParameterDesc.IN, false, false);
        oper.setReturnType(new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
">QueryResourcePropertiesResponse"));
       
oper.setReturnClass(com.ibm.www.xmlns.stdwip.web_services.WS_ResourceProperties._QueryResourcePropertiesResponse.class);
        oper.setReturnQName(new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
"QueryResourcePropertiesResponse"));
        oper.setStyle(org.apache.axis.enum.Style.DOCUMENT);
        oper.setUse(org.apache.axis.enum.Use.ENCODED);
        _operations[4] = oper;

And later in the constructor ResponderSOAPBindingStub(javax.xml.rpc.Service service)
Version 1.2 cvs:
            qName = new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
">QueryResourcePropertiesResponse");
            cachedSerQNames.add(qName);
            cls = java.lang.Object.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(null);
            cachedDeserFactories.add(simpledf);

Version 1.1:
            qName = new
javax.xml.namespace.QName("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties",
">QueryResourcePropertiesResponse");
            cachedSerQNames.add(qName);
            cls =
com.ibm.www.xmlns.stdwip.web_services.WS_ResourceProperties._QueryResourcePropertiesResponse.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);


This is what the imported schema looks like:

<wsdl:definitions name="WS-ResourceProperties"
  xmlns="http://schemas.xmlsoap.org/wsdl/" ...>
  ...
         <xsd:element name="QueryResourcePropertiesResponse" >
         <xsd:complexType>
           <xsd:complexContent mixed="true">
             <xsd:restriction base="xsd:anyType">
               <xsd:sequence>
                 <xsd:any processContents="lax"
                          minOccurs="1" maxOccurs="unbounded"/>
               </xsd:sequence>
             </xsd:restriction>
           </xsd:complexContent>
         </xsd:complexType>
       </xsd:element>
   ...
  <wsdl:message name="QueryResourcePropertiesResponse">
    <wsdl:part name="QueryResourcePropertiesResponse"
               element="wsrp:QueryResourcePropertiesResponse" />
  </wsdl:message>
   ...
  <wsdl:portType name="QueryResourceProperties">
    <wsdl:operation name="QueryResourceProperties">
      <wsdl:input  name="QueryResourcePropertiesRequest"
                   message="wsrp:QueryResourcePropertiesRequest" />
      <wsdl:output name="QueryResourcePropertiesResponse"
                   message="wsrp:QueryResourcePropertiesResponse" />
      <wsdl:fault  name="ResourceUnknownFault"
                   message="wsrp:ResourceUnknownFault" />
      <wsdl:fault  name="InvalidResourcePropertyQNameFault"
                   message="wsrp:InvalidResourcePropertyQNameFault" />
      <wsdl:fault  name="UnknownQueryExpressionDialectFault"
                   message="wsrp:UnknownQueryExpressionDialectFault" />
      <wsdl:fault  name="InvalidQueryExpressionFault"
                   message="wsrp:InvalidQueryExpressionFault" />
      <wsdl:fault  name="QueryEvaluationErrorFault"
                   message="wsrp:QueryEvaluationErrorFault" />
    </wsdl:operation>

  </wsdl:portType>

And these are the the locations that raise the exception:

_call.registerTypeMapping(class java.lang.Object,
{http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties}>QueryResourcePropertiesResponse,
null, class org.apache.axis.encoding.ser.SimpleDeserializerFactory, false)

org.apache.axis.client.Call.registerTypeMapping(Call.java:2227):

    public void registerTypeMapping(Class javaType,
                                    QName xmlType,
                                    Class sfClass,
                                    Class dfClass,
                                    boolean force) {
        // Instantiate the factory using introspection.
        SerializerFactory   sf =
                BaseSerializerFactory.createFactory(sfClass, javaType, xmlType); // <- here
        DeserializerFactory df =
                BaseDeserializerFactory.createFactory(dfClass,
                                                      javaType,
                                                      xmlType);
        if (sf != null || df != null) {
            registerTypeMapping(javaType, xmlType, sf, df, force);
        }
    }

org.apache.axis.encoding.ser.BaseSerializerFactory.createFactory(BaseSerializerFactory.java:270):

    public static SerializerFactory createFactory(Class factory, 
                                                  Class javaType, 
                                                  QName xmlType) {

        SerializerFactory sf = null;
        try {
            Method method = 
                factory.getMethod("create", CLASS_QNAME_CLASS); // <- here
            sf = (SerializerFactory) 
                method.invoke(null, 
                              new Object[] {javaType, xmlType});



FWIW: The following patch "fixes" the problem but I don't know how many new ones are created as I don't understand the code ;-)

cvs server: Diffing .
Index: JavaStubWriter.java
===================================================================
RCS file:
/home/cvspublic/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.129
diff -U2 -r1.129 JavaStubWriter.java
--- JavaStubWriter.java 25 Feb 2004 14:02:52 -0000      1.129
+++ JavaStubWriter.java 22 Mar 2004 22:49:45 -0000
@@ -961,5 +961,5 @@
             // will be checked, the end delegate is DefaultTypeMappingImpl
             // that'll get it right with the base type name
-            pw.println("            cachedSerFactories.add(null);");
+            pw.println("            cachedSerFactories.add(simplesf);");
             pw.println("            cachedDeserFactories.add(simpledf);");
         } else {


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira