[jboss-jira] [JBoss JIRA] (WFLY-11411) ModuleClassLoader fails with ClassNotFoundException when class in a jar file

Yeray Borges (Jira) issues at jboss.org
Mon Nov 26 04:46:00 EST 2018


    [ https://issues.jboss.org/browse/WFLY-11411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13665839#comment-13665839 ] 

Yeray Borges commented on WFLY-11411:
-------------------------------------

Wildlfly treats war deployments as single module with isolate class loading. If you want to access to classes in a .jar file from a war project, you have to package the war deployment including the jar file in the WEB-INF/lib folder. Doing so, you should be able to share the classes. I've just verified that this packaging is working fine in Wildfly 14.

[~karlnicholas] are you including your jar file in the war deployment?, if so, please, attach your complete project structure to take a look



> ModuleClassLoader fails with ClassNotFoundException when class in a jar file
> ----------------------------------------------------------------------------
>
>                 Key: WFLY-11411
>                 URL: https://issues.jboss.org/browse/WFLY-11411
>             Project: WildFly
>          Issue Type: Bug
>          Components: Class Loading
>    Affects Versions: 11.0.0.Final, 14.0.0.Final
>         Environment: Wildfly 11, 14, Java 1.8, Windows 10
>            Reporter: Karl Nicholas
>            Assignee: Yeray Borges
>            Priority: Major
>         Attachments: JaxRsActivator.java, RestSever.java
>
>
> Simple REST service with Application activator in project and Rest Server in another project with jar file fails to load. 
> Works okay with EAR project structure but not with simpler WAR project structure.
> Caused by: java.lang.ClassNotFoundException: rest.service.server.RestSever from [Module "deployment.restserver7.war" from Service Module Loader]
> 	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
> 	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
> 	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
> 	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list