0

I'm coding an application which is module based, so it loads other jar files into the classpath. One module of this application is a RestAPI. For the RestAPI I'm using Spark Java. Now my problem is, that one class is not able to be loaded. The Exception looks as following:

org.pac4j.core.exception.TechnicalException: java.lang.ClassNotFoundException: org.pac4j.core.profile.CommonProfile

I actually shaded the class into my jar.

What I tried yet:

I tried to load it manually by Class#forName. This did actually not throw an exception. I tried to load the whole jar file using an URLClassLoader. Nothing worked.

Thanks for any help

Joel
  • 138
  • 10
  • Which dependency management system (if any) are you using? – Joe C Jun 18 '17 at 18:07
  • I'm actually using maven, and the dependency management seems absolutely fine. I have already decompiled my own jar file and everything is where it has to be. – Joel Jun 18 '17 at 18:22

3 Answers3

0

Download this package from bellow link :-

http://central.maven.org/maven2/org/pac4j/pac4j-core/2.0.0/pac4j-core-2.0.0.jar

Or

If you're using a dependency manager (Maven, SBT, Ivy, Gradle, etc.) copy and paste the respective dependency. If you're using a dependency manager, that's all there is to resolving this exception.

Anshul Sharma
  • 3,432
  • 1
  • 12
  • 17
  • Thank you for your answer but i actually know how to use maven. But the problem is actually probably the classloader because I have developed a modular application. – Joel Jun 18 '17 at 17:38
0

Add the following dependency property in your pom.xml if you are using maven build tool.

<dependency>
    <groupId>org.pac4j</groupId>
    <artifactId>pac4j-core</artifactId>
    <version>1.4.0</version>
</dependency>

This will resolve your problem. If you are facing the same problem again then navigate to ~/.m2/repository/org/pac4j directory delete all the dependencies downloaded and rebuild your project again.

sathya
  • 1,982
  • 1
  • 20
  • 37
0

I have seen a similar problem but i solved following Dependency

 <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
Talha K.
  • 27
  • 11