Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractClassFinder should not try to scan module-info.class files #277

Open
mpiotrowski-im opened this issue Oct 2, 2018 · 2 comments
Open

Comments

@mpiotrowski-im
Copy link

mpiotrowski-im commented Oct 2, 2018

When using WildFly 14.0.1 with Java SE 11 AbstractClassFinder tries to scan module-info.class and fails.

This are module declarations introduced in Java SE 9 so when AbstractClassFinder tries to scan libraries with declared modules there is an Exception.

An easy fix would be to skip those classes. But I am not sure if it should be by name or by some bytcode magic numbers.

Full exception is:

Failed to define class module-info in Module "javax.json.api" version 1.1.2 from local module loader @5524cca1 (finder: local module finder @5032714f (roots: /some/paths)): java.lang.NoClassDefFoundError: Failed to link module-info (Module "javax.json.api" version 1.1.2 from local module loader @5524cca1 (finder: local module finder @5032714f (roots: /some/paths))): module-info is not a class because access_flag ACC_MODULE is set
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
	at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:423)
	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:519)
	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
	at org.jboss.modules.Module.loadModuleClass(Module.java:731)
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
	at application.war//org.ocpsoft.rewrite.annotation.scan.AbstractClassFinder.processClass(AbstractClassFinder.java:199)
	at application.war//org.ocpsoft.rewrite.annotation.scan.WebLibFinder.processJarFile(WebLibFinder.java:138)
	at application.war//org.ocpsoft.rewrite.annotation.scan.WebLibFinder.findClasses(WebLibFinder.java:84)
	at application.war//com.ocpsoft.pretty.faces.config.spi.AnnotationConfigurationProvider.loadConfiguration(AnnotationConfigurationProvider.java:95)
	at application.war//com.ocpsoft.pretty.faces.config.PrettyConfigurator.configure(PrettyConfigurator.java:63)
	at application.war//org.ocpsoft.rewrite.prettyfaces.PrettyConfigContextListener.contextInitialized(PrettyConfigContextListener.java:41)
	at application.war//org.ocpsoft.rewrite.servlet.impl.RewriteServletContextListener.contextInitialized(RewriteServletContextListener.java:38)
	at [email protected]//io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
	at [email protected]//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:216)
	at [email protected]//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185)
	at [email protected]//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
	at [email protected]//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at [email protected]//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
	at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
	at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
	at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
	at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
	at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
	at [email protected]//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:250)
	at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
	at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
	at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
	at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at [email protected]//org.jboss.threads.JBossThread.run(JBossThread.java:485)
@chkal
Copy link
Member

chkal commented Oct 2, 2018

Good catch. Yes, I agree that the module info file should be processed as a class. So calling Class.forName() doesn't make much sense. Maybe checking the name and ignoring it in this case is fine?

Pull requests welcome!

@mpiotrowski-im
Copy link
Author

I'll try to do that. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants