You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2011/04/08 13:00:06 UTC

[jira] [Resolved] (CXF-3339) ClassLoader issue with cached JAXBContext by packagename

     [ https://issues.apache.org/jira/browse/CXF-3339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-3339.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4
         Assignee: Sergey Beryozkin

Resolved on the trunk only due to sensitive changes which have been applied to ProviderFactory

> 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
>            Assignee: Sergey Beryozkin
>             Fix For: 2.4
>
>
> 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