[
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