Issue with okta-spring-boot-saml-example

Hello,

I have downloaded sample “Okta SAML Toolkit for Java” from downloads. While trying to build war file from maven, I am getting following error “Failed to execute goal on project webapp: Could not resolve dependencies for project com.okta:webapp:war:2.0.5-fa68307: Failed to collect dependencies at com.okta:saml-toolkit:jar:2.0.5-fa68307: Failed to read artifact descriptor for com.okta:saml-toolkit:jar:2.0.5-fa68307: Could not transfer artifact com.okta:saml-toolkit:pom:2.0.5-fa68307 from/to central-okta-topic (https://artifacts.aue1d.saasure.com/artifactory/topic): Connect to artifacts.aue1d.saasure.com:443 [artifacts.aue1d.saasure.com/10.238.58.203] failed: Operation timed out (Connection timed out)”

Is this still valid link? If not what is correct link for the same.

Prasad

Hey @nprasad18

You can remove the repository and pluginRepository from the root pom which will download the jars from central (or your where your maven settings.xml points).

You will run into an issue with jndi:jndi:1.2.1:jar and jta:jta:jar:1.0.1 I’m guessing you just exclude them or install them directly in your local maven repository.

I’ll create a task for us to update this project.

@bdemers

Thanks that helped. I installed both jndi & saml-tookit jar manually into local maven repository. But did not remove any dependencies, it would caused build to fail.

I have another issue BTW.
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/webapp-2.0.5-fa68307] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVector]

I tried to set higher memory using following command export CATALINA_OPTS="-Xms512M -Xmx1024M"
But did not help. Any solutions here to get through this problem?

  • Prasad

I tried to set
echo $JAVA_OPTS
-Xmx2048m -Xms512m

But still I get above error mentioned

Looks like there are two versions of bouncy castle on the classpath org.bouncycastle:bcprov-jdk15on:jar:1.51 and org.bouncycastle:bcprov-jdk16:jar:1.45

You should be able to exclude one:

<dependency>
    <groupId>com.okta</groupId>
    <artifactId>saml-toolkit</artifactId>
   <exclusions>
        <exclusion>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
        </exclusion>
    </exclusions>
</dependency>

If that doesn’t help, let me know the OS and JDK you are using and I’ll try to reproduce the issue.

Did not find the pom.xml. Rebuilding maven package did the trick, error went away

@bdemers - I am able to build, deploy war file and able to run tomcat without issues. But I have new issue

when i run localhost:8080/hello - I get following message - org.apache.tomcat.util.http.parser.Cookie.logInvalidHeader A cookie header was received [responseType":[“id_token”,“token”],“state”:“9Y3dpMVUprhK3sJpHL43qI2DF0WBWEscckj6LBiC6rrXzTaYj2EyiMdr8JhwvssL”,“nonce”:“tfTlcaiYZCvygdOc5O8rG1lbaBkM4SUiRRPIzkcKi0upJ0diEkOaBBzq1f91NwvP”,“scopes”:[“openid”,“profile”,“email”],“urls”:{“issuer”:“https://dev-622847.oktapreview.com/oauth2/default",“authorizeUrl”:“https://dev-622847.oktapreview.com/oauth2/default/v1/authorize”,“userinfoUrl”:"https://dev-622847.oktapreview.com/oauth2/default/v1/userinfo”}}; okta-oauth-nonce=tfTlcaiYZCvygdOc5O8rG1lbaBkM4SUiRRPIzkcKi0upJ0diEkOaBBzq1f91NwvP; okta-oauth-state=9Y3dpMVUprhK3sJpHL43qI2DF0WBWEscckj6LBiC6rrXzTaYj2EyiMdr8JhwvssL; connect.sid=s%3AqlAMZeLmFdWWSxvzbiJTigSUD7bW8Ub1.tpqmL49njnCXOPiZd1Pf6pAazlUUxNHfthqqg3NOANU] that contained an invalid cookie.

Please let me know what should I do for the same.

Also, localhost:8080/hello give me 404 page.

@nprasad18

Reach out to support: developers@okta.com they should be able to get you moving again.

Also, if you want to take a look at a Spring SAML example you can take a look at this blog post:
https://developer.okta.com/blog/2017/03/16/spring-boot-saml

@bdemers
I checked out sprint-boot-saml app. https://github.com/oktadeveloper/okta-spring-boot-saml-example

I get following errors
Attaching agents: []
Exception in thread “main” java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader

Java Version 9.0,.4
Maven Version - Apache Maven 3.5.3

I tried few fixes suggested on stack-overflow, but other issues came. Is there fix for these versions?

@bdemers

I was able fix the issue. Here are the changes I have made to pom.xml

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.9</java.version>
</properties>
1 Like

What exactly did you change? If I generate a blank Java + Maven project on start.spring.io, it has already has these properties, except it uses Java 8 by default.

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.0.1.RELEASE</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
</properties>

Sorry, I was OOO for last two weeks.

I downloaded project from here https://github.com/oktadeveloper/okta-spring-boot-saml-example

Here are contents from pom.xml

org.springframework.boot
spring-boot-starter-parent
1.5.10.RELEASE

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>