1 Reply Latest reply on Nov 8, 2007 11:44 AM by Michael Yuan

    @Startup & identity problem

    Stateless Bean Novice

      I try to use quartz in my app, so far my scheduler works fine, but I want to start job scheduling after jboss startup, and here is problem.
      When jboss starts identity is not initialized, and I get error.

      Here is my scheduler class:



      and stack trace


      11:38:43,375 INFO [Contexts] starting up: org.jboss.seam.async.dispatcher
      11:38:43,375 INFO [QuartzDispatcher] No seam.quartz.properties file. Use in-memory job store.
      11:38:43,375 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
      11:38:43,375 INFO [QuartzDispatcher] The QuartzDispatcher has started
      11:38:43,375 INFO [Contexts] starting up: schedulerController
      11:38:43,968 INFO [QuartzDispatcher] In the scheduleInvocation()
      11:38:43,968 INFO [QuartzDispatcher] In the scheduleWithQuartzService()
      11:38:43,984 INFO [STDOUT] TIME: 16 ms.
      11:38:43,984 INFO [Contexts] starting up: org.jboss.seam.captcha.captchaImage
      11:38:44,000 INFO [QuartzDispatcher] Start executing Quartz job
      11:38:44,625 ERROR [JobRunShell] Job DEFAULT.3ead17fb:1161ed68190:-7fa1 threw an unhandled Exception:
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.identity
      at org.jboss.seam.Component.newInstance(Component.java:1971)
      at org.jboss.seam.Component.getInstance(Component.java:1874)
      at org.jboss.seam.Component.getInstance(Component.java:1841)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
      at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2196)
      at org.jboss.seam.Component.getValueToInject(Component.java:2135)
      at org.jboss.seam.Component.injectAttributes(Component.java:1599)
      at org.jboss.seam.Component.inject(Component.java:1417)
      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
      at org.jboss.seam.util.Work.workInTransaction(Work.java:39)
      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:42)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
      at pl.netinfo.mlm.business.scheduler.SchedulerProcessor_$$_javassist_1.scheduleInterval(SchedulerProcessor_$$_javassist_1.java)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52)
      at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
      at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
      at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:305)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      Caused by: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel'
      at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:138)
      at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:114)
      at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:87)
      at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2083)
      at org.jboss.seam.Component.callCreateMethod(Component.java:2006)
      at org.jboss.seam.Component.newInstance(Component.java:1977)
      at org.jboss.seam.Component.getInstance(Component.java:1874)
      at org.jboss.seam.Component.getInstance(Component.java:1841)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
      at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
      at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
      at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
      at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
      at org.jboss.seam.Component$ELInitialValue.getValue(Component.java:2361)
      at org.jboss.seam.Component.initialize(Component.java:1390)
      at org.jboss.seam.Component.instantiateJavaBean(Component.java:1316)
      at org.jboss.seam.Component.instantiate(Component.java:1269)
      at org.jboss.seam.Component.newInstance(Component.java:1967)
      ... 37 more
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:132)
      ... 64 more
      11:38:44,625 ERROR [ErrorLogger] Job (DEFAULT.3ead17fb:1161ed68190:-7fa1 threw an exception.
      org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.identity]
      at org.quartz.core.JobRunShell.run(JobRunShell.java:214)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      * Nested Exception (Underlying Cause) ---------------
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.identity
      at org.jboss.seam.Component.newInstance(Component.java:1971)
      at org.jboss.seam.Component.getInstance(Component.java:1874)
      at org.jboss.seam.Component.getInstance(Component.java:1841)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
      at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2196)
      at org.jboss.seam.Component.getValueToInject(Component.java:2135)
      at org.jboss.seam.Component.injectAttributes(Component.java:1599)
      at org.jboss.seam.Component.inject(Component.java:1417)
      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
      at org.jboss.seam.util.Work.workInTransaction(Work.java:39)
      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:42)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
      at pl.netinfo.mlm.business.scheduler.SchedulerProcessor_$$_javassist_1.scheduleInterval(SchedulerProcessor_$$_javassist_1.java)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52)
      at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
      at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
      at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:305)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      Caused by: org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel'
      at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:138)
      at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:114)
      at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:87)
      at org.jboss.seam.drools.RuleBase.compileRuleBase(RuleBase.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
      at org.jboss.seam.Component.callComponentMethod(Component.java:2083)
      at org.jboss.seam.Component.callCreateMethod(Component.java:2006)
      at org.jboss.seam.Component.newInstance(Component.java:1977)
      at org.jboss.seam.Component.getInstance(Component.java:1874)
      at org.jboss.seam.Component.getInstance(Component.java:1841)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
      at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
      at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
      at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
      at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
      at org.jboss.seam.Component$ELInitialValue.getValue(Component.java:2361)
      at org.jboss.seam.Component.initialize(Component.java:1390)
      at org.jboss.seam.Component.instantiateJavaBean(Component.java:1316)
      at org.jboss.seam.Component.instantiate(Component.java:1269)
      at org.jboss.seam.Component.newInstance(Component.java:1967)
      ... 37 more
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:132)
      ... 64 more
      11:38:45,375 INFO [Contexts] starting up: org.jboss.seam.remoting.remoting
      11:38:45,375 INFO [Contexts] starting up: org.jboss.seam.ui.graphicImage.graphicImageResource
      11:38:45,375 INFO [Contexts] starting up: org.jboss.seam.ui.resource.styleResource
      11:38:45,375 INFO [Contexts] starting up: org.jboss.seam.ui.resource.webResource
      11:38:45,390 INFO [Initialization] done initializing Seam
      11:38:45,390 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.loggingFilter
      11:38:45,390 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.ajax4jsfFilter
      11:38:45,468 INFO [CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      11:38:45,468 INFO [LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {facelets.DEVELOPMENT=true, org.ajax4jsf.VIEW_HANDLERS=com.sun.facelets.FaceletViewHandler, com.sun.faces.injectionProvider=org.jboss.web.jsf.integration.injection.JBossInjectionProvider, javax.faces.DEFAULT_SUFFIX=.xhtml}
      11:38:45,468 INFO [LRUMapCacheFactory] Creating LRUMap cache instance of default capacity
      11:38:45,515 INFO [CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      11:38:45,515 INFO [LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {facelets.DEVELOPMENT=true, org.ajax4jsf.VIEW_HANDLERS=com.sun.facelets.FaceletViewHandler, com.sun.faces.injectionProvider=org.jboss.web.jsf.integration.injection.JBossInjectionProvider, javax.faces.DEFAULT_SUFFIX=.xhtml}
      11:38:45,515 INFO [LRUMapCacheFactory] Creating LRUMap cache instance of default capacity
      11:38:45,515 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.contextFilter
      11:38:45,515 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.redirectFilter
      11:38:45,515 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.exceptionFilter
      11:38:45,515 INFO [SeamFilter] Initializing filter: org.jboss.seam.web.multipartFilter
      11:38:45,562 INFO [EARDeployer] Started J2EE application: file:/C:/Grzesiek/jboss-4.2.1.GA/server/default/deploy/mlm.ear
      11:38:45,718 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8080
      11:38:45,734 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
      11:38:45,765 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 46s:922ms
      11:38:48,984 INFO [QuartzDispatcher] Start executing Quartz job
      11:38:49,000 WARN [RuleBasedIdentity] no security rule base available - please install a RuleBase with the name 'securityRules' if permission checks are required.
      11:38:49,093 INFO [STDOUT] ok false
      11:38:49,171 INFO [QuartzDispatcher] End executing Quartz job



      @Startup
      @Scope(ScopeType.APPLICATION)
      @Name("schedulerController")
      public class SchedulerController extends AppEngine {
       private static final long serialVersionUID = -6910765412328021446L;
      
       @In
       SchedulerProcessor processor;
      
       @Logger Log log;
      
       @Create
      @Observer("org.jboss.seam.postInitialize")
       public void startInterval() {
       try {
       long a = System.currentTimeMillis();
       //=================================================
       //Payment payment = getInstance();
       Payment payment = new Payment();
       payment.setPaymentDate (new Date ());
       QuartzTriggerHandle handle = processor.scheduleInterval(payment.getPaymentDate(),
       5 * 1000l,
       null,
       payment);
      
       payment.setQuartzTriggerHandle(handle);
       //em.persist(payment);
       //=================================================
       long b = System.currentTimeMillis();
       System.out.println("TIME: " + (b - a) + " ms.");
       }
       catch (Exception e) {
       log.error("schedulerController - startInterval: " + e.getMessage());
       }
       }
      
      


      I do not use security-rules, but it's declared in components.xml.

      What should I do, to start my job after jboss start, without this error.