glassfish
  1. glassfish
  2. GLASSFISH-8753

Eclipselink does not report "missing id annotation"

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: V3
    • Fix Version/s: V3
    • Component/s: verifier
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Sun

    • Issuezilla Id:
      8,753

      Description

      Verifier uses eclipselink (earlier TLE) to verify JPA portion of an application.
      To do this, it sets VALIDATION_ONLY_PROPERTY to TRUE before calling createEMF. I
      have an app (attached here with) where the entity class has no field or method
      annotated with any of the ID annotations. Earlier verifier reports the following
      failure:
      /Entity class [class com.sun.fossdemo.Person] has no primary key specified. It
      should define either an @Id, @EmbeddedId or an @IdClass.
      /

      New verifier does not. I suspect it has something to do with eclipselink. The
      instructions to test is as follows:

      unzip bad.zip
      you will see bad/app.ear - that's the application that needs to be verified.
      To verify, do the following:
      cd <wherever glassfishv3 is installed>
      unzip v3/packager/glassfish-verifier/target/glassfish-verifier.zip
      Make sure you unzipped verifier.jar in modules directory.

      Now, run "verifier app.ear"

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        Created an attachment (id=2991)
        test case

        Show
        Sanjeeb Sahoo added a comment - Created an attachment (id=2991) test case
        Hide
        Mitesh Meswani added a comment -

        Sahoo,

        I was not able to run verified against V3. Here is what I get after following
        the steps you suggested above.

        $ verifier.bat app.ear
        Exception in thread "main" java.lang.NoClassDefFoundError:
        com/sun/enterprise/tools/verifi
        er/VerifierOSGiMain
        Caused by: java.lang.ClassNotFoundException:
        com.sun.enterprise.tools.verifier.VerifierOSG
        iMain
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        Could not find the main class:
        com.sun.enterprise.tools.verifier.VerifierOSGiMain. Program will exit.

        I tried a simple test program that has an @Entity with not *ID annotation
        against EclipseLink and I got following.

        Exception Description: Predeployment of PersistenceUnit [em] failed.
        Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence
        Services - 2.0.0.qualifier): org.eclipse.persistence.exceptions.ValidationException
        Exception Description: Entity class [class test.pojo.Employee] has no
        primarykey specified. It should define either an @Id, @EmbeddedId or an
        @IdClass. If you have defined PK using any of these annotations then make sure
        that you do not have mixed access-type (both fields and properties annotated) in
        your entity class hierarchy.
        at
        org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:125)
        at
        org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:133)
        at
        org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
        at
        javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78)
        at
        javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)

        I know that EclipseLink would execute the same code path during verifier run
        also. Hence I am marking the issue as WORKSFORME.

        Can you please try running verifier against latest GlassFish to confirm.

        Show
        Mitesh Meswani added a comment - Sahoo, I was not able to run verified against V3. Here is what I get after following the steps you suggested above. $ verifier.bat app.ear Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/enterprise/tools/verifi er/VerifierOSGiMain Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.tools.verifier.VerifierOSG iMain at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: com.sun.enterprise.tools.verifier.VerifierOSGiMain. Program will exit. I tried a simple test program that has an @Entity with not *ID annotation against EclipseLink and I got following. Exception Description: Predeployment of PersistenceUnit [em] failed. Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.0.0.qualifier): org.eclipse.persistence.exceptions.ValidationException Exception Description: Entity class [class test.pojo.Employee] has no primarykey specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy. at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:125) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:133) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) I know that EclipseLink would execute the same code path during verifier run also. Hence I am marking the issue as WORKSFORME. Can you please try running verifier against latest GlassFish to confirm.

          People

          • Assignee:
            Mitesh Meswani
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: