You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tony Chen <to...@ca.ibm.com> on 2005/05/20 16:32:00 UTC

Axis V1.0 - java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl




Hi Everyone,

This is my first email to axis-user. We are using axis.jar V1.0 in order to
access a 3rd-party software. Our system is running fine in production until
a few days later, we got the following error:

java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl:
AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.generalException
 faultString: Error invoking operation:
java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
 faultActor: null
 faultDetail:
      stackTrace: AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.generalException
 faultString: Error invoking operation:
java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
 faultActor: null
 faultDetail:

Error invoking operation:
java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
      at org.apache.axis.client.Call.invoke(Call.java:1329)
      at com.actuate.schemas.ActuateSoapBindingStub.login(Unknown Source)
      at com.ibm.sis.util.ActuateHelper.getProxyForUser(Unknown Source)
...

I downloaded the source code for Axis v1.0 and the line 1329 of Call.java
is "return this.invoke(params);" in method "public Object invoke(QName
operationName, Object[] params)"

1324    public Object invoke(QName operationName, Object[] params)
1325      throws java.rmi.RemoteException {
1326        QName origOpName = this.operationName;
1327        this.operationName = operationName;
1328        try {
1329            return this.invoke(params);
1330        }
1331        catch (java.rmi.RemoteException re) {
1332            this.operationName = origOpName;
1333            throw re;
1334        }
1335        catch (RuntimeException re) {
1336            this.operationName = origOpName;
1337            throw re;
1338        }
1339        catch (Error e) {
1340            this.operationName = origOpName;
1341            throw e;
1342        }
1343    } // invoke

Can anyone please give me a hand on why this is happening? The interesting
thing is everything runs okay in development and test systems. The
ClassCastException only happens in production system after it has been
running for a few day. To recover from the problem, we have to restart the
app server.

Best regards,

Tony Chen

SUN Certified Java 2 Programmer
IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0
Canadian Securities Course (CSC) Certification

Securities Industry Services, IBM Global Services
phone: 416-478-5852
e-mail: tonychen@ca.ibm.com


Re: Axis V1.0 - java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl

Posted by Davanum Srinivas <da...@gmail.com>.
please don't use Axis 1.0. latest is Axis 1.2

-- dims

On 5/20/05, Tony Chen <to...@ca.ibm.com> wrote:
> Hi,
> 
> I made a mistake in my last email. The line 1329 is actually within method
> invoke(Object[] params)
> 
> 1329            throw new AxisFault( Messages.getMessage("errorInvoking00",
> "\n" + exp) );
> 
> So, the ClassCastException was actually thrown in the try (starting at line
> 1314) block and caught by the catch block at line 1326.
> 
> But can anyone tell me where is org.apache.axis.attachments.AttachmentsImpl
> used and casted in this invoke(Object[] params) method? I was debugging
> this code in WSAD, and found the params Object array always contains one
> object of Login. I can't think of anything different by the way we call
> this invoke() method. Puzzled!
> 
> The full method:
> 
>     public Object invoke(Object[] params) throws java.rmi.RemoteException {
>         long t0=0, t1=0;
>         if( tlog.isDebugEnabled() ) {
>             t0=System.currentTimeMillis();
>         }
>         /* First see if we're dealing with Messaging instead of RPC.
> */
>         /* If ALL of the params are SOAPBodyElements then we're doing
> */
>         /* Messaging, otherwise just fall through to normal RPC processing.
> */
> 
> /********************************************************************/
>         SOAPEnvelope  env = null ;
>         int i ;
> 
>         for ( i = 0 ; params != null && i < params.length ; i++ )
>             if ( !(params[i] instanceof SOAPBodyElement) ) break ;
> 
>         if ( params != null && params.length > 0 && i == params.length ) {
>             /* ok, we're doing Messaging, so build up the message */
>             /******************************************************/
>             isMsg = true ;
>             env = new SOAPEnvelope(msgContext.getSOAPConstants());
> 
>             if ( !(params[0] instanceof SOAPEnvelope) )
>                 for ( i = 0 ; i < params.length ; i++ )
>                     env.addBodyElement( (SOAPBodyElement) params[i] );
> 
>             Message msg = new Message( env );
>             setRequestMessage(msg);
> 
>             invoke();
> 
>             msg = msgContext.getResponseMessage();
>             if (msg == null) {
>               if (FAULT_ON_NO_RESPONSE) {
>                 throw new AxisFault(Messages.getMessage("nullResponse00"));
>               } else {
>                 return null;
>               }
>             }
> 
>             env = msg.getSOAPEnvelope();
>             return( env.getBodyElements() );
>         }
> 
> 
> 1312        if ( operationName == null )
> 1313            throw new AxisFault( Messages.getMessage("noOperation00")
> );
> 1314        try {
> 1315            Object res=this.invoke(operationName.getNamespaceURI(),
> 1316                    operationName.getLocalPart(), params);
> 1317            if( tlog.isDebugEnabled() ) {
> 1318                t1=System.currentTimeMillis();
> 1319                tlog.debug("axis.Call.invoke: " + (t1-t0)  + " " +
> operationName);
> 1320            }
> 1321            return res;
> 1322        }
> 1323        catch( AxisFault af) {
> 1324            throw af;
> 1325        }
> 1326        catch( Exception exp ) {
> 1327            //if ( exp instanceof AxisFault ) throw (AxisFault) exp ;
> 1328            entLog.info(Messages.getMessage("toAxisFault00"), exp);
> 1329            throw new AxisFault( Messages.getMessage("errorInvoking00",
> "\n" + exp) );
> 1330        }
> 1331    }
> 
> Tony Chen
> 
> SUN Certified Java 2 Programmer
> IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0
> Canadian Securities Course (CSC) Certification
> 
> Securities Industry Services, IBM Global Services
> phone: 416-478-5852
> e-mail: tonychen@ca.ibm.com
> 
> 
> 
> 
>              Tony
>              Chen/Toronto/IBM@
>              IBMCA                                                      To
>                                        axis-user@ws.apache.org
>              05/20/2005 10:32                                           cc
>              AM
>                                                                    Subject
>                                        Axis V1.0 -
>              Please respond to         java.lang.ClassCastException:
>                  axis-user             org.apache.axis.attachments.Attachm
>                                        entsImpl
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Hi Everyone,
> 
> This is my first email to axis-user. We are using axis.jar V1.0 in order to
> access a 3rd-party software. Our system is running fine in production until
> a few days later, we got the following error:
> 
> java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl:
> AxisFault
>  faultCode: {http://xml.apache.org/axis/}Server.generalException
>  faultString: Error invoking operation:
> java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
>  faultActor: null
>  faultDetail:
>       stackTrace: AxisFault
>  faultCode: {http://xml.apache.org/axis/}Server.generalException
>  faultString: Error invoking operation:
> java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
>  faultActor: null
>  faultDetail:
> 
> Error invoking operation:
> java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
>       at org.apache.axis.client.Call.invoke(Call.java:1329)
>       at com.actuate.schemas.ActuateSoapBindingStub.login(Unknown Source)
>       at com.ibm.sis.util.ActuateHelper.getProxyForUser(Unknown Source)
> ...
> 
> I downloaded the source code for Axis v1.0 and the line 1329 of Call.java
> is "return this.invoke(params);" in method "public Object invoke(QName
> operationName, Object[] params)"
> 
> 1324    public Object invoke(QName operationName, Object[] params)
> 1325      throws java.rmi.RemoteException {
> 1326        QName origOpName = this.operationName;
> 1327        this.operationName = operationName;
> 1328        try {
> 1329            return this.invoke(params);
> 1330        }
> 1331        catch (java.rmi.RemoteException re) {
> 1332            this.operationName = origOpName;
> 1333            throw re;
> 1334        }
> 1335        catch (RuntimeException re) {
> 1336            this.operationName = origOpName;
> 1337            throw re;
> 1338        }
> 1339        catch (Error e) {
> 1340            this.operationName = origOpName;
> 1341            throw e;
> 1342        }
> 1343    } // invoke
> 
> Can anyone please give me a hand on why this is happening? The interesting
> thing is everything runs okay in development and test systems. The
> ClassCastException only happens in production system after it has been
> running for a few day. To recover from the problem, we have to restart the
> app server.
> 
> Best regards,
> 
> Tony Chen
> 
> SUN Certified Java 2 Programmer
> IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0
> Canadian Securities Course (CSC) Certification
> 
> Securities Industry Services, IBM Global Services
> phone: 416-478-5852
> e-mail: tonychen@ca.ibm.com
> 
> 
> 
> 


-- 
Davanum Srinivas - http://webservices.apache.org/~dims/

Re: Axis V1.0 - java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl

Posted by Tony Chen <to...@ca.ibm.com>.
Hi,

I made a mistake in my last email. The line 1329 is actually within method
invoke(Object[] params)

1329            throw new AxisFault( Messages.getMessage("errorInvoking00",
"\n" + exp) );

So, the ClassCastException was actually thrown in the try (starting at line
1314) block and caught by the catch block at line 1326.

But can anyone tell me where is org.apache.axis.attachments.AttachmentsImpl
used and casted in this invoke(Object[] params) method? I was debugging
this code in WSAD, and found the params Object array always contains one
object of Login. I can't think of anything different by the way we call
this invoke() method. Puzzled!

The full method:

    public Object invoke(Object[] params) throws java.rmi.RemoteException {
        long t0=0, t1=0;
        if( tlog.isDebugEnabled() ) {
            t0=System.currentTimeMillis();
        }
        /* First see if we're dealing with Messaging instead of RPC.
*/
        /* If ALL of the params are SOAPBodyElements then we're doing
*/
        /* Messaging, otherwise just fall through to normal RPC processing.
*/

/********************************************************************/
        SOAPEnvelope  env = null ;
        int i ;

        for ( i = 0 ; params != null && i < params.length ; i++ )
            if ( !(params[i] instanceof SOAPBodyElement) ) break ;

        if ( params != null && params.length > 0 && i == params.length ) {
            /* ok, we're doing Messaging, so build up the message */
            /******************************************************/
            isMsg = true ;
            env = new SOAPEnvelope(msgContext.getSOAPConstants());

            if ( !(params[0] instanceof SOAPEnvelope) )
                for ( i = 0 ; i < params.length ; i++ )
                    env.addBodyElement( (SOAPBodyElement) params[i] );

            Message msg = new Message( env );
            setRequestMessage(msg);

            invoke();

            msg = msgContext.getResponseMessage();
            if (msg == null) {
              if (FAULT_ON_NO_RESPONSE) {
                throw new AxisFault(Messages.getMessage("nullResponse00"));
              } else {
                return null;
              }
            }

            env = msg.getSOAPEnvelope();
            return( env.getBodyElements() );
        }


1312        if ( operationName == null )
1313            throw new AxisFault( Messages.getMessage("noOperation00")
);
1314        try {
1315            Object res=this.invoke(operationName.getNamespaceURI(),
1316                    operationName.getLocalPart(), params);
1317            if( tlog.isDebugEnabled() ) {
1318                t1=System.currentTimeMillis();
1319                tlog.debug("axis.Call.invoke: " + (t1-t0)  + " " +
operationName);
1320            }
1321            return res;
1322        }
1323        catch( AxisFault af) {
1324            throw af;
1325        }
1326        catch( Exception exp ) {
1327            //if ( exp instanceof AxisFault ) throw (AxisFault) exp ;
1328            entLog.info(Messages.getMessage("toAxisFault00"), exp);
1329            throw new AxisFault( Messages.getMessage("errorInvoking00",
"\n" + exp) );
1330        }
1331    }

Tony Chen

SUN Certified Java 2 Programmer
IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0
Canadian Securities Course (CSC) Certification

Securities Industry Services, IBM Global Services
phone: 416-478-5852
e-mail: tonychen@ca.ibm.com



                                                                           
             Tony                                                          
             Chen/Toronto/IBM@                                             
             IBMCA                                                      To 
                                       axis-user@ws.apache.org             
             05/20/2005 10:32                                           cc 
             AM                                                            
                                                                   Subject 
                                       Axis V1.0 -                         
             Please respond to         java.lang.ClassCastException:       
                 axis-user             org.apache.axis.attachments.Attachm 
                                       entsImpl                            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           








Hi Everyone,

This is my first email to axis-user. We are using axis.jar V1.0 in order to
access a 3rd-party software. Our system is running fine in production until
a few days later, we got the following error:

java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl:
AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.generalException
 faultString: Error invoking operation:
java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
 faultActor: null
 faultDetail:
      stackTrace: AxisFault
 faultCode: {http://xml.apache.org/axis/}Server.generalException
 faultString: Error invoking operation:
java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
 faultActor: null
 faultDetail:

Error invoking operation:
java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl
      at org.apache.axis.client.Call.invoke(Call.java:1329)
      at com.actuate.schemas.ActuateSoapBindingStub.login(Unknown Source)
      at com.ibm.sis.util.ActuateHelper.getProxyForUser(Unknown Source)
...

I downloaded the source code for Axis v1.0 and the line 1329 of Call.java
is "return this.invoke(params);" in method "public Object invoke(QName
operationName, Object[] params)"

1324    public Object invoke(QName operationName, Object[] params)
1325      throws java.rmi.RemoteException {
1326        QName origOpName = this.operationName;
1327        this.operationName = operationName;
1328        try {
1329            return this.invoke(params);
1330        }
1331        catch (java.rmi.RemoteException re) {
1332            this.operationName = origOpName;
1333            throw re;
1334        }
1335        catch (RuntimeException re) {
1336            this.operationName = origOpName;
1337            throw re;
1338        }
1339        catch (Error e) {
1340            this.operationName = origOpName;
1341            throw e;
1342        }
1343    } // invoke

Can anyone please give me a hand on why this is happening? The interesting
thing is everything runs okay in development and test systems. The
ClassCastException only happens in production system after it has been
running for a few day. To recover from the problem, we have to restart the
app server.

Best regards,

Tony Chen

SUN Certified Java 2 Programmer
IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0
Canadian Securities Course (CSC) Certification

Securities Industry Services, IBM Global Services
phone: 416-478-5852
e-mail: tonychen@ca.ibm.com