[jboss-jira] [JBoss JIRA] (AS7-2986) ModuleClassLoader can't load HttpClient within a spring loaded bean using RESTEasy
Michael Steffens (Commented) (JIRA)
jira-events at lists.jboss.org
Mon Jan 9 11:18:10 EST 2012
[ https://issues.jboss.org/browse/AS7-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654632#comment-12654632 ]
Michael Steffens commented on AS7-2986:
---------------------------------------
thanks a lot for looking into this issue!
I'm ending up with your third option, however, declaring dependency on {{org.apache.httpcomponents}} using the maven plugin:
{code:xml}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.apache.httpcomponents</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
{code}
This is at least a suitable workaround for us. And it appears to fix both class loading issues observed with and without bundling {{resteasy-jaxrs}}, respectively.
Regarding your first suggestion: Does this mean activating resteasy via Spring is not spec compliant? Otherwise, as {{resteasy-spring}} is not included the container's built-in modules, it must be bundled.
> ModuleClassLoader can't load HttpClient within a spring loaded bean using RESTEasy
> ----------------------------------------------------------------------------------
>
> Key: AS7-2986
> URL: https://issues.jboss.org/browse/AS7-2986
> Project: Application Server 7
> Issue Type: Bug
> Components: Class Loading
> Affects Versions: 7.1.0.Beta1b
> Reporter: Michael Steffens
> Assignee: Stuart Douglas
>
> Can't instantiate a HttpClient within a spring loaded bean using RESTEasy.
> Depending on whether resteasy-jaxrs included in war archive (scope "compile") or not included (scope "provided"), the ModuleClassLoader is trapped by either a duplicate class object, or none at all.
> See http://community.jboss.org/message/640810 for further details and example code.
> Tried following workarounds, but failed:
> If you change the code not to instantiate HttpClient explicitly, as in
> private ClientExecutor createClientExecutor()
> {
> ClientExecutor clientExecutor = new ApacheHttpClient4Executor();
> return clientExecutor;
> }
> the code runs fine. But then you can't attach Credentials (not acceptable). Or you need to query the ClientExecutor's HttpClient afterwards, and cast the result to DefautHttpClient -> Class loader issue is back again.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list