[Wildfly 13] module loading
emeuwese Jul 23, 2018 7:45 PMI want to deploy an application which is using the javax.money.api and the implementation org.javamoney.moneta on Willdfly 13.0.0.Final running with a domain configuration.
The problem is that occurs when I put in my pom.xml for the dependency javax.money.api that the scope is provided then Wildfly will rolls back the deployment of my .ear.
Why does it say WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available
2018-07-20 19:06:23,022ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 91) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.RuntimeException: RESTEASY003920: Unable to instantiate ContextResolver at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378) at java.lang.Thread.run(Unknown Source) at org.jboss.threads.JBossThread.run(JBossThread.java:485) Caused by: java.lang.RuntimeException: RESTEASY003920: Unable to instantiate ContextResolver at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1982) at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1637) at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1558) at org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:629) at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:404) at org.jboss.resteasy.spi.ResteasyDeployment.startInternal(ResteasyDeployment.java:279) at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:86) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:119) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117) at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103) at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:300) at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:140) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:584) at io.undertow.servlet.core.DeploymentManagerImpl$2.call(DeploymentManagerImpl.java:555) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1514) at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:597) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:97) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78) ... 8 more Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct public com.example.JSONBConfiguration() at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:162) at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2676) at org.jboss.resteasy.spi.ResteasyProviderFactory.addContextResolver(ResteasyProviderFactory.java:1377) at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1976) ... 34 more Caused by: java.lang.NoClassDefFoundError: javax/money/format/AmountFormatQueryBuilder at com.example.MonetaryAmountAdapter.(MonetaryAmountAdapter.java:26) at com.example.JSONBConfiguration.(JSONBConfiguration.java:44) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150) ... 37 more Caused by: java.lang.ClassNotFoundException: javax.money.format.AmountFormatQueryBuilder from [Module "deployment.example-ear-1.0.ear.com.example-example-rest-api-1.0.war" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255) 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) ... 44 more 2018-07-20 19:06:23,101 ERROR [org.jboss.as.server] (ServerService Thread Pool -- 16) WFLYSRV0014: Replacement of deployment "example-ear-1.0.ear" by deployment "example-ear-1.0.ear" was rolled back with the following failure message: { "WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./" => "java.lang.RuntimeException: RESTEASY003920: Unable to instantiate ContextResolver Caused by: java.lang.RuntimeException: RESTEASY003920: Unable to instantiate ContextResolver Caused by: java.lang.RuntimeException: RESTEASY003325: Failed to construct public com.example.JSONBConfiguration() Caused by: java.lang.NoClassDefFoundError: javax/money/format/AmountFormatQueryBuilder Caused by: java.lang.ClassNotFoundException: javax.money.format.AmountFormatQueryBuilder from [Module \"deployment.example-ear-1.0.ear.com.example-example-rest-api-1.0.war\" from Service Module Loader]"}, "WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available." => { "Services that were unable to start:" => ["jboss.deployment.subunit.\"example-ear-1.0.ear\".\"com.example-example-rest-api-1.0.war\".deploymentCompleteService"], "Services that may be the cause:" => [ "jboss.deployment.subunit.\"example-ear-1.0.ear\".\"com.example-example-rest-api-1.0.war\".deploymentCompleteService", "jboss.deployment.unit.\"example-ear-1.0.ear\".moduleDeploymentRuntimeInformation", "jboss.txn.service.remote", "jboss.xts.handlers", "org.wildfly.clustering.cache.default-service-provider-registry.ejb", "org.wildfly.clustering.cache.default-service-provider-registry.web", "org.wildfly.clustering.cache.group.ejb.dist", "org.wildfly.clustering.cache.group.hibernate.entity", "org.wildfly.clustering.cache.group.hibernate.local-query", "org.wildfly.clustering.cache.group.hibernate.timestamps", "org.wildfly.clustering.cache.group.server.client-mappings", "org.wildfly.clustering.cache.group.server.default", "org.wildfly.clustering.cache.group.web.client-mappings", "org.wildfly.clustering.cache.group.web.dist", "org.wildfly.clustering.cache.registry.ejb.dist", "org.wildfly.clustering.cache.registry.server.default", "org.wildfly.clustering.cache.registry.web.dist", "org.wildfly.clustering.cache.registry-entry.ejb.dist", "org.wildfly.clustering.cache.registry-entry.hibernate.entity", "org.wildfly.clustering.cache.registry-entry.hibernate.local-query", "org.wildfly.clustering.cache.registry-entry.hibernate.timestamps", "org.wildfly.clustering.cache.registry-entry.server.client-mappings", "org.wildfly.clustering.cache.registry-entry.server.default", "org.wildfly.clustering.cache.registry-entry.web.client-mappings", "org.wildfly.clustering.cache.registry-entry.web.dist", "org.wildfly.clustering.cache.registry-factory.ejb.dist", "org.wildfly.clustering.cache.registry-factory.hibernate.entity", "org.wildfly.clustering.cache.registry-factory.hibernate.local-query", "org.wildfly.clustering.cache.registry-factory.hibernate.timestamps", "org.wildfly.clustering.cache.registry-factory.server.client-mappings", "org.wildfly.clustering.cache.registry-factory.server.default", "org.wildfly.clustering.cache.registry-factory.web.client-mappings", "org.wildfly.clustering.cache.registry-factory.web.dist", "org.wildfly.clustering.cache.service-provider-registry.ejb.client-mappings", "org.wildfly.clustering.cache.service-provider-registry.ejb.dist", "org.wildfly.clustering.cache.service-provider-registry.hibernate.entity", "org.wildfly.clustering.cache.service-provider-registry.hibernate.local-query", "org.wildfly.clustering.cache.service-provider-registry.hibernate.timestamps", "org.wildfly.clustering.cache.service-provider-registry.server.client-mappings", "org.wildfly.clustering.cache.service-provider-registry.server.default", "org.wildfly.clustering.cache.service-provider-registry.web.client-mappings", "org.wildfly.clustering.cache.service-provider-registry.web.default-server", "org.wildfly.clustering.cache.service-provider-registry.web.dist", "org.wildfly.clustering.command-dispatcher-factory.ejb", "org.wildfly.clustering.command-dispatcher-factory.hibernate", "org.wildfly.clustering.command-dispatcher-factory.local", "org.wildfly.clustering.command-dispatcher-factory.server", "org.wildfly.clustering.group.hibernate", "org.wildfly.clustering.group.local", "org.wildfly.clustering.group.server", "org.wildfly.clustering.infinispan.cache.ejb.dist", "org.wildfly.clustering.infinispan.cache.hibernate.entity", "org.wildfly.clustering.infinispan.cache.hibernate.local-query", "org.wildfly.clustering.infinispan.cache.hibernate.timestamps", "org.wildfly.clustering.infinispan.cache.server.client-mappings", "org.wildfly.clustering.infinispan.cache.server.default", "org.wildfly.clustering.infinispan.cache.store.hibernate.local-query", "org.wildfly.clustering.infinispan.cache.store.hibernate.timestamps", "org.wildfly.clustering.infinispan.cache.store.server.default", "org.wildfly.clustering.infinispan.cache.web.client-mappings", "org.wildfly.clustering.infinispan.cache.web.dist", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.local-query", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.local-query.expiration", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.local-query.locking", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.local-query.memory", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.local-query.transaction", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps.backup", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps.expiration", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps.locking", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps.memory", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps.partition-handling", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps.state-transfer", "org.wildfly.clustering.infinispan.cache-configuration.hibernate.timestamps.transaction", "org.wildfly.clustering.infinispan.cache-configuration.server.client-mappings", "org.wildfly.clustering.infinispan.cache-configuration.server.default", "org.wildfly.clustering.infinispan.cache-configuration.server.default.backup", "org.wildfly.clustering.infinispan.cache-configuration.server.default.expiration", "org.wildfly.clustering.infinispan.cache-configuration.server.default.locking", "org.wildfly.clustering.infinispan.cache-configuration.server.default.memory", "org.wildfly.clustering.infinispan.cache-configuration.server.default.partition-handling", "org.wildfly.clustering.infinispan.cache-configuration.server.default.state-transfer", "org.wildfly.clustering.infinispan.cache-configuration.server.default.transaction", "org.wildfly.clustering.infinispan.cache-configuration.web.client-mappings", "org.wildfly.clustering.infinispan.default-cache.ejb", "org.wildfly.clustering.infinispan.default-cache.web", "org.wildfly.clustering.infinispan.default-cache-configuration.server", "org.wildfly.clustering.jgroups.channel-factory.tcp", "org.wildfly.clustering.jgroups.channel-factory.tcp.FD_ALL", "org.wildfly.clustering.jgroups.channel-factory.tcp.FD_SOCK", "org.wildfly.clustering.jgroups.channel-factory.tcp.FRAG3", "org.wildfly.clustering.jgroups.channel-factory.tcp.MERGE3", "org.wildfly.clustering.jgroups.channel-factory.tcp.MFC", "org.wildfly.clustering.jgroups.channel-factory.tcp.MPING", "org.wildfly.clustering.jgroups.channel-factory.tcp.UNICAST3", "org.wildfly.clustering.jgroups.channel-factory.tcp.VERIFY_SUSPECT", "org.wildfly.clustering.jgroups.channel-factory.tcp.\"pbcast.GMS\"", "org.wildfly.clustering.jgroups.channel-factory.tcp.\"pbcast.NAKACK2\"", "org.wildfly.clustering.jgroups.channel-factory.tcp.\"pbcast.STABLE\"", "org.wildfly.clustering.jgroups.channel-factory.tcp.transport", "org.wildfly.network.socket-binding.jgroups-mping", "org.wildfly.network.socket-binding.jgroups-tcp" ] } }
JSONBConfiguration.java
package com.example; import java.lang.reflect.Field; import java.lang.reflect.Method; import javax.json.bind.Jsonb; import javax.json.bind.JsonbBuilder; import javax.json.bind.JsonbConfig; import javax.json.bind.annotation.JsonbProperty; import javax.json.bind.config.PropertyVisibilityStrategy; import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Provider; @Provider public class JSONBConfiguration implements ContextResolver { private final JsonbConfig config; private final Jsonb jsonb; public JSONBConfiguration() { config = new JsonbConfig() .withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() { @Override public boolean isVisible(Field field) { return field.isAnnotationPresent(JsonbProperty.class); } @Override public boolean isVisible(Method method) { return false; } }) .withDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", null) .withAdapters(new MonetaryAmountAdapter()); jsonb = JsonbBuilder .newBuilder() .withConfig(config) .build(); } @Override public Jsonb getContext(Class type) { return jsonb; } }
MonetaryAmountAdapter.java
package com.example; import java.math.BigDecimal; import java.util.Locale; import javax.json.bind.adapter.JsonbAdapter; import javax.json.Json; import javax.json.JsonObject; import javax.money.Monetary; import javax.money.MonetaryAmount; import javax.money.format.AmountFormatQueryBuilder; import javax.money.format.MonetaryAmountFormat; import javax.money.format.MonetaryFormats; public class MonetaryAmountAdapter implements JsonbAdapter<monetaryamount, jsonobject=""> { private final MonetaryAmountFormat amountFormat; public MonetaryAmountAdapter() { amountFormat = MonetaryFormats.getAmountFormat( AmountFormatQueryBuilder.of(new Locale("nl","NL")) .set("pattern", "#,##0.00") .build()); } @Override public JsonObject adaptToJson(MonetaryAmount amount) throws Exception { return Json.createObjectBuilder() .add("amount", amountFormat.format(amount)) .add("currency", amount.getCurrency().getCurrencyCode()) .build(); } @Override public MonetaryAmount adaptFromJson(JsonObject object) throws Exception { return Monetary.getDefaultAmountFactory() .setNumber(new BigDecimal(object.getString("amount"))) .setCurrency(object.getString("currency")) .create(); } }
javax.money.api and moneta modules
wildfly-13.0.0.Final\\modules\layers.conf
layers=db,money
wildfly-13.0.0.Final\\modules\system\layers\base <- default wildlfy
wildfly-13.0.0.Final\\modules\system\layers\db<- java db connectors
wildfly-13.0.0.Final\\modules\system\layers\money <- java money
wildfly-13.0.0.Final\modules\system\layers\money\javax\money\api\main\module.xml
wildfly-13.0.0.Final\modules\system\layers\money\javax\money\api\main\money-api-1.0.3.jar
wildfly-13.0.0.Final\modules\system\layers\money\org\javamoney\moneta\main\module.xml
wildfly-13.0.0.Final\modules\system\layers\money\org\javamoney\moneta\main\moneta-core-1.3.jar
wildfly-13.0.0.Final\modules\system\layers\money\org\javamoney\moneta\main\moneta-convert-1.3.jar
wildfly-13.0.0.Final\modules\system\layers\money\org\javamoney\moneta\main\moneta-convert-imf-1.3.jar
wildfly-13.0.0.Final\modules\system\layers\money\org\javamoney\moneta\main\moneta-convert-ecb-1.3.jar
The server starts fine without errors. And the modules look available through cli
[domain@192.168.1.127:9990 /] /host=master/core-service=module-loading/:list-resource-loader-paths(module=javax.money.api) { "outcome" => "success", "response-headers" => {"warnings" => [{ "warning" => "WFLYCTL0449: Operation list-resource-loader-paths against the resource at address /host=master/core-service=module-loading is deprecated, and it might be removed in future version. See the the output of the read-operation-description operation to learn more about the deprecation.", "level" => "WARNING", "operation" => { "address" => [ ("host" => "master"), ("core-service" => "module-loading") ], "operation" => "list-resource-loader-paths" } }]}, "result" => [ "C:\\jee-as\\wildfly-13.0.0.Final\\modules\\system\\layers\\money\\javax\\money\\api\\main\\money-api-1.0.3.jar", "C:\\jee-as\\wildfly-13.0.0.Final\\modules\\system\\layers\\money\\javax\\money\\api\\main\\lib" ] } [domain@192.168.1.127:9990 /] /host=master/core-service=module-loading/:list-resource-loader-paths(module=org.javamoney.moneta) { "outcome" => "success", "response-headers" => {"warnings" => [{ "warning" => "WFLYCTL0449: Operation list-resource-loader-paths against the resource at address /host=master/core-service=module-loading is deprecated, and it might be removed in future version. See the the output of the read-operation-description operation to learn more about the deprecation.", "level" => "WARNING", "operation" => { "address" => [ ("host" => "master"), ("core-service" => "module-loading") ], "operation" => "list-resource-loader-paths" } }]}, "result" => [ "C:\\jee-as\\wildfly-13.0.0.Final\\modules\\system\\layers\\money\\org\\javamoney\\moneta\\main\\moneta-core-1.3.jar", "C:\\jee-as\\wildfly-13.0.0.Final\\modules\\system\\layers\\money\\org\\javamoney\\moneta\\main\\moneta-convert-1.3.jar", "C:\\jee-as\\wildfly-13.0.0.Final\\modules\\system\\layers\\money\\org\\javamoney\\moneta\\main\\moneta-convert-imf-1.3.jar", "C:\\jee-as\\wildfly-13.0.0.Final\\modules\\system\\layers\\money\\org\\javamoney\\moneta\\main\\moneta-convert-ecb-1.3.jar", "C:\\jee-as\\wildfly-13.0.0.Final\\modules\\system\\layers\\money\\org\\javamoney\\moneta\\main\\lib" ] }