Hallo,
ich lerne gerade Hibernate und bekomme gleich beim ersten Testprojekt mit Eclipse eine ClassNotFoundException:
Okt. 29, 2024 12:43:56 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 5.6.8.Final
Okt. 29, 2024 12:43:57 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/testschema]
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=root}
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Okt. 29, 2024 12:43:57 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PoolState stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/testschema]
Exception in thread "main" org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [hibernateCon/src/main/java/hibernateDB/User.java]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:133)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.<init>(AnnotationMetadataSourceProcessorImpl.java:101)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init>(MetadataBuildingProcess.java:164)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:158)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:86)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:479)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:85)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:709)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:746)
at hibernateDB.GeneralDB.main(GeneralDB.java:13)
Caused by: java.lang.ClassNotFoundException: hibernateCon/src/main/java/hibernateDB/User.java
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:534)
at java.base/java.lang.Class.forName(Class.java:513)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:130)
... 9 more
Die Klasse User.java ist bei mir im Ordner aber im Ordner "C:\Users\nspec\eclipse-workspace\hibernateCon\src\main\java\hibernateDB\User.java" vorhanden, in der hibernate.cfg.xml ist sie so auch aufgeführt:
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/testschema</property>
<property name="connection.username">root</property>
<property name="connection.password">******</property>
<property name="show_sql">true</property>
<mapping class= "hibernateCon/src/main/java/hibernateDB/User.java" />
</session-factory>
</hibernate-configuration>
Kann mir jemand helfen, weshalb die Klasse nicht geladen werden kann?
Danke
Norbert
ich lerne gerade Hibernate und bekomme gleich beim ersten Testprojekt mit Eclipse eine ClassNotFoundException:
Okt. 29, 2024 12:43:56 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 5.6.8.Final
Okt. 29, 2024 12:43:57 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/testschema]
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {password=****, user=root}
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Okt. 29, 2024 12:43:57 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
Okt. 29, 2024 12:43:57 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PoolState stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/testschema]
Exception in thread "main" org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [hibernateCon/src/main/java/hibernateDB/User.java]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:133)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.<init>(AnnotationMetadataSourceProcessorImpl.java:101)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init>(MetadataBuildingProcess.java:164)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:158)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:86)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:479)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:85)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:709)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:746)
at hibernateDB.GeneralDB.main(GeneralDB.java:13)
Caused by: java.lang.ClassNotFoundException: hibernateCon/src/main/java/hibernateDB/User.java
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:534)
at java.base/java.lang.Class.forName(Class.java:513)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:130)
... 9 more
Die Klasse User.java ist bei mir im Ordner aber im Ordner "C:\Users\nspec\eclipse-workspace\hibernateCon\src\main\java\hibernateDB\User.java" vorhanden, in der hibernate.cfg.xml ist sie so auch aufgeführt:
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/testschema</property>
<property name="connection.username">root</property>
<property name="connection.password">******</property>
<property name="show_sql">true</property>
<mapping class= "hibernateCon/src/main/java/hibernateDB/User.java" />
</session-factory>
</hibernate-configuration>
Kann mir jemand helfen, weshalb die Klasse nicht geladen werden kann?
Danke
Norbert