1.8.8 Please help me with javacord.

Discussion in 'Spigot Plugin Development' started by OhSry, Jan 23, 2020.

  1. Hello, I am trying to get javacord to work for hours now and I can't seem to get it working.
    I keep on getting this error:
    Code (Text):
    [21:42:01 ERROR]: Error occurred while enabling GalacticSystem v1.0 (Is it up to date?)
    java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.debug(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
            at org.javacord.core.DiscordApiBuilderDelegateImpl.login(DiscordApiBuilderDelegateImpl.java:155) ~[?:?]
            at org.javacord.api.DiscordApiBuilder.login(DiscordApiBuilder.java:36) ~[?:?]
            at me.enchanted.system.GSystem.setupDiscord(GSystem.java:29) ~[?:?]
            at me.enchanted.system.GSystem.onEnable(GSystem.java:20) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [server.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [server.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [server.jar:git-Spigot-db6de12-18fbb24]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]
    And this is my pom.xml:
    Code (Text):
    <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/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>GSystem</groupId>
        <artifactId>GSystem</artifactId>
        <version>1.0</version>
        <properties>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.source>1.8</maven.compiler.source>
        </properties>

        <dependencies>
            <dependency>
                <groupId>org.javacord</groupId>
                <artifactId>javacord</artifactId>
                <version>3.0.4</version>
                <type>pom</type>
                <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>2.13.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <version>2.13.0</version>
            </dependency>
        </dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.1</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
    If you can help, please reply, thank you!
     
  2. So does anyone know how to solve this issue or is good at javacord?
     
  3. Honestly sounds like a namespace conflict. Unzip your jar, look inside. Is there an org.apache.logging shaded in? Chances are javacord depends on a different version of log4j with that method present. It might think that the log4j class bundled with the Spigot jar is the right one.

    Might be worthwhile doing a relocation if that is the case.
     
  4. Yes there is.
    upload_2020-1-24_15-31-32.png
     
  5. I just tested this with the 1.12.2 version of minecraft and the bot loaded instantly, and now the bot is online. I guess 1.8.8 doesn't contain the log4j version javacord needs...
     
  6. So I’m assuming you didn’t do a relocation or that it didn’t work?
     
  7. You can use libby to load missing dependencies tbh