You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Joakim Olsson (JIRA)" <ji...@apache.org> on 2011/02/15 18:31:57 UTC
[jira] Created: (CXF-3339) ClassLoader issue with cached
JAXBContext by packagename
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.
@@ -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 {
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (CXF-3339) ClassLoader issue with cached
JAXBContext by packagename
Posted by "Joakim Olsson (JIRA)" <ji...@apache.org>.
[ 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
[jira] [Resolved] (CXF-3339) ClassLoader issue with cached
JAXBContext by packagename
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ 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