Issue #2336: Getting an error when adding activation code to conf file

Type: Bug ReoprtVersion: 2.7.5_05Priority: NormalStatus: FixedReplies: 3
#1

Hello,

When I add an activation code to my objectdb.conf file, I get the following exception:

[ObjectDB 2.7.5_05] Unexpected exception (Error 990)
  Generated by OpenJDK 64-Bit Server VM 1.8.0_181 (on Linux 3.10.0-693.el7.x86_64).
Please report this error on http://www.objectdb.com/database/issue/new
com.objectdb.o.InternalException: null
com.objectdb.o.InternalException
        at com.objectdb.o.InternalException.f(InternalException.java:235)
        at com.objectdb.o.CFG.C(CFG.java:747)
        at com.objectdb.o.CFG.B(CFG.java:665)
        at com.objectdb.o.CFG.n(CFG.java:563)
        at com.objectdb.o.CFG.ZU(CFG.java:415)
        at com.objectdb.o.CFG.g(CFG.java:355)
        at com.objectdb.o.CFG.f(CFG.java:299)
        at com.objectdb.o.RCL.<clinit>(RCL.java:36)
        at com.objectdb.o.UNM$f.<init>(UNM.java:167)
        at com.objectdb.o.UNM.r(UNM.java:107)
        at com.objectdb.o.UNM.q(UNM.java:77)
        at com.objectdb.jpa.Provider.createEntityManagerFactory(Provider.java:58)
        at com.objectdb.jpa.Provider.createEntityManagerFactory(Provider.java:32)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
        at pgtester.ObjectDBPopulator.main(ObjectDBPopulator.java:20)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.objectdb.o.UNM$f.<init>(UNM.java:167)
        at com.objectdb.o.UNM.r(UNM.java:107)
        at com.objectdb.o.UNM.q(UNM.java:77)
        at com.objectdb.jpa.Provider.createEntityManagerFactory(Provider.java:58)
        at com.objectdb.jpa.Provider.createEntityManagerFactory(Provider.java:32)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
        at pgtester.ObjectDBPopulator.main(ObjectDBPopulator.java:20)
Caused by: com.objectdb.o.InternalException
        at com.objectdb.o.InternalException.f(InternalException.java:235)
        at com.objectdb.o.CFG.C(CFG.java:747)
        at com.objectdb.o.CFG.B(CFG.java:665)
        at com.objectdb.o.CFG.n(CFG.java:563)
        at com.objectdb.o.CFG.ZU(CFG.java:415)
        at com.objectdb.o.CFG.g(CFG.java:355)
        at com.objectdb.o.CFG.f(CFG.java:299)
        at com.objectdb.o.RCL.<clinit>(RCL.java:36)
        ... 8 more

 

If I remove the activation code from my configuration file, I get:

Exception in thread "main" [ObjectDB 2.7.5_05] javax.persistence.PersistenceException
Too many persistent objects (>1000000) - exceeds evaluation limit (error 1012)
        at pgtester.ObjectDBPopulator.lambda$main$0(ObjectDBPopulator.java:28)
        at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
        at java.util.stream.IntPipeline$Head.forEach(IntPipeline.java:557)
        at pgtester.ObjectDBPopulator.main(ObjectDBPopulator.java:24)
Caused by: com.objectdb.o.UserException: Too many persistent objects (>1000000) - exceeds evaluation limit
        at com.objectdb.o.MSG.a(MSG.java:64)
        at com.objectdb.o.JPE.d(JPE.java:143)
        ... 7 more

This is why I think something is wrong with my activation code. 

I am adding my activation code to my config file as such:

<database>
                <size initial="256kb" resize="256kb" page="2kb" />
                <recovery enabled="true" sync="false" path="." max="128mb" />
                <recording enabled="false" sync="false" path="." mode="write" />
                <locking version-check="true" />
                <processing cache="64mb" max-threads="10" />
                <query-cache results="32mb" programs="500" />
                <extensions drop="temp,tmp" memory="mem" />
                <activation code="XXXX-XXXX-XXXX-XXXX-XXXX" />
</database>

My java program is very simple and looks like the following:

import java.util.stream.IntStream;

import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

public class ObjectDBPopulator {

    public static void main(String[] args) {    
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("$objectdb/db/my_entity.odb");
        EntityManager em = emf.createEntityManager();
        
        em.getTransaction().begin();
        IntStream.range(0, 1000000).forEach(i -> {
            MyEntity myEntity = new MyEntity("test" + i);
            em.persist(myEntity);
            if(i % 5000 == 0) {
                em.flush();
                em.clear();
            }
        });
        em.getTransaction().commit();
        
        Query q1 = em.createQuery("SELECT count(my) from MyEntity my");
        System.out.println(q1.getSingleResult());
        
        em.close();
        emf.close();
    }
    
    @Entity
    public static class MyEntity {
        private String name;
        MyEntity(String name) {
            this.name = name;
        }
        @Override
        public String toString() {
            return name;
        }
    }    
}

Any help would greatly be appreciated! Thank you!

#2

It seems that there is a strange error with the specific activation code that you received.

We will try to find the cause and fix it as soon as possible.

 

ObjectDB Support
#3

Hopefully we fixed the issue. A new licence key was sent to you, please try activation again with the new licence key.  Sorry for the inconvinience.

ObjectDB Support
#4

The problem appears to be fixed. I am able to add the activation code to my configuration file and run the application successfully. Thank you for your help with this issue! Much appreciated!

Reply