Updating the configuration and installing your custom providers, if any. Please wait. 2024-03-12 09:39:04,854 WARN [io.quarkus.deployment.steps.ClassTransformingBuildStep] (build-18) Cannot transform com.expleo.msauth.entity.User_expleo as its containing application archive could not be found. 2024-03-12 09:39:11,757 INFO [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 16764ms ERROR: Unexpected error when starting the server in (development) mode ERROR: Failed to start quarkus ERROR: Unable to load class [com.expleo.msauth.entity.User_expleo] ERROR: com.expleo.msauth.entity.User_expleo For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.
i have :
package com.expleo.msauth.event;
import org.keycloak.events.Event;
import org.keycloak.events.EventListenerProvider;
import org.keycloak.events.EventType;
import org.keycloak.events.admin.AdminEvent;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmProvider;
public class CustomEventListener implements EventListenerProvider {
private KeycloakSession session;
public CustomEventListener(KeycloakSession session) {
this.session = session;
}
@Override
public void onEvent(Event event) {
System.out.println("Hi this event listner when user had registration + "+event.getType().name());
}
@Override
public void onEvent(AdminEvent adminEvent, boolean b) {
System.out.println("Hi this event listner for admin when user had registration + "+adminEvent.getId());
}
@Override
public void close() {
}
}
and :
package com.expleo.msauth.event;
import org.keycloak.Config;
import org.keycloak.events.EventListenerProvider;
import org.keycloak.events.EventListenerProviderFactory;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.EventListenerFactory;
import java.lang.reflect.Method;
public class CustomEventListenerProviderFactory implements EventListenerProviderFactory {
@Override
public EventListenerProvider create(KeycloakSession keycloakSession) {
return new CustomEventListener(keycloakSession);
}
@Override
public void init(Config.Scope scope) {
}
@Override
public void postInit(KeycloakSessionFactory keycloakSessionFactory) {
}
@Override
public void close() {
}
@Override
public String getId() {
return "CustomEventListener";
}
}
i don't know why this error: 2024-03-12 10:22:49,376 WARN [io.quarkus.deployment.steps.ClassTransformingBuildStep] (build-54) Cannot transform com.expleo.msauth.entity.User_expleo as its containing application archive could not be found.
I am using Keycloak Version 23.0.7 and jdk17 and I have configured Custom Event Listener in my spring boot project, I have done the mvn clean install and have copy pasted the jar file in the providers folder but when i start keycloak it gives me this error because user_expleo is simple class :
package com.expleo.msauth.entity;
import com.expleo.msauth.enums.Status;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data @Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class User_expleo {
@Id
private String id;
private String firstName;
private String lastName;
private String userName;
private String email;
private String password;
@Enumerated(EnumType.STRING)
@Column(columnDefinition = "varchar(255) default 'OFFLINE'")
private Status status;
}
You must include the libraries in the jar file. And then use the -jar-with-dependencies.jar fiele from the target directory. I use the following in my jar file