Skip to content
Advertisement

cannot install hibernate(5.6.0) with intellij(m1chip silicon) in java

I try to run hibernate 5.6.0 in java 16 and I am programming with intellij 2021.2 for apple sillicon. When I run it I get this error:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]
    at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53)
    at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:254)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:260)
    at mcrpg.mmorpg.Hibernate.start(Hibernate.java:11)
    at mcrpg.mmorpg.Start.main(Start.java:7)

My hibernate.cfg.xml is in source root:source tree

Advertisement

Answer

Always include the resource files in the separate resources directory. As by default, Maven (and so IDE as well) will not copy the resource files from the source directory.

Advertisement