Return-Path: Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: (qmail 79421 invoked from network); 15 Feb 2011 17:36:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Feb 2011 17:36:22 -0000 Received: (qmail 17416 invoked by uid 500); 15 Feb 2011 17:36:22 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 16793 invoked by uid 500); 15 Feb 2011 17:36:20 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 16779 invoked by uid 99); 15 Feb 2011 17:36:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Feb 2011 17:36:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Feb 2011 17:36:17 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 8E1E51A6CD7 for ; Tue, 15 Feb 2011 17:35:57 +0000 (UTC) Date: Tue, 15 Feb 2011 17:35:57 +0000 (UTC) From: "Joakim Olsson (JIRA)" To: issues@cxf.apache.org Message-ID: <2059854532.18066.1297791357578.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1016564489.18052.1297791117766.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Updated: (CXF-3339) ClassLoader issue with cached JAXBContext by packagename MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-3339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joakim Olsson updated CXF-3339: ------------------------------- Description: When using the same REST-integration from two different WAR's we got a nice "JAXBException occurred : class packagename.Classname nor any of its super class is known to this context" from one of the applications. I tracked this to the AbstractJAXBProvider and the packageContexts being keyed on the string-representation of the package. The following naive patch (towards the 2.3.x-fixes branch) solved the problem for us. There probably is a better solution. {noformat} @@ -394,7 +394,13 @@ public abstract class AbstractJAXBProvider extends AbstractConfigurableProvider return null; } synchronized (packageContexts) { - String packageName = PackageUtils.getPackageName(type); + String classLoaderName; + if (type.getClassLoader() != null) { + classLoaderName = type.getClassLoader().toString(); + } else { + classLoaderName = "none"; + } + String packageName = classLoaderName + "-" + PackageUtils.getPackageName(type); JAXBContext context = packageContexts.get(packageName); if (context == null) { try { {noformat} was: When using the same REST-integration from two different WAR's we got a nice "JAXBException occurred : class packagename.Classname nor any of its super class is known to this context" from one of the applications. I tracked this to the AbstractJAXBProvider and the packageContexts being keyed on the string-representation of the package. The following naive patch (towards the 2.3.x-fixes branch) solved the problem for us. There probably is a better solution. @@ -394,7 +394,13 @@ public abstract class AbstractJAXBProvider extends AbstractConfigurableProvider return null; } synchronized (packageContexts) { - String packageName = PackageUtils.getPackageName(type); + String classLoaderName; + if (type.getClassLoader() != null) { + classLoaderName = type.getClassLoader().toString(); + } else { + classLoaderName = "none"; + } + String packageName = classLoaderName + "-" + PackageUtils.getPackageName(type); JAXBContext context = packageContexts.get(packageName); if (context == null) { try { > ClassLoader issue with cached JAXBContext by packagename > -------------------------------------------------------- > > Key: CXF-3339 > URL: https://issues.apache.org/jira/browse/CXF-3339 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Reporter: Joakim Olsson > > When using the same REST-integration from two different WAR's we got a nice "JAXBException occurred : class packagename.Classname nor any of its super class is known to this context" from one of the applications. > I tracked this to the AbstractJAXBProvider and the packageContexts being keyed on the string-representation of the package. > The following naive patch (towards the 2.3.x-fixes branch) solved the problem for us. There probably is a better solution. > {noformat} > @@ -394,7 +394,13 @@ public abstract class AbstractJAXBProvider extends AbstractConfigurableProvider > return null; > } > synchronized (packageContexts) { > - String packageName = PackageUtils.getPackageName(type); > + String classLoaderName; > + if (type.getClassLoader() != null) { > + classLoaderName = type.getClassLoader().toString(); > + } else { > + classLoaderName = "none"; > + } > + String packageName = classLoaderName + "-" + PackageUtils.getPackageName(type); > JAXBContext context = packageContexts.get(packageName); > if (context == null) { > try { > {noformat} -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira