java.lang.NoClassDefFoundError

Issue #199 invalid
Jose Romero created an issue

12:38:24,984 ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to xxxxxx: java.lang.NoClassDefFoundError: net/minidev/json/JSONObject at com.nimbusds.jwt.JWTClaimsSet.toJSONObject(JWTClaimsSet.java:764) at com.nimbusds.jwt.PlainJWT.<init>(PlainJWT.java:56) ....

java.lang.NoClassDefFoundError: net/minidev/json/JSONObject ??? I tested the same thing using a maven project standalone and works perfectly fine but in my old java EE code it dies...

List<String> aud = new ArrayList<String>(); aud.add("https://app1.foo.com"); aud.add("https://app2.foo.com");

        JWTClaimsSet claimsSet = new JWTClaimsSet.Builder()
                .subject("This is a test")
                .issuer("http://ejbca.com")
                .expirationTime(new Date(new Date().getTime() + 1000 * 60 * 10))
                .audience(aud)
                .notBeforeTime(new Date())
                .issueTime(new Date())
                .jwtID(UUID.randomUUID().toString())
                .build();

        PlainJWT plainJwt = new PlainJWT(claimsSet);

        String jwtInText = plainJwt.serialize();

Comments (4)

  1. Jose Romero reporter

    tried again with nimbus-jose-jwt-4.13.1.jar downloaded from bitbucket.

    12:47:43,022 ERROR [io.undertow.request] (default task-4) UT005023: Exception handling request to xxx: java.lang.NoClassDefFoundError: net/minidev/json/JSONObject at com.nimbusds.jwt.JWTClaimsSet.toJSONObject(JWTClaimsSet.java:747) at com.nimbusds.jwt.PlainJWT.<init>(PlainJWT.java:39)

  2. Jose Romero reporter

    Ok, assuming world is beautiful and everyone uses maven the Json library should be fixed automatically, but in the world on ANT i still had to include manually json-smart-1.3.1.jar....

  3. Connect2id OSS

    If you're using Ant you'll have to download the dependency JARs and put them in the class path.

    Here are the runtime deps of (note that BouncyCastle is optional):

    <dependency>
                <groupId>com.github.stephenc.jcip</groupId>
                <artifactId>jcip-annotations</artifactId>
                <version>1.0-1</version>
            </dependency>
            <dependency>
                <groupId>net.minidev</groupId>
                <artifactId>json-smart</artifactId>
                <version>1.3.1</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>[1.52,)</version>
                <optional>true</optional>
            </dependency>
    
  4. Log in to comment