java.lang.ClassFormatError: javax / validation / Validation
I use Maven, Hibernate 4.0.0 final. In eclipse, it works fine, but in idea it gives this error ... strangely somehow pom.xml, hibernate.cfg.xml and UsersEntity.nbm.xml are the same everywhere.
There is a class UsersEntity

@Table(name = "users", schema = "", catalog = "ninjaway") @Entity public class UsersEntity { private long userId; @javax.persistence.Column(name = "userId", nullable = false, insertable = true, updatable = true, length = 20, precision = 0) @Id public long getUserId() { return userId; } public void setUserId(long userId) { this.userId = userId; } private String email; @Column(name = "email", nullable = true, insertable = true, updatable = true, length = 64, precision = 0) @Basic public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } private String pass; @Column(name = "pass", nullable = true, insertable = true, updatable = true, length = 32, precision = 0) @Basic public String getPass() { return pass; } public void setPass(String pass) { this.pass = pass; } private String name; @Column(name = "name", nullable = true, insertable = true, updatable = true, length = 32, precision = 0) @Basic public String getName() { return name; } public void setName(String name) { this.name = name; } 

Hibernatetest

 public class HibernateTest extends TestCase { private SessionFactory sessionFactory; private UsersEntity user; @Override protected void setUp() throws Exception { // A SessionFactory is set up once for an application sessionFactory = new Configuration() .configure() // configures settings from hibernate.cfg.xml .buildSessionFactory(); } @Override protected void tearDown() throws Exception { if ( sessionFactory != null ) { sessionFactory.close(); } } @SuppressWarnings({ "unchecked" }) public void testBasicUsage() { // create a couple of events... Session session = sessionFactory.openSession(); session.beginTransaction(); List result = session.createQuery("from UsersEntity" ).list(); for ( UsersEntity user : (List<UsersEntity>) result ) { System.out.println( "User: (" + user.getName() + ") : " + user.getEmail() ); } session.getTransaction().commit(); session.close(); } } 
  • if the project is mavenovsky, where does ide? - Gautama Buddha
  • without a clue, for some reason it worked in eclipse, but in idea there is no .... - Kobayashi_Maru

1 answer 1

Hallelujah)) you just had to add

 <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.2.0.Final</version> </dependency> 

in pom.xml