Announcement Announcement Module
Collapse
No announcement yet.
NoClassDefFoundError: javax/persistence/criteria/Selection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoClassDefFoundError: javax/persistence/criteria/Selection

    Hi,

    I am using JPA 2.0 in my spring 3.0.5 project for the first time and get the following exception:

    java.lang.NoClassDefFoundError: javax/persistence/criteria/Selection
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Cla ss.java:2389)
    at java.lang.Class.getDeclaredConstructors(Class.java :1836)
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.determineCandidate Constructors(AutowiredAnnotationBeanPostProcessor. java:227)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.determineConstructorsFr omBeanPostProcessors(AbstractAutowireCapableBeanFa ctory.java:930)

    CriteriaBuilder queryBuilder = em.getCriteriaBuilder();
    CriteriaQuery<Order> query = queryBuilder.createQuery(Order.class);
    Root<Order> root = query.from(Order.class);
    query.select(root); // When this line is removed I don't get the exception

    <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.5.1-Final</version>
    </dependency>
    <dependency>
    <groupId>org.hibernate.javax.persistence</groupId>
    <artifactId>hibernate-jpa-2.0-api</artifactId>
    <version>1.0.0.Final</version>
    </dependency>

    The file hibernate-jpa-2.0-api-1.0.0.Final.jar is in WEF-INF/lib and it contains the class.

    What am I missing?

    Thanks,
    Ropo

  • #2
    Please use [ code][/code ] tags when posting code/xml/stacktraces that way they remain readable.

    Check your classpath for other jpa jars, there might be a jpa 1 jar somewhere on your classpath or another hibernate jar which might also influence classloading.

    Comment

    Working...
    X