[
https://issues.apache.org/jira/browse/CXF-8176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17000464#comment-17000464
]
Richard O'Sullivan commented on CXF-8176:
-----------------------------------------
Thank you Colm and Andriy for your help. I have attached a tarball containing a
stand-alone Maven project to reproduce the problem in isolation.
The project uses CXFNonSpringServlet to implement a simple REST web service. It
supports CDI injection and uses @Context to get the HttpServletRequest instance
for each request. That instance is used to get the remote host name.
When the project is built using CXF v3.2.1 and run using the Maven plugins for
embedded Jetty and Tomcat, the web service deploys and runs successfully.
When the project is built using CXF v3.2.2 and run using Jetty 9x, Tomcat 7x or
Tomcat 9x,it fails to deploy due to WELD-001524
(org.apache.cxf.cdi.ContextProducerBean). Curiously, it succeeds for Jetty 7x.
I have not had time to alter the constructor in the ContextProducerBean class
to see if making it 'public' fixes the issue (that's just a guess at this
point).
> Apache CXF @Context not class loading.
> --------------------------------------
>
> Key: CXF-8176
> URL: https://issues.apache.org/jira/browse/CXF-8176
> Project: CXF
> Issue Type: Bug
> Components: Integration
> Affects Versions: 3.2.2
> Reporter: Richard O'Sullivan
> Priority: Major
> Attachments: CXF-ContentProducerBean-Fail-to-Load-Stacktrace.txt,
> cxf-servlet-bug.tar.gz
>
>
> I have a WAR containing cxf-integration-cdi-3.2.1.jar that I deploy to Tomcat
> V9, successfully. When I deploy a WAR containing
> cxf-integration-cdi-3.2.7.jar, it fails to deploy because:
> {quote}org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load
> proxy class for bean org.apache.cxf.cdi.ContextProducerBean@28c30f4d with
> class class java.lang.Object using classloader
> java.net.URLClassLoader@695caf9f
> {quote}
> My WAR includes the Weld v2.4.6 jars.
> Note: The ContextProducerBean class was introduced in CXF v3.2.2.
> Others on the web, have reported a similar issue:
> *
> [https://stackoverflow.com/questions/56905194/class-not-found-in-war-but-is-available]
> * [https://t.codebug.vip/questions-112783.htm]
> I'm suspicious that there is no scope modifier on the constructor in the
> ContextProducerBean class; thus, causing the scope to default to 'package
> private' and become hidden from Tomcat's class loader. Also, the super class,
> AbstractCXFBean<Object> does not declare a scope either. The fix might be to
> add the 'public' modifier to both, just guessing.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)