Activation Issue

#1

Hi!

We now reached the 10 class limit of ObjectDB. Our license is activated and if I run objectdb activation I get true back.
When I start our webapp although I get the following error:

Caused by: com.objectdb.o.UserException: Too many persistable types (>10) - exceeds evaluation limit
at com.objectdb.o.MSG.d(MSG.java:62) ~[MSG.class:na]
at com.objectdb.o.MST.UC(MST.java:1102) ~[MST.class:na]
at com.objectdb.o.TYS.x(TYS.java:768) ~[TYS.class:na]
at com.objectdb.o.TYS.v(TYS.java:592) ~[TYS.class:na]
at com.objectdb.o.TYM.ae(TYM.java:531) ~[TYM.class:na]
at com.objectdb.o.TYM.ad(TYM.java:479) ~[TYM.class:na]
at com.objectdb.jpa.MetamodelImpl.prepareTypeLists(MetamodelImpl.java:230) ~[MetamodelImpl.class:na]
at com.objectdb.jpa.MetamodelImpl.getManagedTypes(MetamodelImpl.java:99) ~[MetamodelImpl.class:na]
at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:61) ~[JpaMetamodelMappingContextFactoryBean.class:na]
at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:26) ~[JpaMetamodelMappingContextFactoryBean.class:na]
at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:134) ~[AbstractFactoryBean.class:4.1.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627) ~[AbstractAutowireCapableBeanFactory.class:4.1.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564) ~[AbstractAutowireCapableBeanFactory.class:4.1.1.RELEASE]

The question is why. I tried to activate again but got the same activation code. My coworkers have the same problem on their machines. We are using the newest version 2.5.7_03 in client server mode.

What's wrong?

Regards

Ralph

#2

Hi again,

I think I just found out why this happens. Spring Data is retrieving the meta model. At this state the connection to the (activated) server doesn't exists and the client refuses to continue because it didn't know about the activation but checks the trial limit.

Regards

Ralph

#3

Activation is required only where the database file (odb file) is managed, which is usually only the server machine in client-server mode.

Please check if maybe for retrieving the meta model you access also a local embedded database. If not, we will try to reproduce it by a small test case based on your description.

ObjectDB Support
#4

I've created a test case for you. It assumes that an ObjectDB server is running on localhost with admin/admin as credentials. Actually it doesn't matter because it dies before connecting.

The project starts a Spring application context with one Spring Data JPA generated repository bean. There are 11 entity classes. The ObjectDB Enhancer is launched by the Maven exec plugin automatically.

To run it from the command line just do

mvn install
mvn exec:java -Dexec.mainClass="test.metamodel.App"

or fire it up in your favorite Maven capable IDE.

You should get the following stacktrace:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMapppingContext': Invocation of init method failed; nested exception is com.objectdb.o.UserException: Too many persistable types (>10) - exceeds evaluation limit
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:687)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
at test.metamodel.App.main(App.java:15)
... 6 more
Caused by: com.objectdb.o.UserException: Too many persistable types (>10) - exceeds evaluation limit
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.MST.UC(MST.java:1102)
at com.objectdb.o.TYS.x(TYS.java:768)
at com.objectdb.o.TYS.v(TYS.java:592)
at com.objectdb.o.TYM.ae(TYM.java:531)
at com.objectdb.o.TYM.ad(TYM.java:479)
at com.objectdb.jpa.MetamodelImpl.prepareTypeLists(MetamodelImpl.java:230)
at com.objectdb.jpa.MetamodelImpl.getManagedTypes(MetamodelImpl.java:99)
at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:61)
at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:26)
at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:134)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
#5

This seems to happen when using the Retrieving Metamodel without Connection feature (which was implemented following your request two years ago). Build 2.5.7_04 includes a fix.

It has not been checked with your test but with a simpler test case (since using a console test case is easier for us), so please confirm that it solves the issue:

import java.util.*;

import javax.persistence.*;
import javax.persistence.metamodel.*;

public final class T1542
{
    public static void main(String[] args) {

        // Should not throw an exception with no activation:
        EntityManagerFactory emf1 =
            Persistence.createEntityManagerFactory(
                "objectdb://localhost/db/test.tmp;drop");
        Metamodel metamodel = emf1.getMetamodel();
        metamodel.entity(E1.class);
        metamodel.entity(E2.class);
        metamodel.entity(E3.class);
        metamodel.entity(E4.class);
        metamodel.entity(E5.class);
        metamodel.entity(E6.class);
        metamodel.entity(E7.class);
        metamodel.entity(E8.class);
        metamodel.entity(E9.class);
        metamodel.entity(E10.class);
        metamodel.entity(E11.class);
        Set<ManagedType<?>> managedTypes = metamodel.getManagedTypes();
        System.out.println(managedTypes.size());
        emf1.close();
    }
  
    @Entity static class E1 {}
    @Entity static class E2 {}
    @Entity static class E3 {}
    @Entity static class E4 {}
    @Entity static class E5 {}
    @Entity static class E6 {}
    @Entity static class E7 {}
    @Entity static class E8 {}
    @Entity static class E9 {}
    @Entity static class E10 {}
    @Entity static class E11 {}
}
ObjectDB Support
#6

Thank you. The fix works.

Reply