cannot import org.hibernate.session

2019-06-08 19:32发布

问题:

I installed wildfly 8.1 to my eclipse and wanted to move my old project from jboss 4.2 to new one. There is a problem that import org.hibernate.Session; cannot be resolwed on WildFly 8. can someone suggest any possible solutions?

回答1:

WildFly class loading is different comparing to JBoss 4.2. If you want to use Hibernate, than you'll need an explicit dependency on org.hibernate module.

One way of defining this is via a Dependencies entry in MAINFEST.MF:

Manifest-Version: 1.0
...
Dependencies: org.hibernate

Related reference section can be found here.