Problem with Jedis

Hey,

I have a problem with the library Jedis, when i wan’t to create JedisPoolConfig Object, the server throw ClassNotFoundException. I tried to add Class.forName but it does not work. I use Gradle.

How can I load this class?

Xodrun

Are you shading it?

Yes, I tried to change librairy for Redisson but I still have this error.

Can you post your build.gradle?

plugins{
id ‘java’
}

group ‘net.monkey’
version ‘3.6’

compileJava.options.encoding = ‘UTF-8’

repositories {
mavenLocal()
mavenCentral()
maven {
name = ‘sponge’
url = ‘https://repo.spongepowered.org/maven
}
maven { url = ‘https://oss.sonatype.org/content/repositories/snapshots’ }
}

dependencies {
compile ‘org.mongodb.morphia:morphia:1.3.2’
compile ‘redis.clients:jedis:2.9.0’
compile ‘com.rabbitmq:amqp-client:5.1.2’
compile ‘org.reflections:reflections:0.9.11’
compileOnly ‘org.spongepowered:spongeapi:7.0.0’
compileOnly ‘net.md-5:bungeecord-api:1.12-SNAPSHOT’
}

jar{
from configurations.compile.collect { zipTree it }
}

I would personally recommend using jengelman’s shadow plugin rather than rolling your own, but to each their own. As long as it works, that is - can you open your plugin jar as a zip, and make sure the classes you have included are actually in the jar?

I managed to fix my problem using shadow, I relocated the classes for it to work.

Thank you