casinthecloud / cas-pac4j-oauth-demo

CAS server demo to test the authentication delegation
https://www.casinthecloud.com
76 stars 62 forks source link

errors after clean instalation following the instructions #34

Closed ioandev closed 7 years ago

ioandev commented 7 years ago

Hi, I am getting the following errors:

This is after a clean instalation on an empty virtual machine with just java and maven installed.

All I did is I've changed "localhost" in service resources to the machine's IP: 192.168.35.44


2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/istack-commons-runtime-2.16.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/cas-server-core-validation-5.0.0.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/spring-cloud-context-1.1.3.RELEASE.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/groovy-groovysh-2.4.7.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/jstl-1.2.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/hibernate-validator-5.2.4.Final.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/spring-extensions-5.1.1.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/stax2-api-3.1.4.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/thymeleaf-layout-dialect-2.0.3.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/javax.json-api-1.0.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,049 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/tomcat-embed-el-8.5.5.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,050 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/jcip-annotations-1.0-1.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,050 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/spring-cloud-starter-config-1.2.0.RELEASE.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,050 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/reflections-0.9.10.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,051 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/spring-tx-4.3.3.RELEASE.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
2017-01-12 16:33:40,051 WARN [org.apache.catalina.webresources.Cache] - <Unable to add the resource at [/WEB-INF/lib/cas-server-support-json-service-registry-5.0.0.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache>
[..]
2017-01-12 16:35:02,840 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <New service definition could not be loaded from [/tmp/cas/services/oauthclient-1.json]>
2017-01-12 16:35:02,848 ERROR [org.apereo.cas.services.AbstractResourceBasedServiceRegistryDao] - <Error reading configuration file oauthclient-11.json>
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Invalid type id 'org.apereo.cas.support.oauth.services.OAuthRegisteredService' (for id type 'Id.class'): no such class found
        at org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer.from(AbstractJacksonBackedStringSerializer.java:122) ~[cas-server-core-util-5.0.0.jar!/:5.0.0]
        at org.apereo.cas.services.AbstractResourceBasedServiceRegistryDao.load(AbstractResourceBasedServiceRegistryDao.java:211) ~[cas-server-core-services-5.0.0.jar!/:5.0.0]
        at org.apereo.cas.services.ServiceRegistryConfigWatcher.handleCreateEvent(ServiceRegistryConfigWatcher.java:166) ~[cas-server-core-services-5.0.0.jar!/:5.0.0]
        at org.apereo.cas.services.ServiceRegistryConfigWatcher.lambda$handleEvent$1(ServiceRegistryConfigWatcher.java:117) ~[cas-server-core-services-5.0.0.jar!/:5.0.0]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:1.8.0_111]
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_111]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:1.8.0_111]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_111]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_111]
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_111]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_111]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_111]
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_111]
        at org.apereo.cas.services.ServiceRegistryConfigWatcher.handleEvent(ServiceRegistryConfigWatcher.java:104) ~[cas-server-core-services-5.0.0.jar!/:5.0.0]
        at org.apereo.cas.services.ServiceRegistryConfigWatcher.run(ServiceRegistryConfigWatcher.java:75) ~[cas-server-core-services-5.0.0.jar!/:5.0.0]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: java.lang.IllegalArgumentException: Invalid type id 'org.apereo.cas.support.oauth.services.OAuthRegisteredService' (for id type 'Id.class'): no such class found
        at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver._typeFromId(ClassNameIdResolver.java:66) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver.typeFromId(ClassNameIdResolver.java:48) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:154) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:108) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:93) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:131) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:42) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3736) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2726) ~[jackson-databind-2.6.5.jar!/:2.6.5]
        at org.apereo.cas.util.serialization.AbstractJacksonBackedStringSerializer.from(AbstractJacksonBackedStringSerializer.java:120) ~[cas-server-core-util-5.0.0.jar!/:5.0.0]
        ... 15 more
2017-01-12 16:35:02,855 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <New service definition could not be loaded from [/tmp/cas/services/oauthclient-11.json]>
2017-01-12 16:35:02,902 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [^https://www.apereo.org] with a duplicate id [10000002] in [/tmp/cas/services/Apereo-10000002.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2017-01-12 16:35:02,906 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [http://192.168.35.44:8080/cas/login\?client_name=CasClient] with a duplicate id [2] in [/tmp/cas/services/casclient-2.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.> 2017-01-12 16:35:02,908 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [^(https|imaps)://.*] with a duplicate id [10000001] in [/tmp/cas/services/HTTPSandIMAPS-10000001.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2017-01-12 16:35:02,909 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [http://192.168.35.44:8080/cas/login\?client_name=CasOAuthWrapperClient] with a duplicate id [1] in [/tmp/cas/services/oauthclient-1.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2017-01-12 16:35:02,911 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [http://192.168.35.44:9000/callback\?client_name=CasClient] with a duplicate id [11] in [/tmp/cas/services/oauthclient-11.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2017-01-12 16:35:07,155 INFO [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/cas]] - <Initializing Spring embedded WebApplicationContext>
2017-01-12 16:35:08,065 WARN [org.apereo.cas.config.CasPersonDirectoryAttributeRepositoryConfiguration] - <Found and added static attributes to the attribute repository>
2017-01-12 16:35:22,691 WARN [org.apereo.cas.config.CasSecurityContextConfiguration] - <>
[..]```
leleuj commented 7 years ago

Very strange! I don't reproduce this error, this class really exists in CAS 5. Or the cas-server-support-oauth dependency is missing in your classpath?

ioandev commented 7 years ago

This is my root pom.xml file:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.leleuj</groupId>
    <artifactId>cas-pac4j-oauth-demo</artifactId>
    <version>5.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>CAS Pac4J / OAuth demo</name>
    <description>CAS Pac4J / OAuth demo</description>

    <repositories>
        <repository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>jasig-developer-repo</id>
            <name>Jasig developer repository</name>
            <url>http://developer.jasig.org/repo/content/groups/m2-legacy/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>shibboleth-public-repo</id>
            <name>Shibboleth releases repository</name>
            <url>https://build.shibboleth.net/nexus/content/groups/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apereo.cas</groupId>
                <artifactId>cas-server-webapp</artifactId>
                <version>${cas.version}</version>
                <type>war</type>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.apereo.cas</groupId>
                <artifactId>cas-server-support-json-service-registry</artifactId>
                <version>${cas.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <modules>
        <module>cas-pac4j-oauth-client-demo</module>
        <module>cas-pac4j-oauth-server-demo</module>
    </modules>

    <properties>
        <cas.version>5.0.0</cas.version>
        <java.version>1.8</java.version>
    </properties>
</project>

client pom.xml:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.leleuj</groupId>
        <artifactId>cas-pac4j-oauth-demo</artifactId>
        <version>5.0.0-SNAPSHOT</version>
    </parent>
    <artifactId>cas-pac4j-oauth-client-demo</artifactId>
    <packaging>war</packaging>
    <name>CAS Pac4J / OAuth client demo</name>
    <description>CAS Pac4J / OAuth client demo</description>

    <dependencies>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-webapp</artifactId>
            <type>war</type>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-pac4j-webflow</artifactId>
            <version>${cas.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-json-service-registry</artifactId>
        </dependency>
        <dependency>
            <groupId>org.pac4j</groupId>
            <artifactId>pac4j-oauth</artifactId>
            <version>${pac4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.pac4j</groupId>
            <artifactId>pac4j-cas</artifactId>
            <version>${pac4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.pac4j</groupId>
            <artifactId>pac4j-openid</artifactId>
            <version>${pac4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.pac4j</groupId>
            <artifactId>pac4j-http</artifactId>
            <version>${pac4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.pac4j</groupId>
            <artifactId>pac4j-saml</artifactId>
            <version>${pac4j.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>cas</warName>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <recompressZippedFiles>false</recompressZippedFiles>
                    <archive>
                        <compress>false</compress>
                        <manifestFile>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                    <overlays>
                        <overlay>
                            <groupId>org.apereo.cas</groupId>
                            <artifactId>cas-server-webapp</artifactId>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
        <finalName>cas</finalName>
    </build>

    <properties>
        <pac4j.version>1.9.4</pac4j.version>
    </properties>

</project>

server pom.xml

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.leleuj</groupId>
        <artifactId>cas-pac4j-oauth-demo</artifactId>
        <version>5.0.0-SNAPSHOT</version>
    </parent>
    <artifactId>cas-pac4j-oauth-server-demo</artifactId>
    <packaging>war</packaging>
    <name>CAS Pac4J / OAuth server demo</name>
    <description>CAS Pac4J / OAuth server demo</description>

    <dependencies>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-webapp</artifactId>
            <type>war</type>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-json-service-registry</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-oauth</artifactId>
            <version>${cas.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-oidc</artifactId>
            <version>${cas.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>cas2</warName>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <recompressZippedFiles>false</recompressZippedFiles>
                    <archive>
                        <compress>false</compress>
                        <manifestFile>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                    <overlays>
                        <overlay>
                            <groupId>org.apereo.cas</groupId>
                            <artifactId>cas-server-webapp</artifactId>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
        <finalName>cas2</finalName>
    </build>

</project>
leleuj commented 7 years ago

It seems to be the pom.xml files from the demos: did you make any change? I see the OAuth dependency on the server it should be ok. You should check the dependency inside the cas2.war file.

ioandev commented 7 years ago

I haven't made any changes, no. Which dependency should I check?

leleuj commented 7 years ago

Unzip the war and search the WEB-INF/lib directory for the OAuth dependency...

ioandev commented 7 years ago

Hi leleuj,

Yes, oauth2-oidc-sdk-5.16.jar is present in the location you've said.

leleuj commented 7 years ago

I meant: the cas-server-support-oauth jar

leleuj commented 7 years ago

and cas-server-support-oauth-core.jar

ioandev commented 7 years ago

Yea, I've got cas-server-support-oauth-5.0.0.jar and cas-server-support-oauth-core-5.0.0.jar

leleuj commented 7 years ago

It feels like a mystery: can you share your cas2.war somewhere so I can test it?

ioandev commented 7 years ago

Here you go: https://www.dropbox.com/s/mbpiqr53u8y60ep/cas2.war?dl=0

leleuj commented 7 years ago

It starts perfectly on my Mac.