As the title suggests, I’m getting an incredibly generic error message and I’m not entirely sure what is causing it. I’m currently using the core and hikaricp modules from the documentation. I’m also using the latest version
Here is my current pom.xml dependencies
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.4.4.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-hikaricp</artifactId>
<version>6.4.4.Final</version>
<scope>provided</scope>
</dependency>
The class in question is properly annotated with @Entity and it’s respective properties.
@Entity
@Table(name = "seasons")
public class HSeason {.. // Stripped down to just an @Id
The way that I’m constructing this in-code is instead of using hibernate.cfg.xml
I opted to use Properties
class because I’ll be dealing with dynamically changing data. Here is my “Attempt” at initializing a session factory.
private void initSessionFactory() {
Properties properties = new Properties();
MySQLConfig mySQLConfig = configManager.config.mySQLConfig;
properties.putAll(Map.of(
"hibernate.connection.provider_class", "org.hibernate.hikaricp.internal.HikariCPConnectionProvider",
"hibernate.hikari.minimumIdle", "5",
"hibernate.hikari.maximumPoolSize", "10",
"hibernate.hikari.idleTimeout", "30000",
"hibernate.hikari.dataSourceClassName", "com.mysql.cj.jdbc.MysqlDataSource",
"hibernate.hikari.dataSource.url", "jdbc:mysql://" + mySQLConfig.host + ":" + mySQLConfig.port + "/" + mySQLConfig.database,
"hibernate.hikari.dataSource.user", mySQLConfig.username,
"hibernate.hikari.dataSource.password", mySQLConfig.password
));
Configuration configuration = new Configuration();
configuration.setProperties(properties);
configuration.addPackage("us.mkaulfers.hardcoreseasons.orm");
try {
StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
.applySettings(configuration.getProperties())
.build();
sessionFactory =
new MetadataSources(serviceRegistry)
.addPackage(us.mkaulfers.hardcoreseasons.orm.HSeason.class.getPackageName())
.addAnnotatedClass(HSeason.class)
.buildMetadata()
.buildSessionFactory();
} catch (Exception e) {
e.printStackTrace();
}
}
Every attempt I’ve made thus-far has resulted in the same error.
[21:23:42 WARN]: org.hibernate.MappingException: entity class not found: us.mkaulfers.hardcoreseasons.orm.HSeason
[21:23:42 WARN]: at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:171)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.BinderHelper.getPropertyOverriddenByMapperOrMapsId(BinderHelper.java:887)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.PropertyBinder.bindBasic(PropertyBinder.java:1016)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.PropertyBinder.bindProperty(PropertyBinder.java:890)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.PropertyBinder.buildProperty(PropertyBinder.java:788)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.PropertyBinder.processElementAnnotations(PropertyBinder.java:709)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.EntityBinder.processIdPropertiesIfNotAlready(EntityBinder.java:1041)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.EntityBinder.handleIdentifier(EntityBinder.java:357)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.EntityBinder.bindEntityClass(EntityBinder.java:237)
[21:23:42 WARN]: at org.hibernate.boot.model.internal.AnnotationBinder.bindClass(AnnotationBinder.java:423)
[21:23:42 WARN]: at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:256)
[21:23:42 WARN]: at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:279)
[21:23:42 WARN]: at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:322)
[21:23:42 WARN]: at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:129)
[21:23:42 WARN]: at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:449)
[21:23:42 WARN]: at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:101)
[21:23:42 WARN]: at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:210)
[21:23:42 WARN]: at HardcoreSeasons-1.1.0b.jar//us.mkaulfers.hardcoreseasons.HardcoreSeasons.initSessionFactory(HardcoreSeasons.java:121)
[21:23:42 WARN]: at HardcoreSeasons-1.1.0b.jar//us.mkaulfers.hardcoreseasons.HardcoreSeasons.onEnable(HardcoreSeasons.java:47)
[21:23:42 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:287)
[21:23:42 WARN]: at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:188)
[21:23:42 WARN]: at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104)
[21:23:42 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507)
[21:23:42 WARN]: at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugin(CraftServer.java:639)
[21:23:42 WARN]: at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugins(CraftServer.java:550)
[21:23:42 WARN]: at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:671)
[21:23:42 WARN]: at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:431)
[21:23:42 WARN]: at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:309)
[21:23:42 WARN]: at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1131)
[21:23:42 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319)
[21:23:42 WARN]: at java.base/java.lang.Thread.run(Thread.java:840)
[21:23:42 WARN]: Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [us.mkaulfers.hardcoreseasons.orm.HSeason]
[21:23:42 WARN]: at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:126)
[21:23:42 WARN]: at org.hibernate.boot.internal.ClassLoaderAccessImpl.classForName(ClassLoaderAccessImpl.java:67)
[21:23:42 WARN]: at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:166)
[21:23:42 WARN]: ... 30 more
[21:23:42 WARN]: Caused by: java.lang.ClassNotFoundException: Could not load requested class : us.mkaulfers.hardcoreseasons.orm.HSeason
[21:23:42 WARN]: at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:216)
[21:23:42 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
[21:23:42 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[21:23:42 WARN]: at java.base/java.lang.Class.forName0(Native Method)
[21:23:42 WARN]: at java.base/java.lang.Class.forName(Class.java:467)
[21:23:42 WARN]: at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:123)
[21:23:42 WARN]: ... 32 more
[21:23:42 WARN]: Caused by: java.lang.Throwable
[21:23:42 WARN]: at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:209)
[21:23:42 WARN]: ... 37 more
[21:23:42 WARN]: Suppressed: java.lang.ClassNotFoundException: us.mkaulfers.hardcoreseasons.orm.HSeason
[21:23:42 WARN]: at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
[21:23:42 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
[21:23:42 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[21:23:42 WARN]: at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:206)
[21:23:42 WARN]: ... 37 more
[21:23:42 WARN]: Suppressed: java.lang.ClassNotFoundException: us.mkaulfers.hardcoreseasons.orm.HSeason
[21:23:42 WARN]: at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
[21:23:42 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
[21:23:42 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[21:23:42 WARN]: at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:206)
[21:23:42 WARN]: ... 37 more
[21:23:42 WARN]: Suppressed: java.lang.ClassNotFoundException: us.mkaulfers.hardcoreseasons.orm.HSeason
[21:23:42 WARN]: at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
[21:23:42 WARN]: at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
[21:23:42 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[21:23:42 WARN]: at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:206)
[21:23:42 WARN]: ... 37 more