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

updating standalone.xml causes keycloak not to start #1

Open
norricorp opened this issue Oct 2, 2019 · 15 comments
Open

updating standalone.xml causes keycloak not to start #1

norricorp opened this issue Oct 2, 2019 · 15 comments

Comments

@norricorp
Copy link

norricorp commented Oct 2, 2019

I have compiled the code and copied jar to modules/org/soft*/key*/prov*/events/mqtt/main and created module.xml as docs in 6.2.2 of the Server Developer docs

Then updated standalone.xml

    <subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">
        <web-context>auth</web-context>
        <providers>
            <provider>classpath:${jboss.home.dir}/providers/*</provider>
            <!-- this is the line I have added -->
            <provider>module:org/softwarefactory/keycloak/providers/events/mqtt</provider>
        </providers>

Running standalone.sh -b 0.0.0.0 gives

.war (runtime-name: keycloak-server.war) in 255ms
09:43:01,955 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("subsystem" => "microprofile-metrics-smallrye")]): java.lang.NullPointerException
at [email protected]//org.wildfly.extension.microprofile.metrics.MicroProfileMetricsSubsystemAdd$2.execute(MicroProfileMetricsSubsystemAdd.java:86)
at [email protected]//org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:999)
......

Removing the additional line and all is well. Assuming there is no daft error in the xml, then would the problem be that the system finds the generated jar and reacts badly to that?

But having said that, the error complains about microprofile-metrics-smallrye:2.0, so should that be commented out? I also saw this https://developer.jboss.org/thread/280621.

Regards,
John

@mhuin
Copy link
Collaborator

mhuin commented Oct 2, 2019

Hi John,
Can you try and follow the steps described there? http://www.janua.fr/keycloak-spi-adding-a-custom-event-listener-module/

This module was based on the sysout example, so this should work similarly.

@norricorp
Copy link
Author

So you used the jboss-cli.sh rather than the manual approach of copying files? But you still edited the standalone.xml file manually?

@norricorp
Copy link
Author

norricorp commented Oct 2, 2019

This is what I did

cd ~/SpringBoot/keycloak/keycloak-6.0.1

bin/jboss-cli.sh --command="module add --name=org.softwarefactory.keycloak.mqtt --resources=~/SpringBoot/keycloak-event-listener-mqtt/target/event-listener-mqtt-jar-with-dependencies.jar --dependencies=org.keycloak.keycloak-core,org.keycloak.keycloak-server-spi"

edit standalone/configuration/standalone.xml

    <subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">
        <web-context>auth</web-context>
        <providers>
            <provider>classpath:${jboss.home.dir}/providers/*</provider>
            <!-- this is the line I have added -->
            <provider>module:org/softwarefactory/keycloak/mqtt</provider>
        </providers>

and exaqctly the same problem

16:24:40,028 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("subsystem" => "microprofile-metrics-smallrye")]): java.lang.NullPointerException
at [email protected]//org.wildfly.extension.microprofile.metrics.MicroProfileMetricsSubsystemAdd$2.execute(MicroProfileMetricsSubsystemAdd.java:86)

I am using keycloak 6.0.1. I have tried 7.0.0 and same problem. Running on mint linux 19.x

MQTTEventListenerProvider.java
package org.softwarefactory.keycloak.providers.events.mqtt;

@mhuin
Copy link
Collaborator

mhuin commented Oct 7, 2019

Copying event-listener-mqtt-jar-with-dependencies.jar to ${KEYCLOAK_HOME}/standalone/deployments is enough to get the listener available. You then have to activate it in the realm's events config page in the GUI.

@norricorp
Copy link
Author

norricorp commented Oct 7, 2019 via email

@mhuin
Copy link
Collaborator

mhuin commented Oct 8, 2019

I meant that you don't have to edit the standalone.xml file to make it work; putting the jar in the deployments directory is enough. I'll update the README with clearer installation instructions.

@norricorp
Copy link
Author

norricorp commented Oct 8, 2019 via email

@mhuin
Copy link
Collaborator

mhuin commented Oct 8, 2019

Sorry, as you can see the last changes to the code were from 6 months ago, and I didn't document my process at the time. It turns out the instructions on janua.fr didn't apply after all. If you follow the steps in the README (I just tested it myself and updated the README a few minutes ago) it should work as expected.

@norricorp
Copy link
Author

norricorp commented Oct 8, 2019 via email

@mhuin
Copy link
Collaborator

mhuin commented Oct 8, 2019

no, running this is not needed.

@norricorp
Copy link
Author

norricorp commented Oct 8, 2019

well how will keycloak know where the jar is?
Ah - under resource root. So still useful to put the jar within keycloak.

@mhuin
Copy link
Collaborator

mhuin commented Oct 9, 2019

the standalone/deployments directory in keycloak's home is special, whatever gets added there is hot-deployed. You can make sure the dynamic loading worked by looking for a .deployed file with the jar name in that directory; or you can check keycloak's logs.

@norricorp
Copy link
Author

norricorp commented Oct 14, 2019

Matthieu, firstly sorry for the delay. I had a BSOD and had to move a load of VMs.
So I did what was described in the readme file and now have a different problem which may be to do with the actual jar itself.

08:54:18,857 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "event-listener-mqtt-jar-with-dependencies.jar")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."event-listener-mqtt-jar-with-dependencies.jar".STRUCTURE" => "WFLYSRV0153: Failed to process phase STRUCTURE of deployment "event-listener-mqtt-jar-with-dependencies.jar"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0160: Failed to mount deployment content
Caused by: java.util.zip.ZipException: zip END header not found"}}

Any ideas of the cause of this?

Keycloak does then run but I don't think it has loaded the mqtt jar. And going to the admin console, events, config, mqtt does not show up on the list event listeners, just the two defaults.

@norricorp
Copy link
Author

Mathhieu, I am giving up on this. Followed the instructions using keycloak 6.0.1 and just can't get it to work.
More inportantly I am giving up on user registration within keycloak. I think it is badly thought out but will raise concerns on the mailing list.

@norricorp
Copy link
Author

Actually just found a event-listener-mqtt-jar-with-dependencies.jar.failed file which is created when the module is not loaded at startup.
"{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"event-listener-mqtt-jar-with-dependencies.jar\".STRUCTURE" => "WFLYSRV0153: Failed to process phase STRUCTURE of deployment \"event-listener-mqtt-jar-with-dependencies.jar\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0160: Failed to mount deployment content
Caused by: java.util.zip.ZipException: zip END header not found"}}"

Is the jar corrupted? There were no errors during build.

@norricorp norricorp reopened this Oct 29, 2019
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