5202 words

Issue #284 - objectdb-2.6.9_06: Extended Persistence Context fails: 'Attempt to begin a new transaction when a transaction is active'

BugVersion: Priority: NormalStatus: ActiveReplies: 3
#1
2016-09-28 13:18

objectdb-2.6.9_06
NetBeans8.1+Glassfish4.1.1
Mac OS X

Possibly related: How to Use a SF with extended Persistence Context?

[EDIT: 2006-09-29 New improved version of test mini web app with test mode switches at: https://www.webel.com.au/downloads/objectdb/GreensoftObjectdbTestWebMini3683.2016-09-29-B.tgz

To reproduce the problem described below, simply download the test project, open in NetBeans8.1 and then:

Set DO_FORCE_COMMIT_AFTER_BUILD = false in com.greensoft.objectdb.test.mini.ejb.ExtProjectBuilder !

Then Clean and Build (objectdb-2.6.9_06.jar is already included and referenced under ./lib), and Run (will deploy to Glassfish4.1.1 bundled with NetBeans8.1). See also explanation in 2nd post item]

UML diagram for test case: https://www.webel.com.au/downloads/objectdb/Issue3683_02.png

(The classes all implement Serializable where necessary, via a common inherited logging service class All_, not shown.)

The following strategy used to work for objectdb-2.4.0_05, but fails for objectdb-2.6.9_01.

In the test case, only a single Project entity is used, and 2 project objects are (supposed to be) built using a "multi-shot" @Stateful ExtProjectBuilder that can be reset() and has an entity manager with an extended persistence context.

The basic idea (which used to work fine in practice) is that the @Startup @Singleton ExtConfigBean has a a @PostConstruct method that triggers the building of 2 separate - usually large and complex - Projects, via the @Stateful ExtProjectBuilder, which using a serious of cascading lazy builder methods (with complex entity building and wiring), which in turn delegate to a @Stateless ExtRequestBean, which offers lower level persistence and simpler entity wiring methods:

As simplified here to demonstrate the problem:

@Singleton
@Startup
public class ExtConfigBean extends All_ {
 
@EJB
    private ExtProjectBuilder builder;
 
 
    @PostConstruct
    public void createData() {
 
        String $i = "ConfigBean:@PostConstruct:createData";
 
        ...
 
        log_info($i,"create project 1 { ...");
        builder.buildProject("project1");
        log_info($i,"created project 1 }");
 
        log_info($i,"create project 2 { ...");
        builder.buildProject("project2"); // This is where the error is thrown
        log_info($i,"created project 2 }");
    }

The error is thrown on the attempt to use the buildProject(String name) method a second time in a row (in recent versions of ObjectDB only):

Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: create project 1 { ...
Info:   ExtProjectBuilder []: buildProject: BEFORE: Extended entity manager exists
Info:   ExtProjectBuilder []: buildProject: em.transaction.isActive(true)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Project [null]([project])
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Project [1]([project])
Info:   ExtProjectBuilder []: buildProject: AFTER: Extended entity manager exists
Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: created project 1 }
Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: create project 2 { ...
Warning:   A system exception occurred during an invocation on EJB ExtProjectBuilder, method: public com.greensoft.objectdb.test.mini.entity.Project com.greensoft.objectdb.test.mini.ejb.ExtProjectBuilder.buildProject(java.lang.String)
Warning:   javax.ejb.EJBException: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:2004)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy196.buildProject(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.__EJB31_Generated__ExtProjectBuilder__Intf____Bean__.buildProject(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.ExtConfigBean.createData(ExtConfigBean.java:51)

The @Stateless builder with the extended persistence context entity manager is:

@Stateful
 
public class ExtProjectBuilder extends All_ {
 
    @PersistenceContext(type = PersistenceContextType.EXTENDED)//!   
    protected EntityManager em;
 
    /*
    public ExtProjectBuilder() {
    }*/
    @EJB
    public //! so not reset() and so other builders can access
            ExtRequestBean request;
 
    /**
     * Use for multi-shot builder to clear lazy builder method triggers.
     */
    private void reset() {
        project = null;
    }
 
    public Project buildProject(String projectName) {
        String $i = "buildProject";
 
        if (em == null) {
            log_warn($i, "BEFORE: Extended entity manager not created yet");
        } else {
            log_info($i, "BEFORE: Extended entity manager exists");
            if (em.getTransaction() == null) {
                log_info($i, "em.transaction == null");
            } else {
                EntityTransaction t = em.getTransaction();
                log_info($i, "em.transaction.isActive", t.isActive());
            }
        }
 
        reset();
        project().setName(projectName);
 
        if (em == null) {
            log_warn($i,"AFTER: Extended entity manager NOT created yet");
        }
        else {
            log_info($i,"AFTER: Extended entity manager exists");
        }
        return project();
    }   
 
    private Project project;
 
    public Project project() {
        if (project == null) {
 
            // Following should associate the transaction bound to the extended persistence context here
            // with the transactional persistence context of the delegated EJB 'request'.
            project = request.createProject(null, "[project]");
 
            // Would normally do other builder stuff here and wiring
            // of entities using cascading lazy creation methods.
        }
        return project;
    }

 

Ignoring the logging diagnostics, all that matters here is that:

public Project buildProject(String projectName) {

Calls:

project().setName(projectName);

Which lazily triggers creation of a project (all complex sub-elements and wiring removed here) via:

project = request.createProject(null, "[project]");

Where in the simpler @Stateless delegate:

public Project createProject(
            Element owner,
            String name) {
        try {
            Project p = new Project(owner, name);
            persistElement(p);
            updateOwner(owner, p);
            return p;
        } catch (Exception ex) {
            throw new EJBException(ex.getMessage());
        }
    }
protected void persistElement(Element e) {
        log_created(e);
        persist(e);
        log_persisted(e);
    }
 
protected void persist(Object o) {
        try {
            em.persist(o);
            if (Global.USE_OBJECTDB) {
                em.flush(); //ObjectDB ensure id exists.
            }
        } catch (Exception ex) {
            log_error(ex);
            throw new EJBException(ex.getMessage());
        }
    }

The transaction associated with the extended persistence context entity manager of the @Stateful is supposed to become associated with the entity manager of the delegate @Stateless (and does seem to on the first shot through). However, on attempting to use buildProject(name) a 2nd time, I get that error:

Caused by: com.objectdb.o.UserException: Attempt to begin a new transaction when a transaction is active

Again, this used not to happen with much older versions of ObjectDB (however, for other reasons they don't run with this test project).

 

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #114
#2
2016-09-29 12:15

I have made progress with investigation and have a new improved mini test app with some mode switches at:

https://www.webel.com.au/downloads/objectdb/GreensoftObjectdbTestWebMini3683.2016-09-29-B.tgz

To reproduce the problem described above, download the test project, open in NetBeans8.1 and then:

Ensure DO_FORCE_COMMIT_AFTER_BUILD = false in com.greensoft.objectdb.test.mini.ejb.ExtProjectBuilder !

Then Clean and Build (objectdb-2.6.9_06.jar is already included and referenced under ./lib), and Run (will deploy to Glassfish4.1.1 bundled with NetBeans8.1).

(The new test app version now builds a slightly more complex Project with an additional Source entity and a "model" and "child" entity, but this has no consequence for the problems reported.)

The client @Singleton @Startup ExtConfigBean has an option to build two separate Project models:

@Singleton
@Startup
public class ExtConfigBean extends All_ {
 
    @EJB
    private ExtProjectBuilder builder;
 
    /**
     * If true 2 (not just 1) project entity structures will be built
     * (which in some cases demonstrates a problem with the
     * extended persistence context in ObjectDB).
     */
    final static boolean DO_BUILD_TWO_PROJECTS = true;       
 
    @PostConstruct
    public void createData() {
 
        String $i = "ExtConfigBean:@PostConstruct:createData";
        ...
        log_info($i, "create project 1 { ...");
 
        builder.buildProject("project1");
        log_info($i, "created project 1 }");
 
        if (DO_BUILD_TWO_PROJECTS) {
            log_info($i, "create project 2 { ...");
            builder.buildProject("project2");
            log_info($i, "created project 2 }");
        }
    }

The @Stateful ExtProjectBuilder has now additionally:

    /**
     * HACK: Should (according to DK of Webel) NOT be needed if the
     * extended persistence context is handled properly by ObjectDB.
     *
     * Disable (set 'false) to provoke an error due to the transaction not ending
     * after {@link buildProject} is invoked TWICE from a client like {@link ExtConfigBean},
     * which is controlled by {@link ExtConfigBean#DO_BUILD_TWO_PROJECTS}.
     */
    final static boolean DO_FORCE_COMMIT_AFTER_BUILD = false;
 
    @PersistenceContext(type = PersistenceContextType.EXTENDED)//!   
    protected EntityManager em;
 
    /*
    public ExtProjectBuilder() {
    }*/
 
    @EJB private ExtRequestBean request;
 
    /**
     * Use for multi-shot builder to clear lazy builder method private triggers.
     */
    private void reset() {
        project = null;
        source = null;
        model = null;
        child = null;
    }
 
    public Project buildProject(String projectName) {
 
        String $i = "buildProject";
 
        //Diagnostics only .. omitted        // Build a new (fresh) project
 
        reset();
        project().setName(projectName);
        source();
        model();
        child();
 
        //Diagnostics AND optional forced transaction commit (if active).
        if (em == null) {
            log_warn($i, "AFTER: Extended entity manager NOT created yet");
        } else {
            log_info($i, "AFTER: Extended entity manager exists");
 
            if (em.getTransaction() == null) {
                log_warn($i, "AFTER: transaction is null!");
            } else {
                EntityTransaction t = em.getTransaction();
                log_info($i, "AFTER: em.transaction.isActive", t.isActive());
 
                if (DO_FORCE_COMMIT_AFTER_BUILD && t.isActive()) {
                    log_info($i, "AFTER: forcing commit !");
                    t.commit();//!force: otherwise get error on next call to buildProject(String projectName)
                    //'com.objectdb.o.UserException: Attempt to begin a new transaction when a transaction is active'
 
                    //BUT this causes another error (although web app still runs)
                    //[ObjectDB 2.6.9_06] javax.persistence.TransactionRequiredException
                    //Attempt to flush a transaction when no transaction is active (error 611)
                }
 
            }
        }
 
        return project();
    }
 
    private Project project;
 
    public Project project() {
        if (project == null) {
 
            // Following should associate the transaction bound to the extended persistence context here
            // with the transactional persistence context of the delegated EJB 'request'.
            project = request.createProject(null, "[project]");
 
            // Would normally do other builder stuff here for project ..
            // before using in other cascading lazy creation methods.
        }
        return project;
    }
 
    private Element model;
 
    protected Element model() {
        if (model == null) {
            model = request.createElement(
                    project(),
                    project(),
                    "model",
                    source()//!
            );
        }
        return model;
    }
 
    private Source source;
 
    protected Source source() {
        if (source == null) {
            source = request.createSource(project(), project(), "source");
        }
        return source;
    }
 
    private Element child;
 
    protected Element child() {
        if (child == null) {
            child = request.createElement(model(), project(), "child", source());
        }
        return model;
    }

If you run it with:

    final static boolean DO_BUILD_TWO_PROJECTS = true; // in ExtConfigBean
 
    final static boolean DO_FORCE_COMMIT_AFTER_BUILD = false; // in ExtProjectBuilder

You get this originally reported error:

'com.objectdb.o.UserException: Attempt to begin a new transaction when a transaction is active'

 

If however you then set this so that it forces a transaction commit() at the end of each buildProject(String):

    final static boolean DO_FORCE_COMMIT_AFTER_BUILD = false; // in ExtProjectBuilder

AND you restart Glassfish and Clean and Build and Deploy/Run, the web app runs and will display this web page:

 

But then, when the commit() is executed on the second build pass, I get a new error (one that does not prevent the building of the 2 projects and also does not completely stop the web app deploying):

Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: create project 1 { ...
Info:   ExtProjectBuilder []: buildProject: BEFORE: Extended entity manager exists
Info:   ExtProjectBuilder []: buildProject: BEFORE: em.transaction.isActive(true)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Project [null]([project])
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Project [1]([project])
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Source [null](source)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Source [2](source)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Element [null](model)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Element [3](model)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Element [null](child)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Element [4](child)
Info:   ExtProjectBuilder []: buildProject: AFTER: Extended entity manager exists
Info:   ExtProjectBuilder []: buildProject: AFTER: em.transaction.isActive(true)
Info:   ExtProjectBuilder []: buildProject: AFTER: forcing commit !
Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: created project 1 }
Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: create project 2 { ...
Info:   ExtProjectBuilder []: buildProject: BEFORE: Extended entity manager exists
Info:   ExtProjectBuilder []: buildProject: BEFORE: em.transaction.isActive(true)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Project [null]([project])
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Project [5]([project])
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Source [null](source)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Source [6](source)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Element [null](model)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Element [7](model)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Element [null](child)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Element [8](child)
Info:   ExtProjectBuilder []: buildProject: AFTER: Extended entity manager exists
Info:   ExtProjectBuilder []: buildProject: AFTER: em.transaction.isActive(true)
Info:   ExtProjectBuilder []: buildProject: AFTER: forcing commit !
Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: created project 2 }
Warning:   DTX5014: Caught exception in beforeCompletion() callback:
[ObjectDB 2.6.9_06] javax.persistence.TransactionRequiredException
Attempt to flush a transaction when no transaction is active (error 611)
at com.objectdb.jpa.EMImpl.beforeCompletion(EMImpl.java:370)
at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:452)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:854)
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:723)
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:519)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:486)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)

Warning:   DTX5015: Caught exception in afterCompletion() callback:
[ObjectDB 2.6.9_06] javax.persistence.TransactionRequiredException
Attempt to rollback a transaction when no transaction is active (error 611)
at com.objectdb.jpa.EMImpl.afterCompletion(EMImpl.java:396)
at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:557)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:854)
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:723)
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:519)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:486)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)

