digitalfondue / lavagna

Lavagna: issue tracker/project management tool
http://lavagna.io
GNU General Public License v3.0
636 stars 110 forks source link

Deployment failed on Wildfly 14 / OpenJDK 11 #135

Closed mbcon closed 4 years ago

mbcon commented 4 years ago

Hi guys, I have an issue when deploying Lavagna 1.1.4 prebuild WAR on Wildfly 14 / OpenJDK 11. Using OpenJDK8 works fine.

Thanks for investigating, fix would be very much appreciated!

Best, mbcon

09:36:40,145 INFO [stdout] (ServerService Thread Pool -- 83) 09:36:40.135 [ServerService Thread Pool -- 83] ERROR org.springframework.web.context.ContextLoader - Context initialization failed 09:36:40,151 INFO [stdout] (ServerService Thread Pool -- 83) org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1021E: A problem occurred whilst attempting to access the property 'lavagnaEnvironment': 'Error creating bean with name 'lavagnaEnvironment' defined in io.lavagna.config.DataSourceConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.lavagna.common.LavagnaEnvironment]: Factory method 'lavagnaEnvironment' threw exception; nested exception is java.lang.ExceptionInInitializerError' 09:36:40,152 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:164) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,153 INFO [stdout] (ServerService Thread Pool -- 83) at ch.digitalfondue.npjt.RepositoriesDefinitionRegistrar.registerBeanDefinitions(RepositoriesDefinitionRegistrar.java:54) ~[npjt-extra-2.0.2.jar:?] 09:36:40,153 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.annotation.ImportBeanDefinitionRegistrar.registerBeanDefinitions(ImportBeanDefinitionRegistrar.java:86) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,154 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:385) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,155 INFO [stdout] (ServerService Thread Pool -- 83) at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[?:?] 09:36:40,156 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:384) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,157 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:148) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,157 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,158 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:337) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,159 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:242) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,159 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,166 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,167 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,167 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,168 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,169 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,169 INFO [stdout] (ServerService Thread Pool -- 83) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) ~[spring-web-5.2.2.RELEASE.jar:5.2.2.RELEASE] 09:36:40,170 INFO [stdout] (ServerService Thread Pool -- 83) at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187) ~[undertow-servlet-2.0.13.Final.jar!/:2.0.13.Final] 09:36:40,171 INFO [stdout] (ServerService Thread Pool -- 83) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:216) ~[undertow-servlet-2.0.13.Final.jar!/:2.0.13.Final] 09:36:40,171 INFO [stdout] (ServerService Thread Pool -- 83) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185) ~[undertow-servlet-2.0.13.Final.jar!/:2.0.13.Final] 09:36:40,172 INFO [stdout] (ServerService Thread Pool -- 83) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) ~[undertow-servlet-2.0.13.Final.jar!/:2.0.13.Final] 09:36:40,173 INFO [stdout] (ServerService Thread Pool -- 83) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ~[undertow-servlet-2.0.13.Final.jar!/:2.0.13.Final] 09:36:40,173 INFO [stdout] (ServerService Thread Pool -- 83) at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) ~[?:?] 09:36:40,181 INFO [stdout] (ServerService Thread Pool -- 83) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502) ~[?:?] 09:36:40,181 INFO [stdout] (ServerService Thread Pool -- 83) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502) ~[?:?] 09:36:40,183 INFO [stdout] (ServerService Thread Pool -- 83) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502) ~[?:?] 09:36:40,188 INFO [stdout] (ServerService Thread Pool -- 83) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502) ~[?:?] 09:36:40,189 INFO [stdout] (ServerService Thread Pool -- 83) at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:250) [undertow-servlet-2.0.13.Final.jar!/:2.0.13.Final] 09:36:40,192 INFO [stdout] (ServerService Thread Pool -- 83) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96) [wildfly-undertow-14.0.1.Final.jar!/:14.0.1.Final] 09:36:40,193 INFO [stdout] (ServerService Thread Pool -- 83) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) [wildfly-undertow-14.0.1.Final.jar!/:14.0.1.Final] 09:36:40,193 INFO [stdout] (ServerService Thread Pool -- 83) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] 09:36:40,196 INFO [stdout] (ServerService Thread Pool -- 83) at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] 09:36:40,197 INFO [stdout] (ServerService Thread Pool -- 83) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) [jboss-threads-2.3.2.Final.jar!/:2.3.2.Final] 09:36:40,198 INFO [stdout] (ServerService Thread Pool -- 83) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) [jboss-threads-2.3.2.Final.jar!/:2.3.2.Final] 09:36:40,198 INFO [stdout] (ServerService Thread Pool -- 83) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) [jboss-threads-2.3.2.Final.jar!/:2.3.2.Final] 09:36:40,199 INFO [stdout] (ServerService Thread Pool -- 83) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378) [jboss-threads-2.3.2.Final.jar!/:2.3.2.Final] 09:36:40,200 INFO [stdout] (ServerService Thread Pool -- 83) at java.lang.Thread.run(Thread.java:834) [?:?] 09:36:40,200 INFO [stdout] (ServerService Thread Pool -- 83) at org.jboss.threads.JBossThread.run(JBossThread.java:485) [jboss-threads-2.3.2.Final.jar!/:2.3.2.Final] 09:36:40,205 INFO [stdout] (ServerService Thread Pool -- 83) Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1021E: A problem occurred whilst attempting to access the property 'lavagnaEnvironment': 'Error creating bean with name 'lavagnaEnvironment' defined in io.lavagna.config.DataSourceConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.lavagna.common.LavagnaEnvironment]: Factory method 'lavagnaEnvironment' threw exception; nested exception is java.lang.ExceptionInInitializerError'

syjer commented 4 years ago

So, it seems that https://github.com/digitalfondue/lavagna/blob/master/src/main/java/io/lavagna/common/LavagnaEnvironment.java#L40 has some issue while reading the properties. Have you set them?

Do you have the full stacktrace as it seems to lack the part where it fails inside LavagnaEnvironment ?

mbcon commented 4 years ago

Yes, I have set the relevant properties when starting Wildfly. ./bin/standalone.bat -Ddatasource.dialect=HSQLDB -Ddatasource.url=jdbc:hsqldb:mem:lavagna -Ddatasource.username=sa -Ddatasource.password= -Dspring.profiles.active=prod

Using OpenJDK8, the same setup just works fine. wildfly-server.log

syjer commented 4 years ago

ok, seems a log4j/classpath issue:

Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
    at deployment.lavagna.war//org.apache.logging.log4j.LogManager.callerClass(LogManager.java:576)
...

I'll have a look

syjer commented 4 years ago

@mbcon , I was able to push a fix for the latest wildfly (19.0.0).

Now the combination java11+widlfly 19.0.0 (Servlet-Only Distribution) is working.

Your specific issue seems related to multi release jar used by log4j2 ( https://issues.redhat.com/browse/WFCORE-4266 ) which has been fixed in wildfly 16.0.0.Final. (I tried 14, 15 and both failed, 16.0.0 and + work as expected).

I'll do a release tomorrow for the specific "workaround" for wildfly 16.0.0 and later.

But the combination java11+wildfly14.0.0 is not possible with lavagna, as it has a multi release jar dependency.

mbcon commented 4 years ago

Hello @syjer, Thanks for looking into my issue and the proposed solution. Unfortunately I am currently tied to WF14 for reasons. But your link on the WFCORE issue made smarter. I am now trying to build a specific JBoss module for Lavagna jars that cause issues (log4j, Spring). Now I have Lavagna running with java11/WF14 by just a new module and an entry in standalone.xml. First tests look promising. If this solution is interesting for others, I could share the docs if tests go well.

Best, mbcon

mbcon commented 4 years ago

Hi again, Lavagna works like a charm on WF14/JDK11. I have attached the description of the WF module necessary to get this done.

Don't forget to reference the module in your standalone.xml config under ...

standalone.xml is also a good place to configure Lavagna database config:

..... Thanks for providing this handy, compact tool! I will open a new topic for the questions on Lavagna I now have ... Best, mbcon [module.xml.txt](https://github.com/digitalfondue/lavagna/files/4420413/module.xml.txt)