Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 95062 invoked from network); 4 Feb 2009 09:24:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Feb 2009 09:24:26 -0000 Received: (qmail 4064 invoked by uid 500); 4 Feb 2009 09:24:23 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 3950 invoked by uid 500); 4 Feb 2009 09:24:22 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 3941 invoked by uid 99); 4 Feb 2009 09:24:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2009 01:24:22 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2009 09:24:20 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E3A84234C495 for ; Wed, 4 Feb 2009 01:23:59 -0800 (PST) Message-ID: <1444470727.1233739439931.JavaMail.jira@brutus> Date: Wed, 4 Feb 2009 01:23:59 -0800 (PST) From: "Oumar Aziz OUATTARA (JIRA)" To: axis-dev@ws.apache.org Subject: [jira] Created: (AXIS-2775) ClassCastException in org.apache.axis.Message.setup() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org ClassCastException in org.apache.axis.Message.setup() ----------------------------------------------------- Key: AXIS-2775 URL: https://issues.apache.org/jira/browse/AXIS-2775 Project: Axis Issue Type: Bug Components: Basic Architecture Affects Versions: 1.2 Environment: Windows, Weblogic Server 10.0 MP1 Reporter: Oumar Aziz OUATTARA There is a class cast exception in this Class of Axis when casting to "Attachments". java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl at org.apache.axis.Message.setup(Message.java:344) at org.apache.axis.Message.(Message.java:246) at org.apache.axis.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:54) at test.TestBean.testingMethod(TestBean.java:38) In fact the bug has been noticed on an old axis but it's still on the svn trunk : attachImpl = ClassUtils.forName(attachImpName); .... Constructor attachImplConstr = attachImpl.getConstructors()[0]; try { mAttachments = (Attachments) attachImplConstr.newInstance( new Object[] { initialContents, contentType, contentLocation}); .... The ClassUtils class is using dynamic classloading. and implements it well. The problem is, using this mechanism, you can retrieve a Class object that doesn't come from the current class loader. Then casting to Attachments, will try to cast to a Class from a different class loader. To handle such a case, the JDK included a class called Proxy ( http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Proxy.html ). Using this class should easily solve the issue. Best Regards wattazoum -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.