Warning:   DTX5015: Caught exception in afterCompletion() callback:
[ObjectDB 2.6.9_06] javax.persistence.TransactionRequiredException
Attempt to rollback a transaction when no transaction is active (error 611)
at com.objectdb.jpa.EMImpl.afterCompletion(EMImpl.java:396)
at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:557)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:854)
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:723)
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:519)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:486)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
at java.lang.Thread.run(Thread.java:745)

Info:   Initializing Mojarra ...
'/GreensoftObjectdbTestWebMini3683'
Info:   Monitoring jndi:/server/GreensoftObjectdbTestWebMini3683/WEB-INF/faces-config.xml for modifications
Info:   Loading application [GreensoftObjectdbTestWebMini3683] at [/GreensoftObjectdbTestWebMini3683]
Info:   GreensoftObjectdbTestWebMini3683 was successfully deployed in 1,391 milliseconds.

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #116
#3
2016-10-03 10:09

Firstly, one can instead simply use a dedicated @EJB builder reference for each desired project one wishes to build, but it's not an ideal solution. It works (for now) as a workaround (only) for the purposes of my main real-world project - which means this issue is now lower priority for me - but it's not an ideal solution.

For example, with a single multi-shot builder with a reset() one can create projects easily in a loop; one can't inject with @EJB in a loop. One can also make a build depend on various states in previous builds (not shown in the test app here).

Also, I still think there's something wrong with ObjectDB here. The same problem occurs (same error message) if the client of an @EJB with extended persistence context Entity Manager calls a @Remove method on the EJB (but not if one simply relies on an @PreDestroy method).

From the latest version of my mini test app:

@Stateful
public class ExtProjectBuilder ... {
 
 
@PreDestroy
    protected void preDestroy() {
        String $i = "preDestroy";
        log_enter($i);
 
        // Release all lazy model element triggers
        reset();
 
        // Release other resources ...
 
        log_exit($i);
    }
 
    /**
     * WARNING: invoking this from client under ObjectDB 2.6.9_06 causes error !
     * javax.ejb.EJBException: com.objectdb.o._PersistenceException:
     *  Attempt to begin a new transaction when a transaction is active
     */
    @Remove
    public void remove() {
        //@PreDestroy method executes BEFORE here anyway
        String $i = "remove";
        log_enter($i);
        // Any other remove actions not covered by @PreDestroy ...
        log_exit($i);
    }

Invoking @Remove remove() from client after calling another method requiring a transaction such as buildProject() causes with ObjectDB 2.6.9_06 the same error as initially reported:

javax.ejb.EJBException: com.objectdb.o._PersistenceException:
Attempt to begin a new transaction when a transaction is active

For example:

@Singleton
@Startup
public class ExtConfigBean extends ... {
 
    @EJB
    private ExtProjectBuilder builder1;
 
    @EJB
    private ExtProjectBuilder builder2;
 
   @PostConstruct
     public void createData() {
 
        builder1.buildProject("project1");
        builder1.remove(); // ERROR TRIGGERED HERE
        builder2.buildProject("project2: separate");
        builder2.remove();

To reproduce this in the mini test web app set these switches true: 

DO_BUILD_TWO_PROJECTS = true;
DO_USE_2ND_BUILDER = true;
DO_USE_REMOVE = true;

UML class diagram of @Startup collaboration in latest test web app:

The full debug logging and stacktrace shows it is happening after @PreDestroy preDestroy() runs, as soon as it attempts to execute the @Remove remove():

Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: create  project 1 { ...
Info:   ExtProjectBuilder []: buildProject: BEFORE: Extended entity manager exists
Info:   ExtProjectBuilder []: buildProject: BEFORE: em.transaction.isActive(true)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Project [null]([project])
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Project [1]([project])
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Source [null](source)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Source [2](source)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Element [null](model)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Element [3](model)
Info:   ExtRequestBean []: Created: com.greensoft.objectdb.test.mini.entity.Element [null](child)
Info:   ExtRequestBean []: Persisted: com.greensoft.objectdb.test.mini.entity.Element [4](child)
Info:   ExtProjectBuilder []: buildProject: AFTER: Extended entity manager exists
Info:   ExtProjectBuilder []: buildProject: AFTER: em.transaction.isActive(true)
Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: created project 1 }

Info:   ExtConfigBean []: ConfigBean:@PostConstruct:createData: Explicitly remove  builder 1 {
Info:   preDestroy ENTER:
Info:   preDestroy  EXIT:

Warning:   A system exception occurred during an invocation on EJB ExtProjectBuilder, method: public void com.greensoft.objectdb.test.mini.ejb.ExtProjectBuilder.remove()
Warning:   javax.ejb.EJBException: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active

at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:2004)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy199.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.__EJB31_Generated__ExtProjectBuilder__Intf____Bean__.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.ExtConfigBean.createData(ExtConfigBean.java:65)
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:498)
at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1035)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:412)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:375)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2014)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:468)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
at com.objectdb.o.JPE.g(JPE.java:145)
at com.objectdb.o.ERR.f(ERR.java:56)
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1556)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:353)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:320)
at com.sun.ejb.containers.StatefulSessionContainer.enlistExtendedEntityManagers(StatefulSessionContainer.java:2808)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1992)
... 82 more
Caused by: com.objectdb.o.UserException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.OBC.D(OBC.java:1513)
at com.objectdb.o.OBM.bL(OBM.java:719)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:350)
... 85 more

Warning:   DTX5015: Caught exception in afterCompletion() callback:
[ObjectDB 2.6.9_06] javax.persistence.PersistenceException
Attempt to rollback a transaction using a closed EntityManager (error 525)
at com.objectdb.jpa.EMImpl.afterCompletion(EMImpl.java:396)
at com.sun.enterprise.transaction.JavaEETransactionImpl.rollback(JavaEETransactionImpl.java:621)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.rollback(JavaEETransactionManagerSimplified.java:887)
at com.sun.ejb.containers.EJBContainerTransactionManager.destroyBeanAndRollback(EJBContainerTransactionManager.java:574)
at com.sun.ejb.containers.EJBContainerTransactionManager.completeNewTx(EJBContainerTransactionManager.java:697)
at com.sun.ejb.containers.EJBContainerTransactionManager.postInvokeTx(EJBContainerTransactionManager.java:515)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4566)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:486)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.objectdb.o.UserException: Attempt to rollback a transaction using a closed EntityManager
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.OBC.bk(OBC.java:1485)
at com.objectdb.o.OBC.bl(OBC.java:1497)
at com.objectdb.o.OBM.rollbackTransaction(OBM.java:1050)
at com.objectdb.jpa.EMImpl.afterCompletion(EMImpl.java:385)
... 56 more

Info:   preDestroy ENTER:
Info:   preDestroy  EXIT:
Severe:   Exception while invoking class org.glassfish.ejb.startup.EjbApplication start method
javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton ExtConfigBean
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:649)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.ejb.CreateException: Initialization failed for Singleton ExtConfigBean
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:476)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
... 47 more
Caused by: javax.ejb.EJBException: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:2004)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy199.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.__EJB31_Generated__ExtProjectBuilder__Intf____Bean__.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.ExtConfigBean.createData(ExtConfigBean.java:65)
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:498)
at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1035)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:412)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:375)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2014)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:468)
... 49 more
Caused by: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
at com.objectdb.o.JPE.g(JPE.java:145)
at com.objectdb.o.ERR.f(ERR.java:56)
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1556)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:353)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:320)
at com.sun.ejb.containers.StatefulSessionContainer.enlistExtendedEntityManagers(StatefulSessionContainer.java:2808)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1992)
... 82 more
Caused by: com.objectdb.o.UserException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.OBC.D(OBC.java:1513)
at com.objectdb.o.OBM.bL(OBM.java:719)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:350)
... 85 more

Severe:   Exception during lifecycle processing
javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton ExtConfigBean
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:649)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.ejb.CreateException: Initialization failed for Singleton ExtConfigBean
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:476)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
... 47 more
Caused by: javax.ejb.EJBException: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:2004)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy199.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.__EJB31_Generated__ExtProjectBuilder__Intf____Bean__.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.ExtConfigBean.createData(ExtConfigBean.java:65)
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:498)
at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1035)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:412)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:375)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2014)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:468)
... 49 more
Caused by: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
at com.objectdb.o.JPE.g(JPE.java:145)
at com.objectdb.o.ERR.f(ERR.java:56)
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1556)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:353)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:320)
at com.sun.ejb.containers.StatefulSessionContainer.enlistExtendedEntityManagers(StatefulSessionContainer.java:2808)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1992)
... 82 more
Caused by: com.objectdb.o.UserException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.OBC.D(OBC.java:1513)
at com.objectdb.o.OBM.bL(OBM.java:719)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:350)
... 85 more

Severe:   Exception while loading the app
Severe:   Undeployment failed for context /GreensoftObjectdbTestWebMini3683
Severe:   Exception while loading the app : javax.ejb.CreateException: Initialization failed for Singleton ExtConfigBean
javax.ejb.CreateException: Initialization failed for Singleton ExtConfigBean
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:476)
at com.sun.ejb.containers.AbstractSingletonContainer.access$000(AbstractSingletonContainer.java:74)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:647)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:389)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:219)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:180)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:158)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:166)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:500)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.ejb.EJBException: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:2004)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
at com.sun.proxy.$Proxy199.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.__EJB31_Generated__ExtProjectBuilder__Intf____Bean__.remove(Unknown Source)
at com.greensoft.objectdb.test.mini.ejb.ExtConfigBean.createData(ExtConfigBean.java:65)
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:498)
at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1035)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:205)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:125)
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:498)
at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:986)
at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:72)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:412)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:375)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:2014)
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:468)
... 49 more
Caused by: com.objectdb.o._PersistenceException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
at com.objectdb.o.JPE.g(JPE.java:145)
at com.objectdb.o.ERR.f(ERR.java:56)
at com.objectdb.o.OBC.onObjectDBError(OBC.java:1556)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:353)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:320)
at com.sun.ejb.containers.StatefulSessionContainer.enlistExtendedEntityManagers(StatefulSessionContainer.java:2808)
at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1992)
... 82 more
Caused by: com.objectdb.o.UserException: Attempt to begin a new transaction when a transaction is active
at com.objectdb.o.MSG.d(MSG.java:62)
at com.objectdb.o.OBC.D(OBC.java:1513)
at com.objectdb.o.OBM.bL(OBM.java:719)
at com.objectdb.jpa.EMImpl.joinTransaction(EMImpl.java:350)
... 85 more

When DO_USE_REMOVE = false (when the remove() is not executed after each buildProject() and one relies on @PreDestroy) the web app runs fine and builds both projects.

And remember, please restart Glassfish between test runs.

 

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #117
#4
2016-10-04 01:59

This may not be related directly to the reported issue, but any feedback on this is welcome.

According to the Java EE 7 tutorial:

'34.1.2.1 Lifecycle Callback Methods
...
javax.annotation.PreDestroy: Methods annotated with @PreDestroy are
invoked after any method annotated @Remove has completed and before the
container removes the enterprise bean instance.'

This is also indicated in Figure 32-2 Lifecycle of a Stateful Session Bean:

(The EJB3.2 spec JSR 345 is not as clear on the order except in its similar Figure 5: Life Cycle of a Stateful Session Bean Instance.)

 

But, both the entry/exit diagnostic logging sequence and NetBeans debugger breakpoints show that when an @Remove remove() method is invoked the @PreDestroy preDestroy() method is executed BEFORE even a single line of the remove() method:

--- Webel IT Australia, "The Elements of the Web", Specialists in model-based UML, SysML, Enterprise Java, XML, and Drupal CMS web engineering. Dr Darren Kelly, BSc, PhD, https://www.webel.com.au
webel
webel's picture
Joined on 2011-05-27
User Post #118

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel