[keycloak-user] Package custom rest endpoint in EAR

Ulrik Lejon ulrik.lejon at mollyware.se
Fri Apr 21 15:39:19 EDT 2017


Here is a link to my repository:
https://github.com/ulejon/keycloak-custom-rest-provider-ear

Here is the log output when I try to deploy the ear to standalone/deployment

19:03:21,117 INFO  [org.jboss.as.server.deployment] (MSC service thread
1-6) WFLYSRV0027: Starting deployment of "custom-ear.ear" (runtime-name:
"custom-ear.ear")
19:03:21,175 INFO  [org.jboss.as.server.deployment] (MSC service thread
1-7) WFLYSRV0207: Starting subdeployment (runtime-name:
"provider-1.0-SNAPSHOT.jar")
19:03:21,211 INFO
 [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor]
(MSC service thread 1-7) Deploying Keycloak provider: {0}
19:03:21,220 WARN  [org.jboss.modules] (MSC service thread 1-7) Failed to
define class se.lejon.keycloak.custom.TestRestResourceProviderFactory in
Module "deployment.custom-ear.ear.provider-1.0-SNAPSHOT.jar:main" from
Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
se/lejon/keycloak/custom/TestRestResourceProviderFactory (Module
"deployment.custom-ear.ear.provider-1.0-SNAPSHOT.jar:main" from Service
Module Loader): org/keycloak/services/resource/RealmResourceProviderFactory
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at
org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at
org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at
org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:47)
at org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
at
org.keycloak.services.DefaultKeycloakSessionFactory.loadFactories(DefaultKeycloakSessionFactory.java:206)
at
org.keycloak.services.DefaultKeycloakSessionFactory.deploy(DefaultKeycloakSessionFactory.java:112)
at
org.keycloak.provider.ProviderManagerRegistry.deploy(ProviderManagerRegistry.java:42)
at
org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor.deploy(KeycloakProviderDeploymentProcessor.java:54)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

19:03:21,223 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7)
MSC000001: Failed to start service
jboss.deployment.subunit."custom-ear.ear"."provider-1.0-SNAPSHOT.jar".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.subunit."custom-ear.ear"."provider-1.0-SNAPSHOT.jar".POST_MODULE:
WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment
"provider-1.0-SNAPSHOT.jar" of deployment "custom-ear.ear"
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Failed to link
se/lejon/keycloak/custom/TestRestResourceProviderFactory (Module
"deployment.custom-ear.ear.provider-1.0-SNAPSHOT.jar:main" from Service
Module Loader): org/keycloak/services/resource/RealmResourceProviderFactory
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at
org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at
org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at
org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:47)
at org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
at
org.keycloak.services.DefaultKeycloakSessionFactory.loadFactories(DefaultKeycloakSessionFactory.java:206)
at
org.keycloak.services.DefaultKeycloakSessionFactory.deploy(DefaultKeycloakSessionFactory.java:112)
at
org.keycloak.provider.ProviderManagerRegistry.deploy(ProviderManagerRegistry.java:42)
at
org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor.deploy(KeycloakProviderDeploymentProcessor.java:54)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more

19:03:21,231 ERROR [org.jboss.as.controller.management-operation]
(DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed -
address: ([("deployment" => "custom-ear.ear")]) - failure description:
{"WFLYCTL0080: Failed services" =>
{"jboss.deployment.subunit.\"custom-ear.ear\".\"provider-1.0-SNAPSHOT.jar\".POST_MODULE"
=> "org.jboss.msc.service.StartException in service
jboss.deployment.subunit.\"custom-ear.ear\".\"provider-1.0-SNAPSHOT.jar\".POST_MODULE:
WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment
\"provider-1.0-SNAPSHOT.jar\" of deployment \"custom-ear.ear\"
    Caused by: java.lang.NoClassDefFoundError: Failed to link
se/lejon/keycloak/custom/TestRestResourceProviderFactory (Module
\"deployment.custom-ear.ear.provider-1.0-SNAPSHOT.jar:main\" from Service
Module Loader):
org/keycloak/services/resource/RealmResourceProviderFactory"}}
19:03:21,291 ERROR [stderr] (DeploymentScanner-threads - 1)
java.io.IOException: Mount point not found
19:03:21,292 ERROR [stderr] (DeploymentScanner-threads - 1)  at
sun.nio.fs.LinuxFileStore.findMountEntry(LinuxFileStore.java:91)
19:03:21,292 ERROR [stderr] (DeploymentScanner-threads - 1)  at
sun.nio.fs.UnixFileStore.<init>(UnixFileStore.java:65)
19:03:21,293 ERROR [stderr] (DeploymentScanner-threads - 1)  at
sun.nio.fs.LinuxFileStore.<init>(LinuxFileStore.java:44)
19:03:21,293 ERROR [stderr] (DeploymentScanner-threads - 1)  at
sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:51)
19:03:21,293 ERROR [stderr] (DeploymentScanner-threads - 1)  at
sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:39)
19:03:21,294 ERROR [stderr] (DeploymentScanner-threads - 1)  at
sun.nio.fs.UnixFileSystemProvider.getFileStore(UnixFileSystemProvider.java:368)
19:03:21,294 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.nio.file.Files.getFileStore(Files.java:1461)
19:03:21,295 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.persistence.FilePersistenceUtils.getPosixAttributes(FilePersistenceUtils.java:129)
19:03:21,295 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.persistence.FilePersistenceUtils.createTempFileWithAttributes(FilePersistenceUtils.java:117)
19:03:21,296 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.persistence.FilePersistenceUtils.writeToTempFile(FilePersistenceUtils.java:104)
19:03:21,296 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.persistence.ConfigurationFilePersistenceResource.doCommit(ConfigurationFilePersistenceResource.java:55)
19:03:21,297 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.persistence.AbstractFilePersistenceResource.commit(AbstractFilePersistenceResource.java:58)
19:03:21,297 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.ModelControllerImpl$4.commit(ModelControllerImpl.java:781)
19:03:21,297 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.AbstractOperationContext.executeDoneStage(AbstractOperationContext.java:743)
19:03:21,298 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:680)
19:03:21,298 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:370)
19:03:21,299 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1344)
19:03:21,299 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:392)
19:03:21,300 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:217)
19:03:21,300 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.ModelControllerImpl$3$1$1.run(ModelControllerImpl.java:748)
19:03:21,300 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.ModelControllerImpl$3$1$1.run(ModelControllerImpl.java:742)
19:03:21,301 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.security.AccessController.doPrivileged(Native Method)
19:03:21,301 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.as.controller.ModelControllerImpl$3$1.run(ModelControllerImpl.java:742)
19:03:21,302 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
19:03:21,302 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.util.concurrent.FutureTask.run(FutureTask.java:266)
19:03:21,303 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
19:03:21,303 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
19:03:21,304 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
19:03:21,305 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
19:03:21,305 ERROR [stderr] (DeploymentScanner-threads - 1)  at
java.lang.Thread.run(Thread.java:745)
19:03:21,306 ERROR [stderr] (DeploymentScanner-threads - 1)  at
org.jboss.threads.JBossThread.run(JBossThread.java:320)
19:03:21,308 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1)
WFLYSRV0010: Deployed "custom-ear.ear" (runtime-name : "custom-ear.ear")
19:03:21,309 INFO  [org.jboss.as.controller] (DeploymentScanner-threads -
1) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service
jboss.deployment.subunit."custom-ear.ear"."provider-1.0-SNAPSHOT.jar".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.subunit."custom-ear.ear"."provider-1.0-SNAPSHOT.jar".POST_MODULE:
WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment
"provider-1.0-SNAPSHOT.jar" of deployment "custom-ear.ear"

fre 21 apr. 2017 kl 13:14 skrev Ulrik Lejon <ulrik.lejon at mollyware.se>:

> According to the documentation it should be possible to drop an .ear file
> in the standslone/deployment folder.
> Based on this, what would one need to do to package the domain-extension
> example (
> https://github.com/keycloak/keycloak/tree/2.5.x/examples/providers/domain-extension)
> in a valid ear?
>
> Anyone with experience in successfully deploying ear archives that can
> share some examples?
>
> Note: I'm using keycloak 2.5.4
>
> Br
> Ulrik
>


More information about the keycloak-user mailing list