glassfish
  1. glassfish
  2. GLASSFISH-101

NPE is thrown when use Entitymanager in J2SE project

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 9.0pe
    • Fix Version/s: 9.0pe
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Linux

    • Issuezilla Id:
      101

      Description

      I have installed Glassfish build 30 and trying to use EntityManager in J2SE
      project. I created all required classes, persistence.xml file and added all
      required jars on classpath. I get following exception every time:
      Exception in thread "main" java.lang.NullPointerException
      at
      oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:133)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:279)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:298)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromMain(JavaSECMPInitializer.java:335)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJavaSECMPInitializer(JavaSECMPInitializer.java:78)
      at
      oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.getServerSession(EntityManagerFactoryProvider.java:240)
      at
      oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:97)
      at
      javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)
      at
      javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:50)

        Activity

        Hide
        Mitesh Meswani added a comment -

        A workaround to this issue is pass a HashMap to createEntityManagerFactory as
        follows

        EntityManagerFactory emf = Persistence.createEntityManagerFactory("em", new
        HashMap());

        Show
        Mitesh Meswani added a comment - A workaround to this issue is pass a HashMap to createEntityManagerFactory as follows EntityManagerFactory emf = Persistence.createEntityManagerFactory("em", new HashMap());
        Hide
        marina vatkina added a comment -

        Fixed Subcomponent

        Show
        marina vatkina added a comment - Fixed Subcomponent
        Hide
        pkrogh added a comment -

        This is likely fixed. Please verify.

        Show
        pkrogh added a comment - This is likely fixed. Please verify.
        Hide
        marina vatkina added a comment -

        Works correctly on the latest build. Tested with ex1.zip example from the
        persistence example page without invoking java without javaagent.

        Show
        marina vatkina added a comment - Works correctly on the latest build. Tested with ex1.zip example from the persistence example page without invoking java without javaagent.
        Hide
        marina vatkina added a comment -

        updated build# (just in case)

        Show
        marina vatkina added a comment - updated build# (just in case)

          People

          • Assignee:
            marina vatkina
            Reporter:
            blaha
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: