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 ax...@ws.apache.org on 2004/09/28 21:54:32 UTC

[jira] Created: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Tue, 28 Sep 2004 12:53 PM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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


[jira] Commented: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by ax...@ws.apache.org.
The following comment has been added to this issue:

     Author: David Green
    Created: Tue, 28 Sep 2004 1:09 PM
       Body:
Ok, the fix doesn't work.  Here's a new version that does:

    protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (InvocationTargetException ite) {
            Throwable cause = ite.getCause();
            if (cause instanceof java.rmi.ServerException) {
                throw new InvocationTargetException(((ServerException)cause).getCause());
            }
            throw ite;
        } catch (java.rmi.ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1577?page=comments#action_53471

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Tue, 28 Sep 2004 1:09 PM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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


[jira] Resolved: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-1577?page=history ]
     
Davanum Srinivas resolved AXIS-1577:
------------------------------------

    Resolution: Fixed

Applied Patch.

thanks,
dims

> EJBProvider doesn't handle java.rmi.ServerException
> ---------------------------------------------------
>
>          Key: AXIS-1577
>          URL: http://issues.apache.org/jira/browse/AXIS-1577
>      Project: Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: current (nightly)
>  Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05
>     Reporter: David Green

>
> java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.
> The EJBProvider should override invokeMethod as follows:
> protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
>         try {
>             return super.invokeMethod(msgContext, method, obj, argValues);
>         } catch (ServerException serverException) {
>             throw (RuntimeException) serverException.getCause();
>         }
>     }
> This will ensure that the original exception is handled properly according to the type mappings.

-- 
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


[jira] Commented: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by ax...@ws.apache.org.
The following comment has been added to this issue:

     Author: Davanum Srinivas
    Created: Thu, 14 Oct 2004 1:52 PM
       Body:
David,

getCause does not work in JDK1.3...Any workarounds?

thanks,
dims
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1577?page=comments#action_54100

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Thu, 14 Oct 2004 1:52 PM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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


[jira] Commented: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by ax...@ws.apache.org.
The following comment has been added to this issue:

     Author: Davanum Srinivas
    Created: Thu, 14 Oct 2004 3:11 PM
       Body:
That was quick...Have you tested it (at least in your jdk1.4 env) ? :)

-- dims
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1577?page=comments#action_54113

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Thu, 14 Oct 2004 3:11 PM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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


[jira] Commented: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by ax...@ws.apache.org.
The following comment has been added to this issue:

     Author: Davanum Srinivas
    Created: Thu, 14 Oct 2004 3:53 PM
       Body:
yes, please.

-- dims
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1577?page=comments#action_54115

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Thu, 14 Oct 2004 3:53 PM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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


[jira] Commented: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by ax...@ws.apache.org.
The following comment has been added to this issue:

     Author: David Green
    Created: Thu, 14 Oct 2004 3:29 PM
       Body:
:) No... not tested.  The previous version was tested over 1.4.  Would you like me to test/verify the suggested fix?  
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1577?page=comments#action_54114

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Thu, 14 Oct 2004 3:29 PM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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


[jira] Commented: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by ax...@ws.apache.org.
The following comment has been added to this issue:

     Author: David Green
    Created: Fri, 22 Oct 2004 8:32 AM
       Body:
I've tested now over JDK 1.4, and it works well.  Here's the source modifications that I ended up with:


    /**
     * Override the default implementation such that we can include
     * special handling for {@link java.rmi.ServerException}.
     * <p>
     * Converts {@link java.rmi.ServerException} exceptions to 
     * {@link InvocationTargetException} exceptions with the same cause.
     * This allows the axis framework to create a SOAP fault.
     * </p>
     * 
     * @see org.apache.axis.providers.java.RPCProvider#invokeMethod(org.apache.axis.MessageContext, java.lang.reflect.Method, java.lang.Object, java.lang.Object[])
     */
    protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (InvocationTargetException ite) {
            Throwable cause = getCause(ite);
            if (cause instanceof java.rmi.ServerException) {
                throw new InvocationTargetException(getCause(cause));
            }
            throw ite;
        }
    }
    
    /**
     * Get the cause of an exception, using reflection so that
     * it still works under JDK 1.3
     * 
     * @param original the original exception
     * 
     * @return the cause of the exception, or the given exception if the cause cannot be discovered.
     */
    private Throwable getCause(Throwable original) {
        try {
            Method method = original.getClass().getMethod("getCause",null);
            Throwable cause = (Throwable) method.invoke(original,null);
            if (cause != null) {
                return cause;
            }
        } catch (NoSuchMethodException nsme) {
            // ignore, this occurs under JDK 1.3
        } catch (Throwable t) {}
        return original;
    }
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1577?page=comments#action_54496

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Fri, 22 Oct 2004 8:32 AM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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


[jira] Commented: (AXIS-1577) EJBProvider doesn't handle java.rmi.ServerException

Posted by ax...@ws.apache.org.
The following comment has been added to this issue:

     Author: David Green
    Created: Thu, 14 Oct 2004 2:19 PM
       Body:
How about something like this:



    /* (non-Javadoc)
     * @see org.apache.axis.providers.java.RPCProvider#invokeMethod(org.apache.axis.MessageContext, java.lang.reflect.Method, java.lang.Object, java.lang.Object[])
     */
    protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (InvocationTargetException ite) {
            Throwable cause = getCause(ite);
            if (cause instanceof java.rmi.ServerException) {
                throw new InvocationTargetException(getCause(cause));
            }
            throw ite;
        } catch (java.rmi.ServerException serverException) {
            Throwable cause = getCause(serverException);
            if (cause instanceof Exception) {
                throw (Exception) cause;
            } else if (cause instanceof RuntimeException) {                
                throw (Exception) cause;
            }
            throw serverException;
        }
    }
    
    /**
     * Get the cause of an exception, using reflection so that
     * it still works under JDK 1.3
     * 
     * @param original the original exception
     * 
     * @return the cause of the exception, or the given exception if the cause cannot be discovered.
     */
    private Throwable getCause(Throwable original) {
        try {
            Method method = original.getClass().getMethod("getCause",null);
            Throwable cause = (Throwable) method.invoke(original,null);
            if (cause != null) {
                return cause;
            }
        } catch (NoSuchMethodException nsme) {
            // ignore, this occurs under JDK 1.3
        }
        return original;
    }
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1577?page=comments#action_54108

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1577

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1577
    Summary: EJBProvider doesn't handle java.rmi.ServerException
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture
   Versions:
             current (nightly)

   Assignee: 
   Reporter: David Green

    Created: Tue, 28 Sep 2004 12:53 PM
    Updated: Thu, 14 Oct 2004 2:19 PM
Environment: All OS, J2EE 1.3 (JBoss 3.2.3) using JDK 1.4.2_05

Description:
java.rmi.ServerException is thrown when a RuntimeException is thrown.  Since the original exception is wrapped in a ServerException, the SOAP fault is not created properly.

The EJBProvider should override invokeMethod as follows:

protected Object invokeMethod(MessageContext msgContext, Method method, Object obj, Object[] argValues) throws Exception {
        try {
            return super.invokeMethod(msgContext, method, obj, argValues);
        } catch (ServerException serverException) {
            throw (RuntimeException) serverException.getCause();
        }
    }

This will ensure that the original exception is handled properly according to the type mappings.


---------------------------------------------------------------------
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