Search code examples
javahibernatejpamavenseam

Seam Test NoSuchMethodError


We use maven to build or Seam 2.2.2 Project for a Jboss 6.1 Server.

When we run seam Test we get the following error.

Caused by: java.lang.NoSuchMethodError: javax.persistence.EntityManager.createQuery(Ljava/lang/String;Ljava/lang/Class;)Ljavax/persistence/TypedQuery;

When we run in production on a Jboss 6.1 The method works fine.

We use the jboss.embedded.version beta3.SP15


Solution

  • That means that in your test environment you only have JPA 1 on the classpath, while you are using JPA 2 in your code.

    You probably have your dependency to hibernate / JPA set to <scope>provided</scope> because JBoss provides JPA through hibernate. You will probably need a similar dependency with <scope>test</scope>.