NoClassDefFoundError in JPAProvider.<clinit> #377

Closed
cjanz opened this Issue Mar 27, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@cjanz

cjanz commented Mar 27, 2013

I use Querydsl 3.0 with OpenJPA (no Hibernate is on the classpath).

When I execute a query like this:

 new JPAQuery(em).from(QEntity.entity).count()

I get the following exception:

java.lang.NoClassDefFoundError: org/hibernate/transform/ResultTransformer
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at com.mysema.query.jpa.HQLTemplates.<clinit>(HQLTemplates.java:37)
    at com.mysema.query.jpa.impl.JPAProvider.<clinit>(JPAProvider.java:46)
    at com.mysema.query.jpa.impl.JPAQuery.<init>(JPAQuery.java:45)

This is because com.mysema.query.jpa.HibernateHandler uses imports from org.hibernate,* that can't be resolved on my classpath.

Maybe, as an example solution, catch the NoClassDefFoundError in JPAProvider#addMapping(String className, JPQLTemplates templates)

With Querydsl 2.9 the problem does not occur.

Kind regards,
Christian

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Mar 27, 2013

Member

Released in 3.1.0

Member

timowest commented Mar 27, 2013

Released in 3.1.0

@timowest timowest closed this Mar 27, 2013

@cjanz

This comment has been minimized.

Show comment
Hide comment
@cjanz

cjanz Mar 27, 2013

Thank you for this instant fix :-)

cjanz commented Mar 27, 2013

Thank you for this instant fix :-)

@timowest timowest added this to the 3.1.0 milestone Apr 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment