You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Leonardo K. Shikida" <sh...@gmail.com> on 2015/09/28 21:16:08 UTC

singleton initializing twice? (1.6.0-stable)

Hi

I have a singleton that initialized my own scheduler.

Please don't ask me why do I need another schedule, since TomEE already
provides one by default. Actually, I need this because since the JavaEE
spec is not clear about how the timers must be hadled when they're
persistent, I had to do this. But anyway.


@Startup
@Singleton
@DependsOn("SystemInitializerEJB")
public class TimerEJB{

    private Scheduler scheduler;

    private static Logger log = Logger.getLogger(TimerEJB.class);

    @PostConstruct
    public void initialize() throws SchedulerException{
        log.info("Initialize "+this);
        StdSchedulerFactory factory = new StdSchedulerFactory();

factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
        scheduler = factory.getScheduler();
        scheduler.start();
        log.info("scheduler "+scheduler.getMetaData().getSchedulerName());
    }


SOMETIMES...

it seems to be initialized twice, because I get this message

INFO: Started Ejb(deployment-id=SystemInitializerEJB,
ejb-name=SystemInitializerEJB, container=Default Singleton Container)

2015-09-28 17:40:02,806 INFO   [TimerEJB] Initialize
com.company.software.tomee.timer.TimerEJB@4d8818cd
2015-09-28 17:40:02,807 INFO   [TimerEJB] Initialize
com.company.software.tomee.timer.TimerEJB@7e2715a4 Sep 28, 2015 5:40:02 PM
org.quartz.impl.StdSchedulerFactory instantiate
INFO: Using default implementation for ThreadExecutor
Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Using default implementation for ThreadExecutor
Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
INFO: Initialized Scheduler Signaller of type: class
org.quartz.core.SchedulerSignalerImpl
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
INFO: Quartz Scheduler v.2.2.0 created.
Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
INFO: RAMJobStore initialized.
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support
persistence. and is not clustered.

Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
externally opened InputStream.
Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler version: 2.2.0
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler start
INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED started.

2015-09-28 17:40:02,847 INFO   [TimerEJB] scheduler MyClusteredScheduler2
Sep 28, 2015 5:40:02 PM org.apache.openejb.assembler.classic.Assembler
startEjbs
INFO: Started Ejb(deployment-id=myTimerEJB, ejb-name=myTimerEJB,
container=Default Singleton Container)
Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
INFO: Initialized Scheduler Signaller of type: class
org.quartz.core.SchedulerSignalerImpl
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
INFO: Quartz Scheduler v.2.2.0 created.
Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
INFO: RAMJobStore initialized.
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support
persistence. and is not clustered.

Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
externally opened InputStream.
Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
INFO: Quartz scheduler version: 2.2.0
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutting down.
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler standby
INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED paused.
Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutdown complete.
Sep 28, 2015 5:40:02 PM
org.apache.openejb.core.transaction.EjbTransactionUtil handleSystemException
SEVERE: EjbTransactionUtil.handleSystemException: Scheduler with name
'MyClusteredScheduler2' already exists.
org.quartz.SchedulerException: Scheduler with name 'MyClusteredScheduler2'
already exists.
    at org.quartz.impl.SchedulerRepository.bind(SchedulerRepository.java:80)
    at
org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1352)
    at
org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1517)
    at
com.company.software.tomee.timer.TimerEJB.initialize(TimerEJB.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:214)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
    at
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:180)
    at
org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:108)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
    at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:80)
    at org.apache.openejb.BeanContext.newInstance(BeanContext.java:1565)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:175)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
(...)

I can understand it seems to be like some dependency cycle, but I need to
know why it does not happen all the time and how to avoid this sort of
thing, because it really breaks the app.

Any help is welcome. thanks


[]

Leo

Re: singleton initializing twice? (1.6.0-stable)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
dont think so, using a scheduler factory you dont have this issue. But
doing it yourself you dont benefit from tomee defaults (values) so you have
to set it and with the right names. TomEE uses a shade with classes
relocation so config prefix changed compared to native quartz properties.



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-10-23 18:19 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:

> let me guess then
>
> tomee uses quartz and if I want to use the same library that comes bundled
> with tomee for a 2nd scheduler, it hit some configuration singleton because
> quartz did this way?
>
> []
>
> Leo
>
> On Fri, Oct 23, 2015 at 2:13 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > yep just depends the defaults of the impl you use.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-10-23 18:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:
> >
> > > notice that if I just comment CustomTimer.initialize(), tomee starts
> > > normally, even using the old prefixes
> > >
> > > []
> > >
> > > Leo
> > >
> > > On Fri, Oct 23, 2015 at 12:15 PM, Romain Manni-Bucau <
> > > rmannibucau@gmail.com>
> > > wrote:
> > >
> > > > can be a side effect of org.quartz relocation in
> > > org.apache.openejb.quartz
> > > > (config prefix changed as well). We limit the config side effects in
> > our
> > > > code but since you do it yourself you see it.
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > <http://www.tomitribe.com>
> > > >
> > > > 2015-10-23 16:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:
> > > >
> > > > > well, with 1.7.2 I get a different error message.
> > > > >
> > > > > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must
> > be
> > > >
> > > > 0
> > > > > org.apache.openejb.quartz.SchedulerConfigException: Thread count
> must
> > > be
> > > > >
> > > > > 0
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> > > > >
> > > > > here's what I am trying (sorry, no github here)
> > > > >
> > > > > import javax.annotation.PostConstruct;
> > > > > import javax.annotation.PreDestroy;
> > > > > import javax.ejb.Singleton;
> > > > > import javax.ejb.Startup;
> > > > >
> > > > > import org.apache.openejb.quartz.Scheduler;
> > > > > import org.apache.openejb.quartz.SchedulerException;
> > > > > import org.apache.openejb.quartz.impl.StdSchedulerFactory;
> > > > >
> > > > > @Startup
> > > > > @Singleton
> > > > > public class CustomTimer {
> > > > >         private Scheduler scheduler;
> > > > >
> > > > >         @PostConstruct
> > > > >         public void initialize() throws SchedulerException{
> > > > >             System.out.println("Initialize "+this);
> > > > >             StdSchedulerFactory factory = new
> StdSchedulerFactory();
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
> > > > >             scheduler = factory.getScheduler();
> > > > >             scheduler.start();
> > > > >             System.out.println("scheduler
> > > > > "+scheduler.getMetaData().getSchedulerName());
> > > > >         }
> > > > >
> > > > >         @PreDestroy
> > > > >         public void stop() {
> > > > >             try {
> > > > >                 System.out.println("scheduler stopping");
> > > > >                 scheduler.shutdown();
> > > > >                 System.out.println("scheduler stopped");
> > > > >             } catch (SchedulerException e) {
> > > > >                 e.printStackTrace();
> > > > >             }
> > > > >         }
> > > > >
> > > > > }
> > > > >
> > > > > import javax.ejb.Lock;
> > > > > import javax.ejb.LockType;
> > > > > import javax.ejb.Schedule;
> > > > > import javax.ejb.Singleton;
> > > > > import javax.ejb.Startup;
> > > > >
> > > > > @Singleton
> > > > > @Startup
> > > > > @Lock(LockType.READ)
> > > > > public class DefaultTimer {
> > > > >
> > > > >     @Schedule(second = "0", minute = "*", hour = "*", info =
> > > > > "defaultTimer")
> > > > >     public void periodic() {
> > > > >         System.out.println("running periodic timer");
> > > > >     }
> > > > > }
> > > > >
> > > > > my.quartz.properties
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > > # Configure Main Scheduler Properties
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > >
> > > > > org.quartz.scheduler.instanceName = MyClusteredScheduler2
> > > > > org.quartz.scheduler.instanceId = AUTO
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > > # Configure ThreadPool
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > >
> > > > > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > > > > org.quartz.threadPool.threadCount = 10
> > > > > org.quartz.threadPool.threadPriority = 5
> > > > >
> > > > > application.properties (tomee conf)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > > # Configure Main Scheduler Properties
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > >
> > > > > org.quartz.scheduler.instanceName = myScheduler
> > > > > org.quartz.scheduler.instanceId = AUTO
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > > # Configure ThreadPool
> > > > >
> > > > >
> > > >
> > >
> >
> #============================================================================
> > > > >
> > > > > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > > > > org.quartz.threadPool.threadCount = 10
> > > > > org.quartz.threadPool.threadPriority = 5
> > > > >
> > > > >
> > > > > I am not sure if I am using some wrong quartz key in the properties
> > > file.
> > > > > This kind of thing seems to work in 1.6.0, before the quartz
> packages
> > > > > refactoring in tomee.
> > > > >
> > > > > Complete stacktrace below
> > > > >
> > > > > Initialize CustomTimer@161485de
> > > > > Oct 23, 2015 12:04:33 PM
> > > > org.apache.openejb.quartz.impl.StdSchedulerFactory
> > > > > instantiate
> > > > > INFO: Using default implementation for ThreadExecutor
> > > > > Oct 23, 2015 12:04:33 PM
> > > > > org.apache.openejb.core.transaction.EjbTransactionUtil
> > > > > handleSystemException
> > > > > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must
> > be
> > > >
> > > > 0
> > > > > org.apache.openejb.quartz.SchedulerConfigException: Thread count
> must
> > > be
> > > > >
> > > > > 0
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1288)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
> > > > >     at CustomTimer.initialize(CustomTimer.java:24)
> > > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:223)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:109)
> > > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> > > > >     at
> > > org.apache.openejb.BeanContext.newInstance(BeanContext.java:1590)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:179)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
> > > > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:93)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.start(SingletonInstanceManager.java:84)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonContainer.start(SingletonContainer.java:125)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1382)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:652)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
> > > > >     at
> > > > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
> > > > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > > > >     at
> > > > >
> > > > >
> > > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > > > >     at java.lang.Thread.run(Thread.java:745)
> > > > >
> > > > >
> > > > > []
> > > > >
> > > > > Leo
> > > > >
> > > > > On Mon, Sep 28, 2015 at 5:43 PM, Howard W. Smith, Jr. <
> > > > > smithh032772@gmail.com> wrote:
> > > > >
> > > > > > My apologies, I did not see that behavior.
> > > > > >
> > > > > > On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. <
> > > > > > smithh032772@gmail.com> wrote:
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <
> > > > > > rmannibucau@gmail.com
> > > > > > > > wrote:
> > > > > > >
> > > > > > >> got it but knowing 1.7.2 has the same issue helps to identify
> if
> > > we
> > > > > need
> > > > > > >> to
> > > > > > >> solve an unidentified issue or a fixed issue with potentially
> a
> > > > > > >> workwround.
> > > > > > >>
> > > > > > >>
> > > > > > > hmmm, i've been using tomee 1.7.2 (in production) ever since
> June
> > > > 2015,
> > > > > > > and I think I saw this behavior, too, recently (once or twice).
> > Let
> > > > me
> > > > > > > check my log files and confirm.
> > > > > > >
> > > > > > >
> > > > > > What I saw was my app attempting to send multiple emails via my
> > > > JavaMail
> > > > > > POJO, invoked by some non-JMS code and immediately after via some
> > > > JMS/MDB
> > > > > > code, initializing twice,
> > > > > >
> > > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance
> of
> > > > > > mailSession
> > > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance
> of
> > > > > > mailSession
> > > > > >
> > > > > > and then initialized,
> > > > > >
> > > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > > > > mailSession
> > > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > > > > mailSession
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
let me guess then

tomee uses quartz and if I want to use the same library that comes bundled
with tomee for a 2nd scheduler, it hit some configuration singleton because
quartz did this way?

[]

Leo

On Fri, Oct 23, 2015 at 2:13 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> yep just depends the defaults of the impl you use.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-10-23 18:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:
>
> > notice that if I just comment CustomTimer.initialize(), tomee starts
> > normally, even using the old prefixes
> >
> > []
> >
> > Leo
> >
> > On Fri, Oct 23, 2015 at 12:15 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com>
> > wrote:
> >
> > > can be a side effect of org.quartz relocation in
> > org.apache.openejb.quartz
> > > (config prefix changed as well). We limit the config side effects in
> our
> > > code but since you do it yourself you see it.
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-10-23 16:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:
> > >
> > > > well, with 1.7.2 I get a different error message.
> > > >
> > > > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must
> be
> > >
> > > 0
> > > > org.apache.openejb.quartz.SchedulerConfigException: Thread count must
> > be
> > > >
> > > > 0
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> > > >
> > > > here's what I am trying (sorry, no github here)
> > > >
> > > > import javax.annotation.PostConstruct;
> > > > import javax.annotation.PreDestroy;
> > > > import javax.ejb.Singleton;
> > > > import javax.ejb.Startup;
> > > >
> > > > import org.apache.openejb.quartz.Scheduler;
> > > > import org.apache.openejb.quartz.SchedulerException;
> > > > import org.apache.openejb.quartz.impl.StdSchedulerFactory;
> > > >
> > > > @Startup
> > > > @Singleton
> > > > public class CustomTimer {
> > > >         private Scheduler scheduler;
> > > >
> > > >         @PostConstruct
> > > >         public void initialize() throws SchedulerException{
> > > >             System.out.println("Initialize "+this);
> > > >             StdSchedulerFactory factory = new StdSchedulerFactory();
> > > >
> > > >
> > > >
> > >
> >
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
> > > >             scheduler = factory.getScheduler();
> > > >             scheduler.start();
> > > >             System.out.println("scheduler
> > > > "+scheduler.getMetaData().getSchedulerName());
> > > >         }
> > > >
> > > >         @PreDestroy
> > > >         public void stop() {
> > > >             try {
> > > >                 System.out.println("scheduler stopping");
> > > >                 scheduler.shutdown();
> > > >                 System.out.println("scheduler stopped");
> > > >             } catch (SchedulerException e) {
> > > >                 e.printStackTrace();
> > > >             }
> > > >         }
> > > >
> > > > }
> > > >
> > > > import javax.ejb.Lock;
> > > > import javax.ejb.LockType;
> > > > import javax.ejb.Schedule;
> > > > import javax.ejb.Singleton;
> > > > import javax.ejb.Startup;
> > > >
> > > > @Singleton
> > > > @Startup
> > > > @Lock(LockType.READ)
> > > > public class DefaultTimer {
> > > >
> > > >     @Schedule(second = "0", minute = "*", hour = "*", info =
> > > > "defaultTimer")
> > > >     public void periodic() {
> > > >         System.out.println("running periodic timer");
> > > >     }
> > > > }
> > > >
> > > > my.quartz.properties
> > > >
> > > >
> > >
> >
> #============================================================================
> > > > # Configure Main Scheduler Properties
> > > >
> > > >
> > >
> >
> #============================================================================
> > > >
> > > > org.quartz.scheduler.instanceName = MyClusteredScheduler2
> > > > org.quartz.scheduler.instanceId = AUTO
> > > >
> > > >
> > > >
> > >
> >
> #============================================================================
> > > > # Configure ThreadPool
> > > >
> > > >
> > >
> >
> #============================================================================
> > > >
> > > > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > > > org.quartz.threadPool.threadCount = 10
> > > > org.quartz.threadPool.threadPriority = 5
> > > >
> > > > application.properties (tomee conf)
> > > >
> > > >
> > > >
> > >
> >
> #============================================================================
> > > > # Configure Main Scheduler Properties
> > > >
> > > >
> > >
> >
> #============================================================================
> > > >
> > > > org.quartz.scheduler.instanceName = myScheduler
> > > > org.quartz.scheduler.instanceId = AUTO
> > > >
> > > >
> > > >
> > >
> >
> #============================================================================
> > > > # Configure ThreadPool
> > > >
> > > >
> > >
> >
> #============================================================================
> > > >
> > > > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > > > org.quartz.threadPool.threadCount = 10
> > > > org.quartz.threadPool.threadPriority = 5
> > > >
> > > >
> > > > I am not sure if I am using some wrong quartz key in the properties
> > file.
> > > > This kind of thing seems to work in 1.6.0, before the quartz packages
> > > > refactoring in tomee.
> > > >
> > > > Complete stacktrace below
> > > >
> > > > Initialize CustomTimer@161485de
> > > > Oct 23, 2015 12:04:33 PM
> > > org.apache.openejb.quartz.impl.StdSchedulerFactory
> > > > instantiate
> > > > INFO: Using default implementation for ThreadExecutor
> > > > Oct 23, 2015 12:04:33 PM
> > > > org.apache.openejb.core.transaction.EjbTransactionUtil
> > > > handleSystemException
> > > > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must
> be
> > >
> > > 0
> > > > org.apache.openejb.quartz.SchedulerConfigException: Thread count must
> > be
> > > >
> > > > 0
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1288)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
> > > >     at CustomTimer.initialize(CustomTimer.java:24)
> > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > >     at
> > > >
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > > >     at
> > > >
> > > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:223)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:109)
> > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > >     at
> > > >
> > > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > > >     at
> > > >
> > > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> > > >     at
> > org.apache.openejb.BeanContext.newInstance(BeanContext.java:1590)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:179)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
> > > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:93)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.start(SingletonInstanceManager.java:84)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonContainer.start(SingletonContainer.java:125)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1382)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:652)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
> > > >     at
> > > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
> > > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > > >     at
> > > >
> > > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > > >     at
> > > >
> > > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > > >     at java.lang.Thread.run(Thread.java:745)
> > > >
> > > >
> > > > []
> > > >
> > > > Leo
> > > >
> > > > On Mon, Sep 28, 2015 at 5:43 PM, Howard W. Smith, Jr. <
> > > > smithh032772@gmail.com> wrote:
> > > >
> > > > > My apologies, I did not see that behavior.
> > > > >
> > > > > On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. <
> > > > > smithh032772@gmail.com> wrote:
> > > > >
> > > > > >
> > > > > >
> > > > > > On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > > > wrote:
> > > > > >
> > > > > >> got it but knowing 1.7.2 has the same issue helps to identify if
> > we
> > > > need
> > > > > >> to
> > > > > >> solve an unidentified issue or a fixed issue with potentially a
> > > > > >> workwround.
> > > > > >>
> > > > > >>
> > > > > > hmmm, i've been using tomee 1.7.2 (in production) ever since June
> > > 2015,
> > > > > > and I think I saw this behavior, too, recently (once or twice).
> Let
> > > me
> > > > > > check my log files and confirm.
> > > > > >
> > > > > >
> > > > > What I saw was my app attempting to send multiple emails via my
> > > JavaMail
> > > > > POJO, invoked by some non-JMS code and immediately after via some
> > > JMS/MDB
> > > > > code, initializing twice,
> > > > >
> > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > > > > mailSession
> > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > > > > mailSession
> > > > >
> > > > > and then initialized,
> > > > >
> > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > > > mailSession
> > > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > > > mailSession
> > > > >
> > > >
> > >
> >
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
yep just depends the defaults of the impl you use.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-10-23 18:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:

> notice that if I just comment CustomTimer.initialize(), tomee starts
> normally, even using the old prefixes
>
> []
>
> Leo
>
> On Fri, Oct 23, 2015 at 12:15 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com>
> wrote:
>
> > can be a side effect of org.quartz relocation in
> org.apache.openejb.quartz
> > (config prefix changed as well). We limit the config side effects in our
> > code but since you do it yourself you see it.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-10-23 16:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:
> >
> > > well, with 1.7.2 I get a different error message.
> > >
> > > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be
> >
> > 0
> > > org.apache.openejb.quartz.SchedulerConfigException: Thread count must
> be
> > >
> > > 0
> > >     at
> > >
> > >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> > >
> > > here's what I am trying (sorry, no github here)
> > >
> > > import javax.annotation.PostConstruct;
> > > import javax.annotation.PreDestroy;
> > > import javax.ejb.Singleton;
> > > import javax.ejb.Startup;
> > >
> > > import org.apache.openejb.quartz.Scheduler;
> > > import org.apache.openejb.quartz.SchedulerException;
> > > import org.apache.openejb.quartz.impl.StdSchedulerFactory;
> > >
> > > @Startup
> > > @Singleton
> > > public class CustomTimer {
> > >         private Scheduler scheduler;
> > >
> > >         @PostConstruct
> > >         public void initialize() throws SchedulerException{
> > >             System.out.println("Initialize "+this);
> > >             StdSchedulerFactory factory = new StdSchedulerFactory();
> > >
> > >
> > >
> >
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
> > >             scheduler = factory.getScheduler();
> > >             scheduler.start();
> > >             System.out.println("scheduler
> > > "+scheduler.getMetaData().getSchedulerName());
> > >         }
> > >
> > >         @PreDestroy
> > >         public void stop() {
> > >             try {
> > >                 System.out.println("scheduler stopping");
> > >                 scheduler.shutdown();
> > >                 System.out.println("scheduler stopped");
> > >             } catch (SchedulerException e) {
> > >                 e.printStackTrace();
> > >             }
> > >         }
> > >
> > > }
> > >
> > > import javax.ejb.Lock;
> > > import javax.ejb.LockType;
> > > import javax.ejb.Schedule;
> > > import javax.ejb.Singleton;
> > > import javax.ejb.Startup;
> > >
> > > @Singleton
> > > @Startup
> > > @Lock(LockType.READ)
> > > public class DefaultTimer {
> > >
> > >     @Schedule(second = "0", minute = "*", hour = "*", info =
> > > "defaultTimer")
> > >     public void periodic() {
> > >         System.out.println("running periodic timer");
> > >     }
> > > }
> > >
> > > my.quartz.properties
> > >
> > >
> >
> #============================================================================
> > > # Configure Main Scheduler Properties
> > >
> > >
> >
> #============================================================================
> > >
> > > org.quartz.scheduler.instanceName = MyClusteredScheduler2
> > > org.quartz.scheduler.instanceId = AUTO
> > >
> > >
> > >
> >
> #============================================================================
> > > # Configure ThreadPool
> > >
> > >
> >
> #============================================================================
> > >
> > > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > > org.quartz.threadPool.threadCount = 10
> > > org.quartz.threadPool.threadPriority = 5
> > >
> > > application.properties (tomee conf)
> > >
> > >
> > >
> >
> #============================================================================
> > > # Configure Main Scheduler Properties
> > >
> > >
> >
> #============================================================================
> > >
> > > org.quartz.scheduler.instanceName = myScheduler
> > > org.quartz.scheduler.instanceId = AUTO
> > >
> > >
> > >
> >
> #============================================================================
> > > # Configure ThreadPool
> > >
> > >
> >
> #============================================================================
> > >
> > > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > > org.quartz.threadPool.threadCount = 10
> > > org.quartz.threadPool.threadPriority = 5
> > >
> > >
> > > I am not sure if I am using some wrong quartz key in the properties
> file.
> > > This kind of thing seems to work in 1.6.0, before the quartz packages
> > > refactoring in tomee.
> > >
> > > Complete stacktrace below
> > >
> > > Initialize CustomTimer@161485de
> > > Oct 23, 2015 12:04:33 PM
> > org.apache.openejb.quartz.impl.StdSchedulerFactory
> > > instantiate
> > > INFO: Using default implementation for ThreadExecutor
> > > Oct 23, 2015 12:04:33 PM
> > > org.apache.openejb.core.transaction.EjbTransactionUtil
> > > handleSystemException
> > > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be
> >
> > 0
> > > org.apache.openejb.quartz.SchedulerConfigException: Thread count must
> be
> > >
> > > 0
> > >     at
> > >
> > >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> > >     at
> > >
> > >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1288)
> > >     at
> > >
> > >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
> > >     at CustomTimer.initialize(CustomTimer.java:24)
> > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >     at
> > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > >     at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:223)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > >     at
> > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> > >     at
> > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:109)
> > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >     at
> > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > >     at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> > >     at
> org.apache.openejb.BeanContext.newInstance(BeanContext.java:1590)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:179)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:93)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.start(SingletonInstanceManager.java:84)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonContainer.start(SingletonContainer.java:125)
> > >     at
> > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1382)
> > >     at
> > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
> > >     at
> > >
> > >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:652)
> > >     at
> > >
> > >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
> > >     at
> > >
> > >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
> > >     at
> > >
> > >
> >
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
> > >     at
> > >
> > >
> >
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
> > >     at
> > >
> > >
> >
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> > >     at
> > >
> > >
> >
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
> > >     at
> > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > >     at
> > >
> > >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
> > >     at
> > >
> > >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> > >     at
> > >
> > >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> > >     at java.lang.Thread.run(Thread.java:745)
> > >
> > >
> > > []
> > >
> > > Leo
> > >
> > > On Mon, Sep 28, 2015 at 5:43 PM, Howard W. Smith, Jr. <
> > > smithh032772@gmail.com> wrote:
> > >
> > > > My apologies, I did not see that behavior.
> > > >
> > > > On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. <
> > > > smithh032772@gmail.com> wrote:
> > > >
> > > > >
> > > > >
> > > > > On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > > > wrote:
> > > > >
> > > > >> got it but knowing 1.7.2 has the same issue helps to identify if
> we
> > > need
> > > > >> to
> > > > >> solve an unidentified issue or a fixed issue with potentially a
> > > > >> workwround.
> > > > >>
> > > > >>
> > > > > hmmm, i've been using tomee 1.7.2 (in production) ever since June
> > 2015,
> > > > > and I think I saw this behavior, too, recently (once or twice). Let
> > me
> > > > > check my log files and confirm.
> > > > >
> > > > >
> > > > What I saw was my app attempting to send multiple emails via my
> > JavaMail
> > > > POJO, invoked by some non-JMS code and immediately after via some
> > JMS/MDB
> > > > code, initializing twice,
> > > >
> > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > > > mailSession
> > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > > > mailSession
> > > >
> > > > and then initialized,
> > > >
> > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > > mailSession
> > > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > > mailSession
> > > >
> > >
> >
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
notice that if I just comment CustomTimer.initialize(), tomee starts
normally, even using the old prefixes

[]

Leo

On Fri, Oct 23, 2015 at 12:15 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> can be a side effect of org.quartz relocation in org.apache.openejb.quartz
> (config prefix changed as well). We limit the config side effects in our
> code but since you do it yourself you see it.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-10-23 16:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:
>
> > well, with 1.7.2 I get a different error message.
> >
> > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be >
> 0
> > org.apache.openejb.quartz.SchedulerConfigException: Thread count must be
> >
> > 0
> >     at
> >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> >
> > here's what I am trying (sorry, no github here)
> >
> > import javax.annotation.PostConstruct;
> > import javax.annotation.PreDestroy;
> > import javax.ejb.Singleton;
> > import javax.ejb.Startup;
> >
> > import org.apache.openejb.quartz.Scheduler;
> > import org.apache.openejb.quartz.SchedulerException;
> > import org.apache.openejb.quartz.impl.StdSchedulerFactory;
> >
> > @Startup
> > @Singleton
> > public class CustomTimer {
> >         private Scheduler scheduler;
> >
> >         @PostConstruct
> >         public void initialize() throws SchedulerException{
> >             System.out.println("Initialize "+this);
> >             StdSchedulerFactory factory = new StdSchedulerFactory();
> >
> >
> >
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
> >             scheduler = factory.getScheduler();
> >             scheduler.start();
> >             System.out.println("scheduler
> > "+scheduler.getMetaData().getSchedulerName());
> >         }
> >
> >         @PreDestroy
> >         public void stop() {
> >             try {
> >                 System.out.println("scheduler stopping");
> >                 scheduler.shutdown();
> >                 System.out.println("scheduler stopped");
> >             } catch (SchedulerException e) {
> >                 e.printStackTrace();
> >             }
> >         }
> >
> > }
> >
> > import javax.ejb.Lock;
> > import javax.ejb.LockType;
> > import javax.ejb.Schedule;
> > import javax.ejb.Singleton;
> > import javax.ejb.Startup;
> >
> > @Singleton
> > @Startup
> > @Lock(LockType.READ)
> > public class DefaultTimer {
> >
> >     @Schedule(second = "0", minute = "*", hour = "*", info =
> > "defaultTimer")
> >     public void periodic() {
> >         System.out.println("running periodic timer");
> >     }
> > }
> >
> > my.quartz.properties
> >
> >
> #============================================================================
> > # Configure Main Scheduler Properties
> >
> >
> #============================================================================
> >
> > org.quartz.scheduler.instanceName = MyClusteredScheduler2
> > org.quartz.scheduler.instanceId = AUTO
> >
> >
> >
> #============================================================================
> > # Configure ThreadPool
> >
> >
> #============================================================================
> >
> > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > org.quartz.threadPool.threadCount = 10
> > org.quartz.threadPool.threadPriority = 5
> >
> > application.properties (tomee conf)
> >
> >
> >
> #============================================================================
> > # Configure Main Scheduler Properties
> >
> >
> #============================================================================
> >
> > org.quartz.scheduler.instanceName = myScheduler
> > org.quartz.scheduler.instanceId = AUTO
> >
> >
> >
> #============================================================================
> > # Configure ThreadPool
> >
> >
> #============================================================================
> >
> > org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> > org.quartz.threadPool.threadCount = 10
> > org.quartz.threadPool.threadPriority = 5
> >
> >
> > I am not sure if I am using some wrong quartz key in the properties file.
> > This kind of thing seems to work in 1.6.0, before the quartz packages
> > refactoring in tomee.
> >
> > Complete stacktrace below
> >
> > Initialize CustomTimer@161485de
> > Oct 23, 2015 12:04:33 PM
> org.apache.openejb.quartz.impl.StdSchedulerFactory
> > instantiate
> > INFO: Using default implementation for ThreadExecutor
> > Oct 23, 2015 12:04:33 PM
> > org.apache.openejb.core.transaction.EjbTransactionUtil
> > handleSystemException
> > SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be >
> 0
> > org.apache.openejb.quartz.SchedulerConfigException: Thread count must be
> >
> > 0
> >     at
> >
> >
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
> >     at
> >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1288)
> >     at
> >
> >
> org.apache.openejb.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
> >     at CustomTimer.initialize(CustomTimer.java:24)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >     at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >     at java.lang.reflect.Method.invoke(Method.java:606)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:223)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> >     at
> >
> >
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> >     at
> >
> >
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:109)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >     at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >     at java.lang.reflect.Method.invoke(Method.java:606)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> >     at org.apache.openejb.BeanContext.newInstance(BeanContext.java:1590)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:179)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:93)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.start(SingletonInstanceManager.java:84)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonContainer.start(SingletonContainer.java:125)
> >     at
> >
> >
> org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1382)
> >     at
> >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
> >     at
> >
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:652)
> >     at
> >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
> >     at
> >
> >
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
> >     at
> >
> >
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
> >     at
> >
> >
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
> >     at
> >
> >
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> >     at
> >
> >
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
> >     at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> >     at
> >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
> >     at
> >
> >
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> >     at
> >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> >     at java.lang.Thread.run(Thread.java:745)
> >
> >
> > []
> >
> > Leo
> >
> > On Mon, Sep 28, 2015 at 5:43 PM, Howard W. Smith, Jr. <
> > smithh032772@gmail.com> wrote:
> >
> > > My apologies, I did not see that behavior.
> > >
> > > On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. <
> > > smithh032772@gmail.com> wrote:
> > >
> > > >
> > > >
> > > > On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > > wrote:
> > > >
> > > >> got it but knowing 1.7.2 has the same issue helps to identify if we
> > need
> > > >> to
> > > >> solve an unidentified issue or a fixed issue with potentially a
> > > >> workwround.
> > > >>
> > > >>
> > > > hmmm, i've been using tomee 1.7.2 (in production) ever since June
> 2015,
> > > > and I think I saw this behavior, too, recently (once or twice). Let
> me
> > > > check my log files and confirm.
> > > >
> > > >
> > > What I saw was my app attempting to send multiple emails via my
> JavaMail
> > > POJO, invoked by some non-JMS code and immediately after via some
> JMS/MDB
> > > code, initializing twice,
> > >
> > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > > mailSession
> > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > > mailSession
> > >
> > > and then initialized,
> > >
> > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > mailSession
> > > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > > mailSession
> > >
> >
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can be a side effect of org.quartz relocation in org.apache.openejb.quartz
(config prefix changed as well). We limit the config side effects in our
code but since you do it yourself you see it.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-10-23 16:09 GMT+02:00 Leonardo K. Shikida <sh...@gmail.com>:

> well, with 1.7.2 I get a different error message.
>
> SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be > 0
> org.apache.openejb.quartz.SchedulerConfigException: Thread count must be >
> 0
>     at
>
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
>
> here's what I am trying (sorry, no github here)
>
> import javax.annotation.PostConstruct;
> import javax.annotation.PreDestroy;
> import javax.ejb.Singleton;
> import javax.ejb.Startup;
>
> import org.apache.openejb.quartz.Scheduler;
> import org.apache.openejb.quartz.SchedulerException;
> import org.apache.openejb.quartz.impl.StdSchedulerFactory;
>
> @Startup
> @Singleton
> public class CustomTimer {
>         private Scheduler scheduler;
>
>         @PostConstruct
>         public void initialize() throws SchedulerException{
>             System.out.println("Initialize "+this);
>             StdSchedulerFactory factory = new StdSchedulerFactory();
>
>
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
>             scheduler = factory.getScheduler();
>             scheduler.start();
>             System.out.println("scheduler
> "+scheduler.getMetaData().getSchedulerName());
>         }
>
>         @PreDestroy
>         public void stop() {
>             try {
>                 System.out.println("scheduler stopping");
>                 scheduler.shutdown();
>                 System.out.println("scheduler stopped");
>             } catch (SchedulerException e) {
>                 e.printStackTrace();
>             }
>         }
>
> }
>
> import javax.ejb.Lock;
> import javax.ejb.LockType;
> import javax.ejb.Schedule;
> import javax.ejb.Singleton;
> import javax.ejb.Startup;
>
> @Singleton
> @Startup
> @Lock(LockType.READ)
> public class DefaultTimer {
>
>     @Schedule(second = "0", minute = "*", hour = "*", info =
> "defaultTimer")
>     public void periodic() {
>         System.out.println("running periodic timer");
>     }
> }
>
> my.quartz.properties
>
> #============================================================================
> # Configure Main Scheduler Properties
>
> #============================================================================
>
> org.quartz.scheduler.instanceName = MyClusteredScheduler2
> org.quartz.scheduler.instanceId = AUTO
>
>
> #============================================================================
> # Configure ThreadPool
>
> #============================================================================
>
> org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> org.quartz.threadPool.threadCount = 10
> org.quartz.threadPool.threadPriority = 5
>
> application.properties (tomee conf)
>
>
> #============================================================================
> # Configure Main Scheduler Properties
>
> #============================================================================
>
> org.quartz.scheduler.instanceName = myScheduler
> org.quartz.scheduler.instanceId = AUTO
>
>
> #============================================================================
> # Configure ThreadPool
>
> #============================================================================
>
> org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
> org.quartz.threadPool.threadCount = 10
> org.quartz.threadPool.threadPriority = 5
>
>
> I am not sure if I am using some wrong quartz key in the properties file.
> This kind of thing seems to work in 1.6.0, before the quartz packages
> refactoring in tomee.
>
> Complete stacktrace below
>
> Initialize CustomTimer@161485de
> Oct 23, 2015 12:04:33 PM org.apache.openejb.quartz.impl.StdSchedulerFactory
> instantiate
> INFO: Using default implementation for ThreadExecutor
> Oct 23, 2015 12:04:33 PM
> org.apache.openejb.core.transaction.EjbTransactionUtil
> handleSystemException
> SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be > 0
> org.apache.openejb.quartz.SchedulerConfigException: Thread count must be >
> 0
>     at
>
> org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
>     at
>
> org.apache.openejb.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1288)
>     at
>
> org.apache.openejb.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
>     at CustomTimer.initialize(CustomTimer.java:24)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:223)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
>     at
>
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
>     at
>
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:109)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
>     at
>
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
>     at org.apache.openejb.BeanContext.newInstance(BeanContext.java:1590)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:179)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:93)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.start(SingletonInstanceManager.java:84)
>     at
>
> org.apache.openejb.core.singleton.SingletonContainer.start(SingletonContainer.java:125)
>     at
>
> org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1382)
>     at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
>     at
>
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:652)
>     at
>
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
>     at
>
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
>     at
>
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
>     at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
>     at
>
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>     at
>
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>     at
>
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
>     at
>
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:745)
>
>
> []
>
> Leo
>
> On Mon, Sep 28, 2015 at 5:43 PM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
> > My apologies, I did not see that behavior.
> >
> > On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. <
> > smithh032772@gmail.com> wrote:
> >
> > >
> > >
> > > On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > > wrote:
> > >
> > >> got it but knowing 1.7.2 has the same issue helps to identify if we
> need
> > >> to
> > >> solve an unidentified issue or a fixed issue with potentially a
> > >> workwround.
> > >>
> > >>
> > > hmmm, i've been using tomee 1.7.2 (in production) ever since June 2015,
> > > and I think I saw this behavior, too, recently (once or twice). Let me
> > > check my log files and confirm.
> > >
> > >
> > What I saw was my app attempting to send multiple emails via my JavaMail
> > POJO, invoked by some non-JMS code and immediately after via some JMS/MDB
> > code, initializing twice,
> >
> > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > mailSession
> > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> > mailSession
> >
> > and then initialized,
> >
> > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > mailSession
> > Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> > INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> > mailSession
> >
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
well, with 1.7.2 I get a different error message.

SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be > 0
org.apache.openejb.quartz.SchedulerConfigException: Thread count must be > 0
    at
org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)

here's what I am trying (sorry, no github here)

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.Singleton;
import javax.ejb.Startup;

import org.apache.openejb.quartz.Scheduler;
import org.apache.openejb.quartz.SchedulerException;
import org.apache.openejb.quartz.impl.StdSchedulerFactory;

@Startup
@Singleton
public class CustomTimer {
        private Scheduler scheduler;

        @PostConstruct
        public void initialize() throws SchedulerException{
            System.out.println("Initialize "+this);
            StdSchedulerFactory factory = new StdSchedulerFactory();

factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
            scheduler = factory.getScheduler();
            scheduler.start();
            System.out.println("scheduler
"+scheduler.getMetaData().getSchedulerName());
        }

        @PreDestroy
        public void stop() {
            try {
                System.out.println("scheduler stopping");
                scheduler.shutdown();
                System.out.println("scheduler stopped");
            } catch (SchedulerException e) {
                e.printStackTrace();
            }
        }

}

import javax.ejb.Lock;
import javax.ejb.LockType;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;

@Singleton
@Startup
@Lock(LockType.READ)
public class DefaultTimer {

    @Schedule(second = "0", minute = "*", hour = "*", info = "defaultTimer")
    public void periodic() {
        System.out.println("running periodic timer");
    }
}

my.quartz.properties
#============================================================================
# Configure Main Scheduler Properties
#============================================================================

org.quartz.scheduler.instanceName = MyClusteredScheduler2
org.quartz.scheduler.instanceId = AUTO

#============================================================================
# Configure ThreadPool
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5

application.properties (tomee conf)

#============================================================================
# Configure Main Scheduler Properties
#============================================================================

org.quartz.scheduler.instanceName = myScheduler
org.quartz.scheduler.instanceId = AUTO

#============================================================================
# Configure ThreadPool
#============================================================================

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5


I am not sure if I am using some wrong quartz key in the properties file.
This kind of thing seems to work in 1.6.0, before the quartz packages
refactoring in tomee.

Complete stacktrace below

Initialize CustomTimer@161485de
Oct 23, 2015 12:04:33 PM org.apache.openejb.quartz.impl.StdSchedulerFactory
instantiate
INFO: Using default implementation for ThreadExecutor
Oct 23, 2015 12:04:33 PM
org.apache.openejb.core.transaction.EjbTransactionUtil handleSystemException
SEVERE: EjbTransactionUtil.handleSystemException: Thread count must be > 0
org.apache.openejb.quartz.SchedulerConfigException: Thread count must be > 0
    at
org.apache.openejb.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:242)
    at
org.apache.openejb.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1288)
    at
org.apache.openejb.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)
    at CustomTimer.initialize(CustomTimer.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:223)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
    at
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
    at
org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
    at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
    at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
    at org.apache.openejb.BeanContext.newInstance(BeanContext.java:1590)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:179)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:69)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:120)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:118)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:129)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:93)
    at
org.apache.openejb.core.singleton.SingletonInstanceManager.start(SingletonInstanceManager.java:84)
    at
org.apache.openejb.core.singleton.SingletonContainer.start(SingletonContainer.java:125)
    at
org.apache.openejb.assembler.classic.Assembler.startEjbs(Assembler.java:1382)
    at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:878)
    at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:652)
    at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1261)
    at
org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1100)
    at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:130)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5416)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)


[]

Leo

On Mon, Sep 28, 2015 at 5:43 PM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> My apologies, I did not see that behavior.
>
> On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
> >
> >
> > On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > > wrote:
> >
> >> got it but knowing 1.7.2 has the same issue helps to identify if we need
> >> to
> >> solve an unidentified issue or a fixed issue with potentially a
> >> workwround.
> >>
> >>
> > hmmm, i've been using tomee 1.7.2 (in production) ever since June 2015,
> > and I think I saw this behavior, too, recently (once or twice). Let me
> > check my log files and confirm.
> >
> >
> What I saw was my app attempting to send multiple emails via my JavaMail
> POJO, invoked by some non-JMS code and immediately after via some JMS/MDB
> code, initializing twice,
>
> Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> mailSession
> Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
> mailSession
>
> and then initialized,
>
> Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> mailSession
> Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
> INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
> mailSession
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
My apologies, I did not see that behavior.

On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

>
>
> On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> > wrote:
>
>> got it but knowing 1.7.2 has the same issue helps to identify if we need
>> to
>> solve an unidentified issue or a fixed issue with potentially a
>> workwround.
>>
>>
> hmmm, i've been using tomee 1.7.2 (in production) ever since June 2015,
> and I think I saw this behavior, too, recently (once or twice). Let me
> check my log files and confirm.
>
>
What I saw was my app attempting to send multiple emails via my JavaMail
POJO, invoked by some non-JMS code and immediately after via some JMS/MDB
code, initializing twice,

Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
mailSession
Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
INFO: JavaMail.initMailSession(): initializing DEFAULT instance of
mailSession

and then initialized,

Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
mailSession
Sep 23, 2015 11:02:06 PM utils.mail.JavaMail initMailSession
INFO: JavaMail.initMailSession(): initialized DEFAULT instance of
mailSession

Re: singleton initializing twice? (1.6.0-stable)

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> got it but knowing 1.7.2 has the same issue helps to identify if we need to
> solve an unidentified issue or a fixed issue with potentially a workwround.
>
>
hmmm, i've been using tomee 1.7.2 (in production) ever since June 2015, and
I think I saw this behavior, too, recently (once or twice). Let me check my
log files and confirm.

Re: singleton initializing twice? (1.6.0-stable)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
got it but knowing 1.7.2 has the same issue helps to identify if we need to
solve an unidentified issue or a fixed issue with potentially a workwround.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-28 12:52 GMT-07:00 Leonardo K. Shikida <sh...@gmail.com>:

> I am sorry, 1.6.0 is in production here.
>
> :-(
>
>
> []
>
> Leo
>
> On Mon, Sep 28, 2015 at 4:38 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > Hi Leo,
> >
> > can you quickly check it on 1.7.2 before digging into 1.6.0 bugs? I know
> we
> > enhanced a bit this area (singleton) so can be fixed.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-09-28 12:16 GMT-07:00 Leonardo K. Shikida <sh...@gmail.com>:
> >
> > > Hi
> > >
> > > I have a singleton that initialized my own scheduler.
> > >
> > > Please don't ask me why do I need another schedule, since TomEE already
> > > provides one by default. Actually, I need this because since the JavaEE
> > > spec is not clear about how the timers must be hadled when they're
> > > persistent, I had to do this. But anyway.
> > >
> > >
> > > @Startup
> > > @Singleton
> > > @DependsOn("SystemInitializerEJB")
> > > public class TimerEJB{
> > >
> > >     private Scheduler scheduler;
> > >
> > >     private static Logger log = Logger.getLogger(TimerEJB.class);
> > >
> > >     @PostConstruct
> > >     public void initialize() throws SchedulerException{
> > >         log.info("Initialize "+this);
> > >         StdSchedulerFactory factory = new StdSchedulerFactory();
> > >
> > >
> > >
> >
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
> > >         scheduler = factory.getScheduler();
> > >         scheduler.start();
> > >         log.info("scheduler
> > "+scheduler.getMetaData().getSchedulerName());
> > >     }
> > >
> > >
> > > SOMETIMES...
> > >
> > > it seems to be initialized twice, because I get this message
> > >
> > > INFO: Started Ejb(deployment-id=SystemInitializerEJB,
> > > ejb-name=SystemInitializerEJB, container=Default Singleton Container)
> > >
> > > 2015-09-28 17:40:02,806 INFO   [TimerEJB] Initialize
> > > com.company.software.tomee.timer.TimerEJB@4d8818cd
> > > 2015-09-28 17:40:02,807 INFO   [TimerEJB] Initialize
> > > com.company.software.tomee.timer.TimerEJB@7e2715a4 Sep 28, 2015
> 5:40:02
> > PM
> > > org.quartz.impl.StdSchedulerFactory instantiate
> > > INFO: Using default implementation for ThreadExecutor
> > > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > > INFO: Using default implementation for ThreadExecutor
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
> > > INFO: Initialized Scheduler Signaller of type: class
> > > org.quartz.core.SchedulerSignalerImpl
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
> > > INFO: Quartz Scheduler v.2.2.0 created.
> > > Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
> > > INFO: RAMJobStore initialized.
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
> > > INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
> > > 'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
> > >   Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
> > >   NOT STARTED.
> > >   Currently in standby mode.
> > >   Number of jobs executed: 0
> > >   Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30
> > threads.
> > >   Using job-store 'org.quartz.simpl.RAMJobStore' - which does not
> support
> > > persistence. and is not clustered.
> > >
> > > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > > INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
> > > externally opened InputStream.
> > > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > > INFO: Quartz scheduler version: 2.2.0
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler start
> > > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED started.
> > >
> > > 2015-09-28 17:40:02,847 INFO   [TimerEJB] scheduler
> MyClusteredScheduler2
> > > Sep 28, 2015 5:40:02 PM org.apache.openejb.assembler.classic.Assembler
> > > startEjbs
> > > INFO: Started Ejb(deployment-id=myTimerEJB, ejb-name=myTimerEJB,
> > > container=Default Singleton Container)
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
> > > INFO: Initialized Scheduler Signaller of type: class
> > > org.quartz.core.SchedulerSignalerImpl
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
> > > INFO: Quartz Scheduler v.2.2.0 created.
> > > Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
> > > INFO: RAMJobStore initialized.
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
> > > INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
> > > 'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
> > >   Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
> > >   NOT STARTED.
> > >   Currently in standby mode.
> > >   Number of jobs executed: 0
> > >   Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30
> > threads.
> > >   Using job-store 'org.quartz.simpl.RAMJobStore' - which does not
> support
> > > persistence. and is not clustered.
> > >
> > > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > > INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
> > > externally opened InputStream.
> > > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > > INFO: Quartz scheduler version: 2.2.0
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
> > > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutting down.
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler standby
> > > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED paused.
> > > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
> > > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutdown
> complete.
> > > Sep 28, 2015 5:40:02 PM
> > > org.apache.openejb.core.transaction.EjbTransactionUtil
> > > handleSystemException
> > > SEVERE: EjbTransactionUtil.handleSystemException: Scheduler with name
> > > 'MyClusteredScheduler2' already exists.
> > > org.quartz.SchedulerException: Scheduler with name
> > 'MyClusteredScheduler2'
> > > already exists.
> > >     at
> > > org.quartz.impl.SchedulerRepository.bind(SchedulerRepository.java:80)
> > >     at
> > >
> > >
> >
> org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1352)
> > >     at
> > >
> > >
> >
> org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1517)
> > >     at
> > > com.company.software.tomee.timer.TimerEJB.initialize(TimerEJB.java:71)
> > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >     at
> > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > >     at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:214)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
> > >     at
> > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:180)
> > >     at
> > >
> > >
> >
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:108)
> > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >     at
> > >
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > >     at
> > >
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > >     at java.lang.reflect.Method.invoke(Method.java:606)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:80)
> > >     at
> org.apache.openejb.BeanContext.newInstance(BeanContext.java:1565)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:175)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> > >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> > >     at
> > >
> > >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> > > (...)
> > >
> > > I can understand it seems to be like some dependency cycle, but I need
> to
> > > know why it does not happen all the time and how to avoid this sort of
> > > thing, because it really breaks the app.
> > >
> > > Any help is welcome. thanks
> > >
> > >
> > > []
> > >
> > > Leo
> > >
> >
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by "Leonardo K. Shikida" <sh...@gmail.com>.
I am sorry, 1.6.0 is in production here.

:-(


[]

Leo

On Mon, Sep 28, 2015 at 4:38 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Hi Leo,
>
> can you quickly check it on 1.7.2 before digging into 1.6.0 bugs? I know we
> enhanced a bit this area (singleton) so can be fixed.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-09-28 12:16 GMT-07:00 Leonardo K. Shikida <sh...@gmail.com>:
>
> > Hi
> >
> > I have a singleton that initialized my own scheduler.
> >
> > Please don't ask me why do I need another schedule, since TomEE already
> > provides one by default. Actually, I need this because since the JavaEE
> > spec is not clear about how the timers must be hadled when they're
> > persistent, I had to do this. But anyway.
> >
> >
> > @Startup
> > @Singleton
> > @DependsOn("SystemInitializerEJB")
> > public class TimerEJB{
> >
> >     private Scheduler scheduler;
> >
> >     private static Logger log = Logger.getLogger(TimerEJB.class);
> >
> >     @PostConstruct
> >     public void initialize() throws SchedulerException{
> >         log.info("Initialize "+this);
> >         StdSchedulerFactory factory = new StdSchedulerFactory();
> >
> >
> >
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
> >         scheduler = factory.getScheduler();
> >         scheduler.start();
> >         log.info("scheduler
> "+scheduler.getMetaData().getSchedulerName());
> >     }
> >
> >
> > SOMETIMES...
> >
> > it seems to be initialized twice, because I get this message
> >
> > INFO: Started Ejb(deployment-id=SystemInitializerEJB,
> > ejb-name=SystemInitializerEJB, container=Default Singleton Container)
> >
> > 2015-09-28 17:40:02,806 INFO   [TimerEJB] Initialize
> > com.company.software.tomee.timer.TimerEJB@4d8818cd
> > 2015-09-28 17:40:02,807 INFO   [TimerEJB] Initialize
> > com.company.software.tomee.timer.TimerEJB@7e2715a4 Sep 28, 2015 5:40:02
> PM
> > org.quartz.impl.StdSchedulerFactory instantiate
> > INFO: Using default implementation for ThreadExecutor
> > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > INFO: Using default implementation for ThreadExecutor
> > Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
> > INFO: Initialized Scheduler Signaller of type: class
> > org.quartz.core.SchedulerSignalerImpl
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
> > INFO: Quartz Scheduler v.2.2.0 created.
> > Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
> > INFO: RAMJobStore initialized.
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
> > INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
> > 'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
> >   Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
> >   NOT STARTED.
> >   Currently in standby mode.
> >   Number of jobs executed: 0
> >   Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30
> threads.
> >   Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support
> > persistence. and is not clustered.
> >
> > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
> > externally opened InputStream.
> > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > INFO: Quartz scheduler version: 2.2.0
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler start
> > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED started.
> >
> > 2015-09-28 17:40:02,847 INFO   [TimerEJB] scheduler MyClusteredScheduler2
> > Sep 28, 2015 5:40:02 PM org.apache.openejb.assembler.classic.Assembler
> > startEjbs
> > INFO: Started Ejb(deployment-id=myTimerEJB, ejb-name=myTimerEJB,
> > container=Default Singleton Container)
> > Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
> > INFO: Initialized Scheduler Signaller of type: class
> > org.quartz.core.SchedulerSignalerImpl
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
> > INFO: Quartz Scheduler v.2.2.0 created.
> > Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
> > INFO: RAMJobStore initialized.
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
> > INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
> > 'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
> >   Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
> >   NOT STARTED.
> >   Currently in standby mode.
> >   Number of jobs executed: 0
> >   Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30
> threads.
> >   Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support
> > persistence. and is not clustered.
> >
> > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
> > externally opened InputStream.
> > Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> > INFO: Quartz scheduler version: 2.2.0
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
> > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutting down.
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler standby
> > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED paused.
> > Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
> > INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutdown complete.
> > Sep 28, 2015 5:40:02 PM
> > org.apache.openejb.core.transaction.EjbTransactionUtil
> > handleSystemException
> > SEVERE: EjbTransactionUtil.handleSystemException: Scheduler with name
> > 'MyClusteredScheduler2' already exists.
> > org.quartz.SchedulerException: Scheduler with name
> 'MyClusteredScheduler2'
> > already exists.
> >     at
> > org.quartz.impl.SchedulerRepository.bind(SchedulerRepository.java:80)
> >     at
> >
> >
> org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1352)
> >     at
> >
> >
> org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1517)
> >     at
> > com.company.software.tomee.timer.TimerEJB.initialize(TimerEJB.java:71)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >     at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >     at java.lang.reflect.Method.invoke(Method.java:606)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:214)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
> >     at
> >
> >
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:180)
> >     at
> >
> >
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:108)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >     at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >     at java.lang.reflect.Method.invoke(Method.java:606)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
> >     at
> >
> >
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:80)
> >     at org.apache.openejb.BeanContext.newInstance(BeanContext.java:1565)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:175)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
> >     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
> >     at
> >
> >
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> > (...)
> >
> > I can understand it seems to be like some dependency cycle, but I need to
> > know why it does not happen all the time and how to avoid this sort of
> > thing, because it really breaks the app.
> >
> > Any help is welcome. thanks
> >
> >
> > []
> >
> > Leo
> >
>

Re: singleton initializing twice? (1.6.0-stable)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Leo,

can you quickly check it on 1.7.2 before digging into 1.6.0 bugs? I know we
enhanced a bit this area (singleton) so can be fixed.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-09-28 12:16 GMT-07:00 Leonardo K. Shikida <sh...@gmail.com>:

> Hi
>
> I have a singleton that initialized my own scheduler.
>
> Please don't ask me why do I need another schedule, since TomEE already
> provides one by default. Actually, I need this because since the JavaEE
> spec is not clear about how the timers must be hadled when they're
> persistent, I had to do this. But anyway.
>
>
> @Startup
> @Singleton
> @DependsOn("SystemInitializerEJB")
> public class TimerEJB{
>
>     private Scheduler scheduler;
>
>     private static Logger log = Logger.getLogger(TimerEJB.class);
>
>     @PostConstruct
>     public void initialize() throws SchedulerException{
>         log.info("Initialize "+this);
>         StdSchedulerFactory factory = new StdSchedulerFactory();
>
>
> factory.initialize(this.getClass().getResourceAsStream("my.quartz.properties"));
>         scheduler = factory.getScheduler();
>         scheduler.start();
>         log.info("scheduler "+scheduler.getMetaData().getSchedulerName());
>     }
>
>
> SOMETIMES...
>
> it seems to be initialized twice, because I get this message
>
> INFO: Started Ejb(deployment-id=SystemInitializerEJB,
> ejb-name=SystemInitializerEJB, container=Default Singleton Container)
>
> 2015-09-28 17:40:02,806 INFO   [TimerEJB] Initialize
> com.company.software.tomee.timer.TimerEJB@4d8818cd
> 2015-09-28 17:40:02,807 INFO   [TimerEJB] Initialize
> com.company.software.tomee.timer.TimerEJB@7e2715a4 Sep 28, 2015 5:40:02 PM
> org.quartz.impl.StdSchedulerFactory instantiate
> INFO: Using default implementation for ThreadExecutor
> Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> INFO: Using default implementation for ThreadExecutor
> Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
> INFO: Initialized Scheduler Signaller of type: class
> org.quartz.core.SchedulerSignalerImpl
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
> INFO: Quartz Scheduler v.2.2.0 created.
> Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
> INFO: RAMJobStore initialized.
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
> INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
> 'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
>   Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
>   NOT STARTED.
>   Currently in standby mode.
>   Number of jobs executed: 0
>   Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30 threads.
>   Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support
> persistence. and is not clustered.
>
> Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
> externally opened InputStream.
> Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> INFO: Quartz scheduler version: 2.2.0
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler start
> INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED started.
>
> 2015-09-28 17:40:02,847 INFO   [TimerEJB] scheduler MyClusteredScheduler2
> Sep 28, 2015 5:40:02 PM org.apache.openejb.assembler.classic.Assembler
> startEjbs
> INFO: Started Ejb(deployment-id=myTimerEJB, ejb-name=myTimerEJB,
> container=Default Singleton Container)
> Sep 28, 2015 5:40:02 PM org.quartz.core.SchedulerSignalerImpl <init>
> INFO: Initialized Scheduler Signaller of type: class
> org.quartz.core.SchedulerSignalerImpl
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler <init>
> INFO: Quartz Scheduler v.2.2.0 created.
> Sep 28, 2015 5:40:02 PM org.quartz.simpl.RAMJobStore initialize
> INFO: RAMJobStore initialized.
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler initialize
> INFO: Scheduler meta-data: Quartz Scheduler (v2.2.0)
> 'MyClusteredScheduler2' with instanceId 'NON_CLUSTERED'
>   Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
>   NOT STARTED.
>   Currently in standby mode.
>   Number of jobs executed: 0
>   Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 30 threads.
>   Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support
> persistence. and is not clustered.
>
> Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> INFO: Quartz scheduler 'MyClusteredScheduler2' initialized from an
> externally opened InputStream.
> Sep 28, 2015 5:40:02 PM org.quartz.impl.StdSchedulerFactory instantiate
> INFO: Quartz scheduler version: 2.2.0
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
> INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutting down.
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler standby
> INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED paused.
> Sep 28, 2015 5:40:02 PM org.quartz.core.QuartzScheduler shutdown
> INFO: Scheduler MyClusteredScheduler2_$_NON_CLUSTERED shutdown complete.
> Sep 28, 2015 5:40:02 PM
> org.apache.openejb.core.transaction.EjbTransactionUtil
> handleSystemException
> SEVERE: EjbTransactionUtil.handleSystemException: Scheduler with name
> 'MyClusteredScheduler2' already exists.
> org.quartz.SchedulerException: Scheduler with name 'MyClusteredScheduler2'
> already exists.
>     at
> org.quartz.impl.SchedulerRepository.bind(SchedulerRepository.java:80)
>     at
>
> org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1352)
>     at
>
> org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1517)
>     at
> com.company.software.tomee.timer.TimerEJB.initialize(TimerEJB.java:71)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$LifecycleInvocation.invoke(ReflectionInvocationContext.java:214)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
>     at
>
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:180)
>     at
>
> org.apache.openejb.monitoring.StatsInterceptor.PostConstruct(StatsInterceptor.java:108)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:606)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:182)
>     at
>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:164)
>     at
>
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:80)
>     at org.apache.openejb.BeanContext.newInstance(BeanContext.java:1565)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:175)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initializeDependencies(SingletonInstanceManager.java:166)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.createInstance(SingletonInstanceManager.java:173)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$100(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:116)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$1.call(SingletonInstanceManager.java:114)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.getInstance(SingletonInstanceManager.java:125)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.initialize(SingletonInstanceManager.java:91)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager.access$400(SingletonInstanceManager.java:67)
>     at
>
> org.apache.openejb.core.singleton.SingletonInstanceManager$Data.initialize(SingletonInstanceManager.java:367)
> (...)
>
> I can understand it seems to be like some dependency cycle, but I need to
> know why it does not happen all the time and how to avoid this sort of
> thing, because it really breaks the app.
>
> Any help is welcome. thanks
>
>
> []
>
> Leo
>