Is there an existing issue for this?
Are you using the latest version of MockBukkit?
Minecraft Version
1.21
Describe the bug
I found this similar closed issue for Paper 1.21.5. I'm wondering now if mc26.1.2 is fully supported yet since there is no option for it in the "Minecraft Version" dropdown above and it aligns with the cause of the issue in the issue mentioned, however, there are versions corresponding to mc26.1.2 in this repository's tags and in the Maven Central repository.
When attempting to run any tests, I get the following error:
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
java.util.ServiceConfigurationError: io.papermc.paper.registry.RegistryAccess: Provider org.mockbukkit.mockbukkit.registry.RegistryAccessMock could not be instantiated
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:552)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:712)
at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:672)
at java.base/java.util.ServiceLoader$2.next(ServiceLoader.java:1256)
at java.base/java.util.ServiceLoader.findFirst(ServiceLoader.java:1660)
at io.papermc.paper.registry.RegistryAccessHolder.<clinit>(RegistryAccessHolder.java:8)
at io.papermc.paper.registry.RegistryAccess.registryAccess(RegistryAccess.java:24)
at org.bukkit.Registry.legacyRegistryFor(Registry.java:68)
at org.bukkit.Registry.<clinit>(Registry.java:98)
at org.mockbukkit.mockbukkit.tags.FluidTagMock.from(FluidTagMock.java:30)
at org.mockbukkit.mockbukkit.tags.TagFactory.createTag(TagFactory.java:33)
at org.mockbukkit.mockbukkit.tags.TagFactory.createTag(TagFactory.java:24)
at org.mockbukkit.mockbukkit.tags.TagsMock.lambda$loadRegistry$1(TagsMock.java:108)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.SliceOps$1$1.accept(SliceOps.java:200)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:214)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:632)
at org.mockbukkit.mockbukkit.tags.TagsMock.loadRegistry(TagsMock.java:102)
at org.mockbukkit.mockbukkit.tags.TagsMock.loadDefaultTags(TagsMock.java:52)
at org.mockbukkit.mockbukkit.ServerMock.<init>(ServerMock.java:260)
at org.mockbukkit.mockbukkit.MockBukkit.mock(MockBukkit.java:69)
at com.me.test.TestPluginTest.setUp(TestPluginTest.java:15)
Caused by: java.lang.ExceptionInInitializerError
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1169)
at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:341)
at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(MethodHandleAccessorFactory.java:104)
at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(ReflectionFactory.java:138)
at java.base/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:546)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:496)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:707)
... 28 more
Caused by: org.mockbukkit.mockbukkit.exception.InternalDataLoadException: Null JSON element while retrieving `minecraft:sulfur_cube_archetype` - MockBukkit / MC version mismatch?
at org.mockbukkit.mockbukkit.registry.RegistryAccessMock.createClassToKeyConversions(RegistryAccessMock.java:169)
at org.mockbukkit.mockbukkit.registry.RegistryAccessMock.<clinit>(RegistryAccessMock.java:32)
... 37 more
Process finished with exit code -1
Reproducible Test
- Create a Paper 26.1.2 project using Maven
- Add MockBukkit 4.114.0 as a dependency with
test scope
- Attempt to run a test
- Observe bug
Anything else?
My pom.xml looks like this:
<?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>com.me</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>test</name>
<properties>
<java.version>25</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</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.5.3</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>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>[26.1.2.build,)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockbukkit.mockbukkit</groupId>
<artifactId>mockbukkit-v26.1.2</artifactId>
<version>4.114.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
The sole test class:
public class TestPluginTest {
private ServerMock server;
private TestPlugin plugin;
@BeforeEach
public void setUp() {
server = MockBukkit.mock();
plugin = MockBukkit.load(TestPlugin.class);
}
@AfterEach
public void tearDown() {
MockBukkit.unmock();
}
@Test
public void testPluginEnable() {
Assertions.assertNotNull(plugin);
}
}
The entire plugin:
public final class TestPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
Additional Information
- Paper 26.1.2
- MockBukkit 4.114.0
maven-wrapper.properties:
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
It's also worth noting that I've tried downgrading MockBukkit to every prior version until 4.112.0. With every version, I was met with the same error which is odd because Sulfur Cubes weren't added to Minecraft until 26.2 which MockBukkit 4.112.0 predates.
Is there an existing issue for this?
Are you using the latest version of MockBukkit?
Minecraft Version
1.21
Describe the bug
I found this similar closed issue for Paper 1.21.5. I'm wondering now if mc26.1.2 is fully supported yet since there is no option for it in the "Minecraft Version" dropdown above and it aligns with the cause of the issue in the issue mentioned, however, there are versions corresponding to mc26.1.2 in this repository's tags and in the Maven Central repository.
When attempting to run any tests, I get the following error:
Reproducible Test
testscopeAnything else?
My
pom.xmllooks like this:The sole test class:
The entire plugin:
Additional Information
maven-wrapper.properties:It's also worth noting that I've tried downgrading MockBukkit to every prior version until 4.112.0. With every version, I was met with the same error which is odd because Sulfur Cubes weren't added to Minecraft until 26.2 which MockBukkit 4.112.0 predates.