[keycloak-user] Keycloak Admin Client dependencies for Keycloak 5.0.0?

Sebastien Blanc sblanc at redhat.com
Tue Apr 2 17:19:23 EDT 2019


This looks like more a Maven packaging issue that you have rather than an
issue with Keycloak. With are you using the shade plugin ? Maybe you should
try this approach https://stackoverflow.com/a/574650

On Tue, Apr 2, 2019 at 5:58 PM Jody H <j9dy1g at gmail.com> wrote:

> Hi Sebastien,
>
> unfortunately I can not make it work with your changes.
> This is my entire POM. Do you see anything that is wrong/missing?
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>keycloak-admin</groupId>
> <artifactId>keycloak-admin</artifactId>
> <version>0.0.1-SNAPSHOT</version>
>
> <properties>
> <maven.compiler.source>1.8</maven.compiler.source>
> <maven.compiler.target>1.8</maven.compiler.target>
>
> <keycloak.version>5.0.0</keycloak.version>
> <resteasy.version>3.1.3.Final</resteasy.version>
> <jackson.version>2.9.8</jackson.version>
> </properties>
>
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-shade-plugin</artifactId>
> <version>3.2.1</version>
> <executions>
> <execution>
> <phase>package</phase>
> <goals>
> <goal>shade</goal>
> </goals>
> <configuration>
> <transformers>
> <transformer
>
> implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
> <mainClass>com.test.KeycloakService</mainClass>
> </transformer>
> </transformers>
> <filters>
> <filter>
> <artifact>*:*</artifact>
> <excludes>
> <exclude>META-INF/*.SF</exclude>
> <exclude>META-INF/*.DSA</exclude>
> <exclude>META-INF/*.RSA</exclude>
> </excludes>
> </filter>
> </filters>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> <dependencies>
> <dependency>
> <groupId>org.keycloak</groupId>
> <artifactId>keycloak-admin-client</artifactId>
> <version>${keycloak.version}</version>
> </dependency>
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>resteasy-client</artifactId>
> <version>${resteasy.version}</version>
> </dependency>
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>resteasy-jackson2-provider</artifactId>
> <version>${resteasy.version}</version>
> </dependency>
> <dependency>
> <groupId>com.fasterxml.jackson.core</groupId>
> <artifactId>jackson-core</artifactId>
> <version>${jackson.version}</version>
> </dependency>
> <dependency>
> <groupId>com.fasterxml.jackson.core</groupId>
> <artifactId>jackson-databind</artifactId>
> <version>${jackson.version}</version>
> </dependency>
> <dependency>
> <groupId>com.fasterxml.jackson.core</groupId>
> <artifactId>jackson-annotations</artifactId>
> <version>${jackson.version}</version>
> </dependency>
> <dependency>
> <groupId>com.fasterxml.jackson.jaxrs</groupId>
> <artifactId>jackson-jaxrs-json-provider</artifactId>
> <version>${jackson.version}</version>
> </dependency>
> </dependencies>
>
> </project>
>
> Also, here is the mvn package output from my Windows machine:
> PS \eclipse-workspace\keycloak-admin> mvn package
> [INFO] Scanning for projects...
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building keycloak-admin 0.0.1-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
> keycloak-admin ---
> [WARNING] Using platform encoding (Cp1252 actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] Copying 0 resource
> [INFO]
> [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @
> keycloak-admin ---
> [INFO] Nothing to compile - all classes are up to date
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:testResources
> (default-testResources) @ keycloak-admin ---
> [WARNING] Using platform encoding (Cp1252 actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] Copying 0 resource
> [INFO]
> [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @
> keycloak-admin ---
> [INFO] Nothing to compile - all classes are up to date
> [INFO]
> [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @
> keycloak-admin ---
> [INFO]
> [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ keycloak-admin ---
> [INFO]
> [INFO] --- maven-shade-plugin:3.2.1:shade (default) @ keycloak-admin ---
> [INFO] Including org.keycloak:keycloak-admin-client:jar:5.0.0 in the
> shaded jar.
> [INFO] Including org.keycloak:keycloak-core:jar:5.0.0 in the shaded jar.
> [INFO] Including org.keycloak:keycloak-common:jar:5.0.0 in the shaded jar.
> [INFO] Including org.bouncycastle:bcprov-jdk15on:jar:1.60 in the shaded
> jar.
> [INFO] Including org.bouncycastle:bcpkix-jdk15on:jar:1.60 in the shaded
> jar.
> [INFO] Including org.jboss.resteasy:resteasy-client:jar:3.1.3.Final in the
> shaded jar.
> [INFO] Including org.jboss.resteasy:resteasy-jaxrs:jar:3.1.3.Final in the
> shaded jar.
> [INFO] Including org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.0_spec:jar:1.0.1.Beta1
> in the shaded jar.
> [INFO] Including
> org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final
> in the shaded jar.
> [INFO] Including javax.activation:activation:jar:1.1.1 in the shaded jar.
> [INFO] Including commons-io:commons-io:jar:2.5 in the shaded jar.
> [INFO] Including net.jcip:jcip-annotations:jar:1.0 in the shaded jar.
> [INFO] Including
> org.jboss.resteasy:resteasy-jaxrs-services:jar:3.1.3.Final in the shaded
> jar.
> [INFO] Including org.jboss.logging:jboss-logging:jar:3.3.0.Final in the
> shaded jar.
> [INFO] Including org.apache.httpcomponents:httpclient:jar:4.5.2 in the
> shaded jar.
> [INFO] Including org.apache.httpcomponents:httpcore:jar:4.4.4 in the
> shaded jar.
> [INFO] Including commons-logging:commons-logging:jar:1.2 in the shaded jar.
> [INFO] Including commons-codec:commons-codec:jar:1.9 in the shaded jar.
> [INFO] Including
> org.jboss.resteasy:resteasy-jackson2-provider:jar:3.1.3.Final in the shaded
> jar.
> [INFO] Including com.fasterxml.jackson.core:jackson-core:jar:2.9.8 in the
> shaded jar.
> [INFO] Including com.fasterxml.jackson.core:jackson-databind:jar:2.9.8 in
> the shaded jar.
> [INFO] Including com.fasterxml.jackson.core:jackson-annotations:jar:2.9.8
> in the shaded jar.
> [INFO] Including
> com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.9.8 in the
> shaded jar.
> [INFO] Including com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.9.8
> in the shaded jar.
> [INFO] Including
> com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.8 in
> the shaded jar.
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar,
> keycloak-admin-client-5.0.0.jar define 64 overlapping classes:
> [WARNING]   - org.keycloak.admin.client.resource.ScopePermissionsResource
> [WARNING]   - org.keycloak.admin.client.resource.TimePolicyResource
> [WARNING]   -
> org.keycloak.admin.client.resource.ClientRegistrationPolicyResource
> [WARNING]   -
> org.keycloak.admin.client.resource.UserStorageProviderResource
> [WARNING]   - org.keycloak.admin.client.resource.UserPolicyResource
> [WARNING]   - org.keycloak.admin.client.resource.ComponentsResource
> [WARNING]   -
> org.keycloak.admin.client.resource.ResourcePermissionsResource
> [WARNING]   - org.keycloak.admin.client.resource.RoleByIdResource
> [WARNING]   - org.keycloak.admin.client.resource.GroupResource
> [WARNING]   - org.keycloak.admin.client.resource.ClientPoliciesResource
> [WARNING]   - 54 more...
> [WARNING] resteasy-client-3.1.3.Final.jar,
> keycloak-admin-0.0.1-SNAPSHOT.jar define 106 overlapping classes:
> [WARNING]   - org.jboss.resteasy.client.jaxrs.cache.MapCache
> [WARNING]   - org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
> [WARNING]   -
> org.jboss.resteasy.client.jaxrs.internal.proxy.processors.invocation.CookieParamProcessor
> [WARNING]   -
> org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$1
> [WARNING]   -
> org.jboss.resteasy.client.jaxrs.internal.proxy.processors.WebTargetProcessor
> [WARNING]   - org.jboss.resteasy.client.jaxrs.internal.ClientInvocation
> [WARNING]   -
> org.jboss.resteasy.client.jaxrs.internal.proxy.processors.webtarget.PathParamProcessor
> [WARNING]   - org.jboss.resteasy.client.jaxrs.internal.ClientInvocation$4
> [WARNING]   -
> org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine
> [WARNING]   - org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder$2
> [WARNING]   - 96 more...
> [WARNING] jboss-jaxrs-api_2.0_spec-1.0.1.Beta1.jar,
> keycloak-admin-0.0.1-SNAPSHOT.jar define 127 overlapping classes:
> [WARNING]   - javax.ws.rs.ext.RuntimeDelegate$HeaderDelegate
> [WARNING]   - javax.ws.rs.DefaultValue
> [WARNING]   - javax.ws.rs.core.StreamingOutput
> [WARNING]   - javax.ws.rs.HEAD
> [WARNING]   - javax.ws.rs.ext.WriterInterceptor
> [WARNING]   - javax.ws.rs.core.Request
> [WARNING]   - javax.ws.rs.ext.Providers
> [WARNING]   - javax.ws.rs.container.Suspended
> [WARNING]   - javax.ws.rs.container.ConnectionCallback
> [WARNING]   - javax.ws.rs.client.Invocation
> [WARNING]   - 117 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, commons-codec-1.9.jar define
> 85 overlapping classes:
> [WARNING]   - org.apache.commons.codec.language.Nysiis
> [WARNING]   - org.apache.commons.codec.language.bm.Rule$1
> [WARNING]   - org.apache.commons.codec.language.bm.Rule$RPattern
> [WARNING]   -
> org.apache.commons.codec.language.ColognePhonetic$CologneInputBuffer
> [WARNING]   - org.apache.commons.codec.language.bm.BeiderMorseEncoder
> [WARNING]   - org.apache.commons.codec.digest.UnixCrypt
> [WARNING]   - org.apache.commons.codec.language.Soundex
> [WARNING]   - org.apache.commons.codec.binary.BinaryCodec
> [WARNING]   - org.apache.commons.codec.language.bm.Languages$1
> [WARNING]   - org.apache.commons.codec.language.bm.PhoneticEngine$1
> [WARNING]   - 75 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, httpclient-4.5.2.jar define
> 463 overlapping classes:
> [WARNING]   - org.apache.http.impl.cookie.RFC2109Spec
> [WARNING]   - org.apache.http.impl.execchain.MainClientExec
> [WARNING]   - org.apache.http.client.methods.HttpGet
> [WARNING]   - org.apache.http.conn.routing.RouteInfo$TunnelType
> [WARNING]   - org.apache.http.impl.cookie.BrowserCompatSpecFactory
> [WARNING]   - org.apache.http.impl.client.HttpAuthenticator
> [WARNING]   - org.apache.http.conn.ManagedClientConnection
> [WARNING]   - org.apache.http.client.protocol.RequestAuthCache
> [WARNING]   - org.apache.http.conn.params.ConnConnectionParamBean
> [WARNING]   - org.apache.http.impl.client.IdleConnectionEvictor
> [WARNING]   - 453 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, jackson-annotations-2.9.8.jar
> define 68 overlapping classes:
> [WARNING]   - com.fasterxml.jackson.annotation.JsonAutoDetect
> [WARNING]   - com.fasterxml.jackson.annotation.JsonInclude
> [WARNING]   - com.fasterxml.jackson.annotation.ObjectIdGenerators
> [WARNING]   - com.fasterxml.jackson.annotation.JsonFormat$Features
> [WARNING]   - com.fasterxml.jackson.annotation.JsonFormat$Feature
> [WARNING]   - com.fasterxml.jackson.annotation.JsonIgnore
> [WARNING]   - com.fasterxml.jackson.annotation.JsonSetter
> [WARNING]   - com.fasterxml.jackson.annotation.JsonTypeInfo$None
> [WARNING]   - com.fasterxml.jackson.annotation.JsonFormat$Shape
> [WARNING]   - com.fasterxml.jackson.annotation.JsonSubTypes
> [WARNING]   - 58 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar,
> jboss-annotations-api_1.2_spec-1.0.0.Final.jar define 15 overlapping
> classes:
> [WARNING]   - javax.annotation.ManagedBean
> [WARNING]   - javax.annotation.PreDestroy
> [WARNING]   - javax.annotation.Resource$AuthenticationType
> [WARNING]   - javax.annotation.Generated
> [WARNING]   - javax.annotation.security.DeclareRoles
> [WARNING]   - javax.annotation.Priority
> [WARNING]   - javax.annotation.Resource
> [WARNING]   - javax.annotation.security.DenyAll
> [WARNING]   - javax.annotation.security.RunAs
> [WARNING]   - javax.annotation.sql.DataSourceDefinitions
> [WARNING]   - 5 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, bcpkix-jdk15on-1.60.jar
> define 674 overlapping classes:
> [WARNING]   - org.bouncycastle.cert.dane.DANEEntrySelectorFactory
> [WARNING]   - org.bouncycastle.cert.dane.DANEEntryFactory
> [WARNING]   - org.bouncycastle.cert.jcajce.JcaX500NameUtil
> [WARNING]   - org.bouncycastle.cert.crmf.PKMACBuilder$1
> [WARNING]   - org.bouncycastle.cert.X509v2CRLBuilder
> [WARNING]   - org.bouncycastle.cert.ocsp.CertificateStatus
> [WARNING]   - org.bouncycastle.cms.jcajce.EnvelopedDataHelper$2
> [WARNING]   - org.bouncycastle.eac.jcajce.DefaultEACHelper
> [WARNING]   -
> org.bouncycastle.cert.path.validations.BasicConstraintsValidation
> [WARNING]   - org.bouncycastle.operator.bc.BcDSAContentSignerBuilder
> [WARNING]   - 664 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, bcprov-jdk15on-1.60.jar
> define 3330 overlapping classes:
> [WARNING]   - org.bouncycastle.crypto.tls.HeartbeatMode
> [WARNING]   - org.bouncycastle.crypto.modes.gcm.Tables8kGCMMultiplier
> [WARNING]   -
> org.bouncycastle.jcajce.provider.asymmetric.ecgost.KeyFactorySpi
> [WARNING]   - org.bouncycastle.jcajce.provider.symmetric.AES$AlgParamsCCM
> [WARNING]   - org.bouncycastle.asn1.cmc.CMCStatusInfoV2
> [WARNING]   - org.bouncycastle.jcajce.provider.digest.SHA384$Mappings
> [WARNING]   - org.bouncycastle.asn1.x509.CRLNumber
> [WARNING]   - org.bouncycastle.jcajce.provider.digest.SM3
> [WARNING]   - org.bouncycastle.asn1.x509.TBSCertList$1
> [WARNING]   - org.bouncycastle.jcajce.provider.symmetric.GOST28147$Mac
> [WARNING]   - 3320 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar,
> resteasy-jaxrs-3.1.3.Final.jar define 404 overlapping classes:
> [WARNING]   - org.jboss.resteasy.plugins.delegates.NewCookieHeaderDelegate
> [WARNING]   -
> org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistry$AscendingPrecedenceComparator
> [WARNING]   - org.jboss.resteasy.spi.MethodNotAllowedException
> [WARNING]   - org.jboss.resteasy.util.ReadFromStream
> [WARNING]   - org.jboss.resteasy.core.ExceptionAdapter
> [WARNING]   -
> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrapClasses
> [WARNING]   - org.jboss.resteasy.spi.ResteasyAsynchronousResponse
> [WARNING]   -
> org.jboss.resteasy.plugins.interceptors.GZIPEncodingInterceptor$CommittedGZIPOutputStream
> [WARNING]   - org.jboss.resteasy.spi.HttpRequestPreprocessor
> [WARNING]   - org.jboss.resteasy.spi.DecoratorProcessor
> [WARNING]   - 394 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, activation-1.1.1.jar define
> 38 overlapping classes:
> [WARNING]   - javax.activation.DataContentHandlerFactory
> [WARNING]   - javax.activation.ObjectDataContentHandler
> [WARNING]   - javax.activation.DataContentHandler
> [WARNING]   - com.sun.activation.viewers.TextViewer
> [WARNING]   - com.sun.activation.registries.MimeTypeEntry
> [WARNING]   - com.sun.activation.registries.LogSupport
> [WARNING]   - javax.activation.CommandObject
> [WARNING]   - javax.activation.SecuritySupport$2
> [WARNING]   - com.sun.activation.viewers.TextEditor
> [WARNING]   - com.sun.activation.viewers.ImageViewerCanvas
> [WARNING]   - 28 more...
> [WARNING] commons-io-2.5.jar, keycloak-admin-0.0.1-SNAPSHOT.jar define 123
> overlapping classes:
> [WARNING]   - org.apache.commons.io.FileCleaningTracker
> [WARNING]   - org.apache.commons.io.comparator.SizeFileComparator
> [WARNING]   - org.apache.commons.io.input.CloseShieldInputStream
> [WARNING]   - org.apache.commons.io.filefilter.EmptyFileFilter
> [WARNING]   - org.apache.commons.io.monitor.FileEntry
> [WARNING]   - org.apache.commons.io.output.ThresholdingOutputStream
> [WARNING]   - org.apache.commons.io.input.TailerListener
> [WARNING]   - org.apache.commons.io.IOExceptionWithCause
> [WARNING]   - org.apache.commons.io.comparator.PathFileComparator
> [WARNING]   - org.apache.commons.io.filefilter.NotFileFilter
> [WARNING]   - 113 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, jcip-annotations-1.0.jar
> define 4 overlapping classes:
> [WARNING]   - net.jcip.annotations.GuardedBy
> [WARNING]   - net.jcip.annotations.NotThreadSafe
> [WARNING]   - net.jcip.annotations.ThreadSafe
> [WARNING]   - net.jcip.annotations.Immutable
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, jackson-databind-2.9.8.jar
> define 624 overlapping classes:
> [WARNING]   -
> com.fasterxml.jackson.databind.introspect.AnnotationCollector$NoAnnotations
> [WARNING]   - com.fasterxml.jackson.databind.BeanDescription
> [WARNING]   -
> com.fasterxml.jackson.databind.deser.impl.BeanAsArrayBuilderDeserializer
> [WARNING]   - com.fasterxml.jackson.databind.introspect.AnnotatedMethodMap
> [WARNING]   - com.fasterxml.jackson.databind.SerializerProvider
> [WARNING]   -
> com.fasterxml.jackson.databind.introspect.AnnotationCollector$OneAnnotation
> [WARNING]   -
> com.fasterxml.jackson.databind.ser.std.StaticListSerializerBase
> [WARNING]   -
> com.fasterxml.jackson.databind.ser.std.NumberSerializers$ShortSerializer
> [WARNING]   - com.fasterxml.jackson.databind.ser.BeanSerializerFactory
> [WARNING]   -
> com.fasterxml.jackson.databind.introspect.AnnotationCollector$TwoAnnotations
> [WARNING]   - 614 more...
> [WARNING] jackson-core-2.9.8.jar, keycloak-admin-0.0.1-SNAPSHOT.jar define
> 107 overlapping classes:
> [WARNING]   - com.fasterxml.jackson.core.JsonGenerator$Feature
> [WARNING]   -
> com.fasterxml.jackson.core.util.ThreadLocalBufferManager$ThreadLocalBufferManagerHolder
> [WARNING]   - com.fasterxml.jackson.core.util.Separators
> [WARNING]   - com.fasterxml.jackson.core.io.SegmentedStringWriter
> [WARNING]   - com.fasterxml.jackson.core.TreeNode
> [WARNING]   - com.fasterxml.jackson.core.sym.Name
> [WARNING]   - com.fasterxml.jackson.core.util.RequestPayload
> [WARNING]   - com.fasterxml.jackson.core.util.JsonGeneratorDelegate
> [WARNING]   - com.fasterxml.jackson.core.async.NonBlockingInputFeeder
> [WARNING]   - com.fasterxml.jackson.core.JsonFactory
> [WARNING]   - 97 more...
> [WARNING] keycloak-common-5.0.0.jar, keycloak-admin-0.0.1-SNAPSHOT.jar
> define 75 overlapping classes:
> [WARNING]   - org.keycloak.common.util.RandomString
> [WARNING]   - org.keycloak.common.constants.KerberosConstants
> [WARNING]   - org.keycloak.common.util.EnvUtil
> [WARNING]   - org.keycloak.common.Profile$Feature
> [WARNING]   - org.keycloak.common.util.HostUtils
> [WARNING]   - org.keycloak.common.util.NetworkUtils
> [WARNING]   - org.keycloak.common.util.KeystoreUtil$KeystoreFormat
> [WARNING]   -
> org.keycloak.common.util.reflections.SetAccessiblePrivilegedAction
> [WARNING]   - org.keycloak.common.util.OCSPUtils$2
> [WARNING]   - org.keycloak.common.util.KerberosJdkProvider
> [WARNING]   - 65 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, httpcore-4.4.4.jar define 254
> overlapping classes:
> [WARNING]   - org.apache.http.protocol.HttpRequestHandler
> [WARNING]   - org.apache.http.impl.io.ChunkedOutputStream
> [WARNING]   - org.apache.http.protocol.ChainBuilder
> [WARNING]   -
> org.apache.http.impl.entity.DisallowIdentityContentLengthStrategy
> [WARNING]   - org.apache.http.impl.ConnSupport
> [WARNING]   - org.apache.http.impl.io.DefaultHttpResponseParserFactory
> [WARNING]   - org.apache.http.NameValuePair
> [WARNING]   - org.apache.http.HttpClientConnection
> [WARNING]   - org.apache.http.protocol.HttpExpectationVerifier
> [WARNING]   - org.apache.http.protocol.UriPatternMatcher
> [WARNING]   - 244 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, keycloak-core-5.0.0.jar
> define 236 overlapping classes:
> [WARNING]   - org.keycloak.json.StringOrArraySerializer
> [WARNING]   - org.keycloak.representations.JsonWebToken
> [WARNING]   -
> org.keycloak.representations.idm.RealmEventsConfigRepresentation
> [WARNING]   - org.keycloak.TokenVerifier$Predicate
> [WARNING]   - org.keycloak.crypto.KeyUse
> [WARNING]   - org.keycloak.representations.adapters.config.BaseRealmConfig
> [WARNING]   - org.keycloak.crypto.KeyStatus
> [WARNING]   - org.keycloak.representations.idm.CertificateRepresentation
> [WARNING]   - org.keycloak.TokenVerifier$4
> [WARNING]   - org.keycloak.crypto.HashException
> [WARNING]   - 226 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar,
> jackson-jaxrs-json-provider-2.9.8.jar define 9 overlapping classes:
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.annotation.JSONP$Def
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator$1
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.PackageVersion
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.annotation.JacksonFeatures
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.annotation.JSONP
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.JsonEndpointConfig
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider
> [WARNING]   - com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, jackson-jaxrs-base-2.9.8.jar
> define 19 overlapping classes:
> [WARNING]   -
> com.fasterxml.jackson.jaxrs.base.nocontent.JaxRS1NoContentExceptionSupplier
> [WARNING]   - com.fasterxml.jackson.jaxrs.base.ProviderBase
> [WARNING]   - com.fasterxml.jackson.jaxrs.base.NoContentExceptionSupplier
> [WARNING]   - com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures
> [WARNING]   - com.fasterxml.jackson.jaxrs.cfg.MapperConfiguratorBase
> [WARNING]   - com.fasterxml.jackson.jaxrs.cfg.ObjectReaderInjector
> [WARNING]   - com.fasterxml.jackson.jaxrs.cfg.ObjectReaderModifier
> [WARNING]   -
> com.fasterxml.jackson.jaxrs.base.nocontent.JaxRS2NoContentExceptionSupplier
> [WARNING]   - com.fasterxml.jackson.jaxrs.base.JsonParseExceptionMapper
> [WARNING]   - com.fasterxml.jackson.jaxrs.util.EndpointAsBeanProperty
> [WARNING]   - 9 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, jboss-logging-3.3.0.Final.jar
> define 48 overlapping classes:
> [WARNING]   - org.jboss.logging.MDC
> [WARNING]   - org.jboss.logging.LogMessage
> [WARNING]   - org.jboss.logging.Param
> [WARNING]   - org.jboss.logging.Log4j2Logger
> [WARNING]   - org.jboss.logging.NDC
> [WARNING]   - org.jboss.logging.Messages$1
> [WARNING]   - org.jboss.logging.Message
> [WARNING]   - org.jboss.logging.LoggerProvider
> [WARNING]   - org.jboss.logging.Logger$Level
> [WARNING]   - org.jboss.logging.Log4jLoggerProvider
> [WARNING]   - 38 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar,
> jackson-module-jaxb-annotations-2.9.8.jar define 12 overlapping classes:
> [WARNING]   -
> com.fasterxml.jackson.module.jaxb.ser.DomElementJsonSerializer
> [WARNING]   -
> com.fasterxml.jackson.module.jaxb.deser.DataHandlerJsonDeserializer$1
> [WARNING]   - com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector
> [WARNING]   -
> com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule$Priority
> [WARNING]   -
> com.fasterxml.jackson.module.jaxb.deser.DomElementJsonDeserializer
> [WARNING]   - com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule$1
> [WARNING]   -
> com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector$1
> [WARNING]   - com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule
> [WARNING]   -
> com.fasterxml.jackson.module.jaxb.deser.DataHandlerJsonDeserializer
> [WARNING]   - com.fasterxml.jackson.module.jaxb.PackageVersion
> [WARNING]   - 2 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar, commons-logging-1.2.jar
> define 28 overlapping classes:
> [WARNING]   - org.apache.commons.logging.LogSource
> [WARNING]   - org.apache.commons.logging.impl.ServletContextCleaner
> [WARNING]   - org.apache.commons.logging.Log
> [WARNING]   - org.apache.commons.logging.LogFactory$3
> [WARNING]   - org.apache.commons.logging.impl.LogFactoryImpl$2
> [WARNING]   - org.apache.commons.logging.impl.LogKitLogger
> [WARNING]   - org.apache.commons.logging.LogConfigurationException
> [WARNING]   - org.apache.commons.logging.impl.Jdk14Logger
> [WARNING]   - org.apache.commons.logging.impl.WeakHashtable$Referenced
> [WARNING]   - org.apache.commons.logging.impl.WeakHashtable$WeakKey
> [WARNING]   - 18 more...
> [WARNING] keycloak-admin-0.0.1-SNAPSHOT.jar,
> resteasy-jackson2-provider-3.1.3.Final.jar define 8 overlapping classes:
> [WARNING]   - org.jboss.resteasy.annotations.providers.NoJackson
> [WARNING]   -
> org.jboss.resteasy.plugins.providers.jackson.UnrecognizedPropertyExceptionHandler
> [WARNING]   -
> org.jboss.resteasy.plugins.providers.jackson.Jackson2JsonpInterceptor
> [WARNING]   -
> org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider$ClassAnnotationKey
> [WARNING]   -
> org.jboss.resteasy.plugins.providers.jackson.Jackson2JsonpInterceptor$DoNotCloseDelegateOutputStream
> [WARNING]   - org.jboss.resteasy.annotations.providers.jackson.Formatted
> [WARNING]   -
> org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider$1
> [WARNING]   -
> org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider
> [WARNING] maven-shade-plugin has detected that some class files are
> [WARNING] present in two or more JARs. When this happens, only one
> [WARNING] single version of the class is copied to the uber jar.
> [WARNING] Usually this is not harmful and you can skip these warnings,
> [WARNING] otherwise try to manually exclude artifacts based on
> [WARNING] mvn dependency:tree -Ddetail=true and the above output.
> [WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
> [INFO] Replacing original artifact with shaded artifact.
> [INFO] Replacing
> C:\Users\jody\eclipse-workspace\keycloak-admin\target\keycloak-admin-0.0.1-SNAPSHOT.jar
> with
> C:\Users\jody\eclipse-workspace\keycloak-admin\target\keycloak-admin-0.0.1-SNAPSHOT-shaded.jar
> [INFO] Dependency-reduced POM written at:
> C:\Users\jody\eclipse-workspace\keycloak-admin\dependency-reduced-pom.xml
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 4.586 s
> [INFO] Finished at: 2019-04-02T17:54:51+02:00
> [INFO] Final Memory: 17M/428M
> [INFO]
> -----------------------------------------------------------------------
>
> Is this the same for your build?
>
> Thanks for your help
> Jody
>
> Am Di., 2. Apr. 2019 um 10:22 Uhr schrieb Sebastien Blanc <
> sblanc at redhat.com>:
>
>> Hi,
>>
>> Your first error is because you forgot "http://" .
>> For the second one, it's working for me with the pom you provided. You
>> are probably not passing the needed classpath libs in your java -jar
>> command (or include the dependencies in your jar)
>>
>> On Mon, Apr 1, 2019 at 10:51 PM Jody H <j9dy1g at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have looked around on Google for a while now but I can't seem to figure
>>> out my problem. I mostly used the Gist from Github here to get started:
>>> https://gist.github.com/thomasdarimont/43689aefb37540624e35
>>> After things were not really working out, I tried some other stuff that
>>> you
>>> can find below:
>>> I am trying to use the Keycloak admin client in Java, version 5.0.0.
>>>
>>> My POM contains the following:
>>>
>>> <properties>
>>> <maven.compiler.source>1.8</maven.compiler.source>
>>> <maven.compiler.target>1.8</maven.compiler.target>
>>>
>>> <keycloak.version>5.0.0</keycloak.version>
>>> <resteasy.version>3.1.3.Final</resteasy.version>
>>> <jackson.version>2.9.8</jackson.version>
>>> </properties>
>>>
>>> <dependencies>
>>> <dependency>
>>> <groupId>org.keycloak</groupId>
>>> <artifactId>keycloak-admin-client</artifactId>
>>> <version>${keycloak.version}</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.jboss.resteasy</groupId>
>>> <artifactId>resteasy-client</artifactId>
>>> <version>${resteasy.version}</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.jboss.resteasy</groupId>
>>> <artifactId>resteasy-jackson2-provider</artifactId>
>>> <version>${resteasy.version}</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.fasterxml.jackson.core</groupId>
>>> <artifactId>jackson-core</artifactId>
>>> <version>${jackson.version}</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.fasterxml.jackson.core</groupId>
>>> <artifactId>jackson-databind</artifactId>
>>> <version>${jackson.version}</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.fasterxml.jackson.core</groupId>
>>> <artifactId>jackson-annotations</artifactId>
>>> <version>${jackson.version}</version>
>>> </dependency>
>>> <dependency>
>>> <groupId>com.fasterxml.jackson.jaxrs</groupId>
>>> <artifactId>jackson-jaxrs-json-provider</artifactId>
>>> <version>${jackson.version}</version>
>>> </dependency>
>>> </dependencies>
>>>
>>> When I add the following code, building the keycloak client fails:
>>> Keycloak keycloak =
>>>
>>> KeycloakBuilder.builder().serverUrl("localhost:8080/auth").realm("master")
>>> .username("admin").password("admin").clientId("admin-cli").build();
>>>
>>> System.out.println(keycloak.serverInfo().getInfo().toString());
>>>
>>> Produces the following exception:
>>>  java -jar .\keycloak-admin-0.0.1-SNAPSHOT.jar
>>> Exception in thread "main" java.lang.IllegalArgumentException:
>>> RESTEASY003720: path param realm has not been provided by the parameter
>>> map
>>>         at
>>>
>>> org.jboss.resteasy.specimpl.ResteasyUriBuilder.replaceParameter(ResteasyUriBuilder.java:659)
>>>         at
>>>
>>> org.jboss.resteasy.specimpl.ResteasyUriBuilder.buildString(ResteasyUriBuilder.java:581)
>>>         at
>>>
>>> org.jboss.resteasy.specimpl.ResteasyUriBuilder.buildFromValues(ResteasyUriBuilder.java:780)
>>>         at
>>>
>>> org.jboss.resteasy.specimpl.ResteasyUriBuilder.build(ResteasyUriBuilder.java:772)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.getUri(ClientWebTarget.java:107)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.createRequest(ClientInvoker.java:124)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:104)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
>>>         at com.sun.proxy.$Proxy15.grantToken(Unknown Source)
>>>         at
>>>
>>> org.keycloak.admin.client.token.TokenManager.grantToken(TokenManager.java:89)
>>>         at
>>>
>>> org.keycloak.admin.client.token.TokenManager.getAccessToken(TokenManager.java:69)
>>>         at
>>>
>>> org.keycloak.admin.client.token.TokenManager.getAccessTokenString(TokenManager.java:64)
>>>         at
>>>
>>> org.keycloak.admin.client.resource.BearerAuthFilter.filter(BearerAuthFilter.java:52)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:431)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:105)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
>>>         at com.sun.proxy.$Proxy17.getInfo(Unknown Source)
>>>
>>> When using the Keycloak.getInstance method, I get another exception:
>>> Keycloak keycloak = Keycloak.getInstance("http://localhost:8080/auth",
>>> "master", "admin", "admin", "admin-cli");
>>>
>>> Produces exception:
>>> Exception in thread "main"
>>> javax.ws.rs.client.ResponseProcessingException:
>>> javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a
>>> MessageBodyReader of content-type application/json and type class
>>> org.keycloak.representations.AccessTokenResponse
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:156)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:60)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:107)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
>>>         at com.sun.proxy.$Proxy15.grantToken(Unknown Source)
>>>         at
>>>
>>> org.keycloak.admin.client.token.TokenManager.grantToken(TokenManager.java:89)
>>>         at
>>>
>>> org.keycloak.admin.client.token.TokenManager.getAccessToken(TokenManager.java:69)
>>>         at
>>>
>>> org.keycloak.admin.client.token.TokenManager.getAccessTokenString(TokenManager.java:64)
>>>         at
>>>
>>> org.keycloak.admin.client.resource.BearerAuthFilter.filter(BearerAuthFilter.java:52)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:431)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:105)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
>>>         at com.sun.proxy.$Proxy17.getInfo(Unknown Source)
>>>         at test.KeycloakAdmin.main(MyMain.java:17)
>>> Caused by: javax.ws.rs.ProcessingException: RESTEASY003145: Unable to
>>> find
>>> a MessageBodyReader of content-type application/json and type class
>>> org.keycloak.representations.AccessTokenResponse
>>>         at
>>>
>>> org.jboss.resteasy.core.interception.jaxrs.ClientReaderInterceptorContext.throwReaderNotFound(ClientReaderInterceptorContext.java:42)
>>>         at
>>>
>>> org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.getReader(AbstractReaderInterceptorContext.java:80)
>>>         at
>>>
>>> org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:266)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readEntity(ClientResponse.java:196)
>>>         at
>>>
>>> org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:212)
>>>         at
>>>
>>> org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:120)
>>>         ... 13 more
>>>
>>> Can someone share insight on how to use the keycloak admin client library
>>> in the most recent version? Which dependencies do I need inside of my
>>> pom?
>>>
>>> Thanks!
>>> _______________________________________________
>>> 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