MinusKube / SmartInvs

Advanced Inventory API for your Minecraft Bukkit plugins.
https://minuskube.gitbook.io/smartinvs/
Apache License 2.0
263 stars 65 forks source link

how to fix ClassNotFound? #198

Closed tom8hawk closed 2 years ago

tom8hawk commented 2 years ago

org.bukkit.command.CommandException: Unhandled exception executing command 'rg' in plugin FreeRegions v1.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[PluginCommand.class:788465c-DEV] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:153) ~[SimpleCommandMap.class:788465c-DEV] at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:689) ~[CraftServer.class:788465c-DEV] at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:1604) ~[pa.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:1452) ~[pa.class:?] at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(CPacketChatMessage.java:50) ~[la.class:?] at net.minecraft.network.play.client.CPacketChatMessage.func_148833_a(CPacketChatMessage.java:11) ~[la.class:?] at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:14) ~[hv.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_312] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_312] at net.minecraft.util.Util.func_181617_a(SourceFile:46) [h.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:926) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:461) [nz.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:865) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:737) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312] Caused by: java.lang.NoClassDefFoundError: fr/minuskube/inv/content/InventoryProvider at ru.siaw.free.regions.command.Commands.onCommand(Commands.java:103) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[PluginCommand.class:788465c-DEV] ... 15 more Caused by: java.lang.ClassNotFoundException: fr.minuskube.inv.content.InventoryProvider at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:143) ~[PluginClassLoader.class:788465c-DEV] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:109) ~[PluginClassLoader.class:788465c-DEV] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_312] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_312] at ru.siaw.free.regions.command.Commands.onCommand(Commands.java:103) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[PluginCommand.class:788465c-DEV] ... 15 more

Jydett commented 2 years ago

Hi, it seems that the class in not loaded. Do you use SmartInvs as a dependency or as a plugin ?

tom8hawk commented 2 years ago

Hi, it seems that the class in not loaded. Do you use SmartInvs as a dependency or as a plugin ?

As a dependency

Jydett commented 2 years ago

Can you share your shade configuration & the initialization of SmartInv ?

tom8hawk commented 2 years ago

Sure,

<?xml version="1.0" encoding="UTF-8"?>
<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>ru.siaw.free.regions</groupId>
    <artifactId>FreeRegions</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>FreeRegions</name>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <url>siaw.ru</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.12.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.22</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>fr.minuskube.inv</groupId>
            <artifactId>smart-invs</artifactId>
            <version>1.2.7</version>
        </dependency>
    </dependencies>
</project>
@Override
public void onEnable() {
    inventoryManager = new InventoryManager(this);
    inventoryManager.init();
}