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 <[email protected]> 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 <[email protected]>: > > > 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. < > > [email protected]> wrote: > > > > > My apologies, I did not see that behavior. > > > > > > On Mon, Sep 28, 2015 at 4:15 PM, Howard W. Smith, Jr. < > > > [email protected]> wrote: > > > > > > > > > > > > > > > On Mon, Sep 28, 2015 at 3:55 PM, Romain Manni-Bucau < > > > [email protected] > > > > > 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 > > > > > >
