Results 1 to 2 of 2

Thread: NoClassDefFoundError: javax/persistence/criteria/Selection

  1. #1
    Join Date
    Mar 2011
    Posts
    4

    Question 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •