[keycloak-user] Package custom REST endpoint in EAR/WAR
Marek Posolda
mposolda at redhat.com
Tue May 2 06:50:55 EDT 2017
It seems that you have all the keycloak jars (eg.
keycloak-services-2.5.4.Final.jar ) in the "lib" directory of your EAR.
This is not the correct packaging. The keycloak dependencies shouldn't
be inside your EAR.
You need to use "<scope>provided</scope>" for dependencies in your maven
module, so it will package the lib correctly. Maybe you need also
jboss-deployment-structure.xml with the references to used keycloak
modules, but not 100% sure. The best is to check our docs and examples
for the reference.
Marek
On 02/05/17 12:14, Ulrik Lejon wrote:
> According to the documentation it should be possible to drop an ear/war
> file in the keycloak standalone/deployment folder.
>
> I created my own rest endpoint in this repo
> <https://github.com/ulejon/keycloak-custom-rest-provider-ear> to try this
> out. However, when I deploy it I get the below errors. What am I doing
> wrong? Has Anyone successfully packaged custom keycloak code in an ear or
> war?
>
> 20:23:09,192 INFO [org.jboss.as.server.deployment] (MSC service
> thread 1-4) WFLYSRV0027: Starting deployment of "custom-ear.ear"
> (runtime-name: "custom-ear.ear")
> 20:23:10,344 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry provider-1.0-SNAPSHOT.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,345 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/keycloak-core-2.5.4.Final.jar in /content/custom-ear.ear does not
> point to a valid jar for a Class-Path reference.
> 20:23:10,345 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/keycloak-common-2.5.4.Final.jar in /content/custom-ear.ear does
> not point to a valid jar for a Class-Path reference.
> 20:23:10,345 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/bcprov-jdk15on-1.52.jar
> in /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,346 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/bcpkix-jdk15on-1.52.jar
> in /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,346 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/jackson-core-2.5.4.jar
> in /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,347 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/jackson-databind-2.5.4.jar in /content/custom-ear.ear does not
> point to a valid jar for a Class-Path reference.
> 20:23:10,347 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/keycloak-services-2.5.4.Final.jar in /content/custom-ear.ear does
> not point to a valid jar for a Class-Path reference.
> 20:23:10,347 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/javax.mail-api-1.5.5.jar
> in /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,348 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/jboss-servlet-api_3.0_spec-1.0.2.Final.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,348 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/twitter4j-core-4.0.4.jar
> in /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,348 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/resteasy-jaxrs-3.0.14.Final.jar in /content/custom-ear.ear does
> not point to a valid jar for a Class-Path reference.
> 20:23:10,349 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/jboss-annotations-api_1.2_spec-1.0.0.Final.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,349 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/activation-1.1.1.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,350 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/commons-io-2.1.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,351 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/jcip-annotations-1.0.jar
> in /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,352 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,352 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/resteasy-multipart-provider-3.0.14.Final.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,353 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/resteasy-client-3.0.14.Final.jar in /content/custom-ear.ear does
> not point to a valid jar for a Class-Path reference.
> 20:23:10,353 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/resteasy-jaxb-provider-3.0.14.Final.jar in /content/custom-ear.ear
> does not point to a valid jar for a Class-Path reference.
> 20:23:10,354 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/jaxb-impl-2.2.7.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,354 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/jaxb-core-2.2.7.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,354 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/jaxb-api-2.2.7.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,355 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/istack-commons-runtime-2.16.jar in /content/custom-ear.ear does
> not point to a valid jar for a Class-Path reference.
> 20:23:10,355 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/FastInfoset-1.2.12.jar
> in /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,355 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/jsr173_api-1.0.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,356 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/mail-1.5.0-b01.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,356 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/apache-mime4j-0.6.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,356 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/jackson-annotations-2.5.4.jar in /content/custom-ear.ear does not
> point to a valid jar for a Class-Path reference.
> 20:23:10,356 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/javase-3.2.1.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,357 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/core-3.2.1.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,357 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/jcommander-1.48.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,357 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/keycloak-server-spi-2.5.4.Final.jar in /content/custom-ear.ear
> does not point to a valid jar for a Class-Path reference.
> 20:23:10,357 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/keycloak-server-spi-private-2.5.4.Final.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,357 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/jboss-logging-3.3.0.Final.jar in /content/custom-ear.ear does not
> point to a valid jar for a Class-Path reference.
> 20:23:10,357 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,357 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/httpclient-4.3.6.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,358 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/httpcore-4.3.3.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,358 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry
> lib/commons-logging-1.1.3.jar in /content/custom-ear.ear does not
> point to a valid jar for a Class-Path reference.
> 20:23:10,358 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry lib/commons-codec-1.6.jar in
> /content/custom-ear.ear does not point to a valid jar for a
> Class-Path reference.
> 20:23:10,368 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry jaxb-api.jar in
> /content/custom-ear.ear/lib/jaxb-impl-2.2.7.jar does not point to a
> valid jar for a Class-Path reference.
> 20:23:10,368 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry jaxb-core.jar in
> /content/custom-ear.ear/lib/jaxb-impl-2.2.7.jar does not point to a
> valid jar for a Class-Path reference.
> 20:23:10,437 WARN [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0059: Class Path entry jaxb-api.jar in
> /content/custom-ear.ear/lib/jaxb-core-2.2.7.jar does not point to a
> valid jar for a Class-Path reference.
> 20:23:10,439 INFO [org.jboss.as.server.deployment] (MSC service
> thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name:
> "provider-1.0-SNAPSHOT.jar")
> 20:23:10,619 INFO
> [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor]
> (MSC service thread 1-6) Deploying Keycloak provider: {0}
> 20:23:10,625 ERROR [org.jboss.msc.service.fail] (MSC service thread
> 1-6) 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.util.ServiceConfigurationError:
> org.keycloak.email.EmailSenderProviderFactory: Provider
> org.keycloak.email.DefaultEmailSenderProviderFactory not a subtype
> at java.util.ServiceLoader.fail(ServiceLoader.java:239)
> at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
> at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
> 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
>
> 20:23:10,635 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.util.ServiceConfigurationError:
> org.keycloak.email.EmailSenderProviderFactory: Provider
> org.keycloak.email.DefaultEmailSenderProviderFactory not a subtype"}}
> 20:23:10,698 ERROR [stderr] (DeploymentScanner-threads - 1)
> java.io.IOException: Mount point not found
> 20:23:10,699 ERROR [stderr] (DeploymentScanner-threads - 1) at
> sun.nio.fs.LinuxFileStore.findMountEntry(LinuxFileStore.java:91)
> 20:23:10,699 ERROR [stderr] (DeploymentScanner-threads - 1) at
> sun.nio.fs.UnixFileStore.<init>(UnixFileStore.java:65)
> 20:23:10,699 ERROR [stderr] (DeploymentScanner-threads - 1) at
> sun.nio.fs.LinuxFileStore.<init>(LinuxFileStore.java:44)
> 20:23:10,700 ERROR [stderr] (DeploymentScanner-threads - 1) at
> sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:51)
> 20:23:10,700 ERROR [stderr] (DeploymentScanner-threads - 1) at
> sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:39)
> 20:23:10,701 ERROR [stderr] (DeploymentScanner-threads - 1) at
> sun.nio.fs.UnixFileSystemProvider.getFileStore(UnixFileSystemProvider.java:368)
> 20:23:10,702 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.nio.file.Files.getFileStore(Files.java:1461)
> 20:23:10,702 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.persistence.FilePersistenceUtils.getPosixAttributes(FilePersistenceUtils.java:129)
> 20:23:10,702 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.persistence.FilePersistenceUtils.createTempFileWithAttributes(FilePersistenceUtils.java:117)
> 20:23:10,703 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.persistence.FilePersistenceUtils.writeToTempFile(FilePersistenceUtils.java:104)
> 20:23:10,703 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.persistence.ConfigurationFilePersistenceResource.doCommit(ConfigurationFilePersistenceResource.java:55)
> 20:23:10,703 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.persistence.AbstractFilePersistenceResource.commit(AbstractFilePersistenceResource.java:58)
> 20:23:10,704 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.ModelControllerImpl$4.commit(ModelControllerImpl.java:781)
> 20:23:10,704 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.AbstractOperationContext.executeDoneStage(AbstractOperationContext.java:743)
> 20:23:10,704 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:680)
> 20:23:10,704 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:370)
> 20:23:10,705 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1344)
> 20:23:10,705 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:392)
> 20:23:10,705 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:217)
> 20:23:10,706 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.ModelControllerImpl$3$1$1.run(ModelControllerImpl.java:748)
> 20:23:10,707 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.ModelControllerImpl$3$1$1.run(ModelControllerImpl.java:742)
> 20:23:10,707 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.security.AccessController.doPrivileged(Native Method)
> 20:23:10,707 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.as.controller.ModelControllerImpl$3$1.run(ModelControllerImpl.java:742)
> 20:23:10,707 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 20:23:10,708 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 20:23:10,708 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> 20:23:10,709 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> 20:23:10,709 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 20:23:10,709 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 20:23:10,710 ERROR [stderr] (DeploymentScanner-threads - 1) at
> java.lang.Thread.run(Thread.java:745)
> 20:23:10,710 ERROR [stderr] (DeploymentScanner-threads - 1) at
> org.jboss.threads.JBossThread.run(JBossThread.java:320)
> 20:23:10,713 INFO [org.jboss.as.server] (DeploymentScanner-threads -
> 1) WFLYSRV0010: Deployed "custom-ear.ear" (runtime-name :
> "custom-ear.ear")
> 20:23:10,714 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"
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
More information about the keycloak-user
mailing list