[
https://issues.apache.org/jira/browse/CXF-3670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13068656#comment-13068656
]
Mike Youngstrom commented on CXF-3670:
--------------------------------------
Here is a simple patch applied to trunk. I've tested it and it solves my
problem.
Index:
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
===================================================================
---
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
(revision 1148828)
+++
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
(working copy)
@@ -66,7 +65,12 @@
@Consumes("application/json")
@Provider
public class JSONProvider extends AbstractJAXBProvider {
-
+
+ static {
+ //Force the use of Jettison to ensure jettison is in the classpath:
CXF-3670, CXF-3159
+ new SimpleConverter();
+ }
+
private static final String MAPPED_CONVENTION = "mapped";
private static final String BADGER_FISH_CONVENTION = "badgerfish";
The exception escapes here:
at
org.apache.cxf.jaxrs.model.AbstractResourceInfo.findContextFields(AbstractResourceInfo.java:82)
at
org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceInfo.java:61)
at org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:27)
at
org.apache.cxf.jaxrs.provider.ProviderFactory.initJaxbProviders(ProviderFactory.java:118)
at
org.apache.cxf.jaxrs.provider.ProviderFactory.<init>(ProviderFactory.java:103)
at
org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.java:63)
at
org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSFactoryBean.java:317)
at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:161)
> Regression CXF-3159: Jettison required for json processing with some
> classloader implementations
> ------------------------------------------------------------------------------------------------
>
> Key: CXF-3670
> URL: https://issues.apache.org/jira/browse/CXF-3670
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.4.1
> Reporter: Mike Youngstrom
>
> We recently upgraded our application from 2.3.x to 2.4.1 and we appear to be
> having trouble similar to that described in CXF-3159.
> In CXF-3159 the fix was to basically force the vm to do more class
> initialization. I wonder if a better fix would be to just modify the
> JSONProvider to more eagarly check for a jettison class in a static
> initializer so that there is less reliance on Classloader implementations to
> find the existence of dependencies like this? I'd be happy to provide a
> patch if that would be useful.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira