You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Theissen <pe...@web.de> on 2008/04/11 14:24:35 UTC

Scheduled DB clean up service with Struts2

Hello,

I now searched a while to get an idea how to implement
a DB clean up service with Struts2. The best link I found
was the following one:
following 
http://www.javabeat.net/javabeat/ejb3/articles/timer_services_api_in_ejb_3_0_2.php

What I dont understand is how to get the session context.
As described in the link Im using dependency injection:
 >>>
@Resource
Private SessionContext s;
<<<
but unfortunately that doesnt work. Eclipse says that it
doesnt know the @Resource annotation.
However, the ejb3-persistence.jar is integrated in the
libs. Therefore, the annotation should be well known
to Eclipse?

What I also dont understand that - even when I got that
stuff with that timer working -  "who" starts the bean the
first time? Do I have to reconfigure something?
What happens if I restart the server?

Another more general question is:
is that the most suitable way to implement the
DB clean up service, assuing that further services
wont be added in the future (otherwise: scheduler as
far from what I've read)?

Thanks and best regards
Peter




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Scheduled DB clean up service with Struts2

Posted by Brad A Cupit <br...@lsu.edu>.
the @Resource annotation is included in Java SE 6. If you can't move to
Java 6 and have to use Java 5, the annotation can be found in
common-annotations.jar

(note that a Java EE 5 app can still run in the Java SE 6 JRE)

as per the DB clean up service, if you're using Spring for DI you could
probably set up a quartz timer that Spring would manage for you. If
you're not using Spring you could probably implement a
ServletContextListener (configured in web.xml) to startup on application
startup and then use some type of timer in that class. None of it would
be specific to struts 2.

Brad Cupit
Louisiana State University - UIS

-----Original Message-----
From: peter.theissen@web.de [mailto:peter.theissen@web.de] 
Sent: Friday, April 11, 2008 7:25 AM
To: Struts Users Mailing List
Subject: Scheduled DB clean up service with Struts2

Hello,

I now searched a while to get an idea how to implement
a DB clean up service with Struts2. The best link I found
was the following one:
following 
http://www.javabeat.net/javabeat/ejb3/articles/timer_services_api_in_ejb
_3_0_2.php

What I dont understand is how to get the session context.
As described in the link Im using dependency injection:
 >>>
@Resource
Private SessionContext s;
<<<
but unfortunately that doesnt work. Eclipse says that it
doesnt know the @Resource annotation.
However, the ejb3-persistence.jar is integrated in the
libs. Therefore, the annotation should be well known
to Eclipse?

What I also dont understand that - even when I got that
stuff with that timer working -  "who" starts the bean the
first time? Do I have to reconfigure something?
What happens if I restart the server?

Another more general question is:
is that the most suitable way to implement the
DB clean up service, assuing that further services
wont be added in the future (otherwise: scheduler as
far from what I've read)?

Thanks and best regards
Peter




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Scheduled DB clean up service with Spring

Posted by Gabriel Belingueres <be...@gmail.com>.
INF/applicationContext.xml]: problem with class file or dependent
class; nested exception is java.lang.NoClassDefFoundError:
org/quartz/SimpleTrigger

You missed some quartz jar file.

2008/4/15, Peter Theissen <pe...@web.de>:
> Hi,
>
> back again with my problem. The root cause is:
> >>>
> SCHWERWIEGEND: Exception sending context initialized event to listener
> instance of class
> org.springframework.web.context.ContextLoaderListener
> org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'personService': Injection of persistence
> methods failed; nested exception is
> org.springframework.beans.factory.CannotLoadBeanClassException:
> Error loading class
> [org.springframework.scheduling.quartz.SimpleTriggerBean]
> for bean with name 'simpleTrigger' defined in ServletContext resource
> [/WEB-INF/applicationContext.xml]: problem with class file
> or dependent class; nested exception is java.lang.NoClassDefFoundError:
> org/quartz/SimpleTrigger
>   at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:323)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:966)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>   at java.security.AccessController.doPrivileged(Native
> Method)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>   at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
>   at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430)
>   at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
>   at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
>   at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
>   at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
>   at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>   at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
>   at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
>   at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>   at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
>   at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>   at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>   at
> org.apache.catalina.core.StandardService.start(StandardService.java:516)
>   at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>   at
> org.apache.catalina.startup.Catalina.start(Catalina.java:578)
>   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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>   at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> Caused by:
> org.springframework.beans.factory.CannotLoadBeanClassException:
> Error loading class
> [org.springframework.scheduling.quartz.SimpleTriggerBean]
> for bean with name 'simpleTrigger' defined in ServletContext resource
> [/WEB-INF/applicationContext.xml]: problem with class file
> or dependent class; nested exception is java.lang.NoClassDefFoundError:
> org/quartz/SimpleTrigger
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1140)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:514)
>   at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)
>   at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:304)
>   at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:298)
>   at
> org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:224)
>   at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:501)
>   at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:471)
>   at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:596)
>   at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:567)
>   at
> org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:193)
>   at
> org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:116)
>   at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:320)
>   ... 31 more
> Caused by: java.lang.NoClassDefFoundError: org/quartz/SimpleTrigger
>   at java.lang.ClassLoader.defineClass1(Native Method)
>   at java.lang.ClassLoader.defineClass(Unknown Source)
>   at java.security.SecureClassLoader.defineClass(Unknown
> Source)
>   at
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819)
>   at
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
>   at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327)
>   at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
>   at
> org.springframework.util.ClassUtils.forName(ClassUtils.java:230)
>   at
> org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:381)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1134)
>   ... 43 more
> Caused by: java.lang.ClassNotFoundException:
> org.quartz.SimpleTrigger
>   at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
>   at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
>   at java.lang.ClassLoader.loadClassInternal(Unknown
> Source)
>   ... 53 more
> <<<
>
> Best regards
> Peter
>
> > Peter Theissen wrote:
> >
> > > Hi,
> > >
> > > the quartz scheduler from Spring seemed to be a quite nice solution for
> > > my DB clean up service. Thanks for that hint.
> > > Now I have a quite curios problem. If I, e.g. create a bean in
> > > applicationContext.xml as follows:
> > >  >>>
> > >   <bean id="simpleTrigger"
> class="org.springframework.scheduling.quartz.SimpleTriggerBean">
> > >
> > >     <!-- props are first commented out, since they are not important for
> this issue
> > >     <property name="jobDetail" ref="jobInvokation"/>
> > >     <property name="repeatInterval" value="10000"/>
> > >      -->
> > >
> > >   </bean>
> > > <<<
> > > I get a
> org.springframework.beans.factory.BeanCreationException:
> > > nested exception is
> org.springframework.beans.factory.CannotLoadBeanClassException:
> > > Error loading class
> [org.springframework.scheduling.quartz.SimpleTriggerBean]
> > >
> > > But anyhow, if I import the class using:
> > > import
> org.springframework.scheduling.quartz.SimpleTriggerBean;
> > > in some POJO in the project everything is fine.
> > >
> > > What am I missing?
> > >
> >
> > The 'root cause' section of the stack trace? That should tell you why
> Spring can't instantiate the bean.
> >
> > L.
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Scheduled DB clean up service with Spring

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
The error message is pretty clear, you're missing some classes in your
classpath. The compile time classpath and runtime classpath is usually
not the same. Make sure that you have the required jar files in your
runtime classpath.

Nils-H

On Tue, Apr 15, 2008 at 12:04 PM, Peter Theissen <pe...@web.de> wrote:
> Hi,
>
>  back again with my problem. The root cause is:
>  >>>
>  SCHWERWIEGEND: Exception sending context initialized event to listener
> instance of class org.springframework.web.context.ContextLoaderListener
>  org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'personService': Injection of persistence methods failed;
> nested exception is
> org.springframework.beans.factory.CannotLoadBeanClassException: Error
> loading class [org.springframework.scheduling.quartz.SimpleTriggerBean] for
> bean with name 'simpleTrigger' defined in ServletContext resource
> [/WEB-INF/applicationContext.xml]: problem with class file or dependent
> class; nested exception is java.lang.NoClassDefFoundError:
> org/quartz/SimpleTrigger
>    at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:323)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:966)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>    at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>    at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>    at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>    at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
>    at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
>    at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430)
>    at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
>    at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
>    at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
>    at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
>    at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>    at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
>    at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
>    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
>    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>    at
> org.apache.catalina.core.StandardService.start(StandardService.java:516)
>    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
>    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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>  Caused by: org.springframework.beans.factory.CannotLoadBeanClassException:
> Error loading class
> [org.springframework.scheduling.quartz.SimpleTriggerBean] for bean with name
> 'simpleTrigger' defined in ServletContext resource
> [/WEB-INF/applicationContext.xml]: problem with class file or dependent
> class; nested exception is java.lang.NoClassDefFoundError:
> org/quartz/SimpleTrigger
>    at
> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1140)
>    at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:514)
>    at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)
>    at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:304)
>    at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:298)
>    at
> org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:224)
>    at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:501)
>    at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:471)
>    at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:596)
>    at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:567)
>    at
> org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:193)
>    at
> org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:116)
>    at
> org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:320)
>    ... 31 more
>  Caused by: java.lang.NoClassDefFoundError: org/quartz/SimpleTrigger
>    at java.lang.ClassLoader.defineClass1(Native Method)
>    at java.lang.ClassLoader.defineClass(Unknown Source)
>    at java.security.SecureClassLoader.defineClass(Unknown Source)
>    at
> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819)
>    at
> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
>    at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327)
>    at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
>    at org.springframework.util.ClassUtils.forName(ClassUtils.java:230)
>    at
> org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:381)
>    at
> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1134)
>    ... 43 more
>  Caused by: java.lang.ClassNotFoundException: org.quartz.SimpleTrigger
>    at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
>    at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
>    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>    ... 53 more
>  <<<
>
>  Best regards
>  Peter
>
>
>
>
> > Peter Theissen wrote:
> >
> > > Hi,
> > >
> > > the quartz scheduler from Spring seemed to be a quite nice solution for
> > > my DB clean up service. Thanks for that hint.
> > > Now I have a quite curios problem. If I, e.g. create a bean in
> > > applicationContext.xml as follows:
> > >  >>>
> > >   <bean id="simpleTrigger"
> class="org.springframework.scheduling.quartz.SimpleTriggerBean">
> > >
> > >     <!-- props are first commented out, since they are not important for
> this issue
> > >     <property name="jobDetail" ref="jobInvokation"/>
> > >     <property name="repeatInterval" value="10000"/>
> > >      -->
> > >
> > >   </bean>
> > > <<<
> > > I get a org.springframework.beans.factory.BeanCreationException:
> > > nested exception is
> org.springframework.beans.factory.CannotLoadBeanClassException:
> > > Error loading class
> [org.springframework.scheduling.quartz.SimpleTriggerBean]
> > >
> > > But anyhow, if I import the class using:
> > > import org.springframework.scheduling.quartz.SimpleTriggerBean;
> > > in some POJO in the project everything is fine.
> > >
> > > What am I missing?
> > >
> >
> > The 'root cause' section of the stack trace? That should tell you why
> Spring can't instantiate the bean.
> >
> > L.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Scheduled DB clean up service with Spring

Posted by Peter Theissen <pe...@web.de>.
Hi,

back again with my problem. The root cause is:
 >>>
SCHWERWIEGEND: Exception sending context initialized event to listener 
instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 'personService': Injection of persistence methods failed; 
nested exception is 
org.springframework.beans.factory.CannotLoadBeanClassException: Error 
loading class [org.springframework.scheduling.quartz.SimpleTriggerBean] 
for bean with name 'simpleTrigger' defined in ServletContext resource 
[/WEB-INF/applicationContext.xml]: problem with class file or dependent 
class; nested exception is java.lang.NoClassDefFoundError: 
org/quartz/SimpleTrigger
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:323)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:966)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
    at java.security.AccessController.doPrivileged(Native Method)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:430)
    at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
    at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
    at 
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
    at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
    at 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at 
org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: 
org.springframework.beans.factory.CannotLoadBeanClassException: Error 
loading class [org.springframework.scheduling.quartz.SimpleTriggerBean] 
for bean with name 'simpleTrigger' defined in ServletContext resource 
[/WEB-INF/applicationContext.xml]: problem with class file or dependent 
class; nested exception is java.lang.NoClassDefFoundError: 
org/quartz/SimpleTrigger
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1140)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:514)
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:304)
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:298)
    at 
org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:224)
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findDefaultEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:501)
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findEntityManagerFactory(PersistenceAnnotationBeanPostProcessor.java:471)
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveEntityManager(PersistenceAnnotationBeanPostProcessor.java:596)
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:567)
    at 
org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:193)
    at 
org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:116)
    at 
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:320)
    ... 31 more
Caused by: java.lang.NoClassDefFoundError: org/quartz/SimpleTrigger
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at 
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819)
    at 
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327)
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:230)
    at 
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:381)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1134)
    ... 43 more
Caused by: java.lang.ClassNotFoundException: org.quartz.SimpleTrigger
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 53 more
<<<

Best regards
Peter

> Peter Theissen wrote:
>> Hi,
>>
>> the quartz scheduler from Spring seemed to be a quite nice solution for
>> my DB clean up service. Thanks for that hint.
>> Now I have a quite curios problem. If I, e.g. create a bean in
>> applicationContext.xml as follows:
>>  >>>
>>    <bean id="simpleTrigger" 
>> class="org.springframework.scheduling.quartz.SimpleTriggerBean">
>>
>>      <!-- props are first commented out, since they are not important 
>> for this issue
>>      <property name="jobDetail" ref="jobInvokation"/>
>>      <property name="repeatInterval" value="10000"/>
>>       -->
>>
>>    </bean>
>> <<<
>> I get a org.springframework.beans.factory.BeanCreationException:
>> nested exception is 
>> org.springframework.beans.factory.CannotLoadBeanClassException:
>> Error loading class 
>> [org.springframework.scheduling.quartz.SimpleTriggerBean]
>>
>> But anyhow, if I import the class using:
>> import org.springframework.scheduling.quartz.SimpleTriggerBean;
>> in some POJO in the project everything is fine.
>>
>> What am I missing?
>
> The 'root cause' section of the stack trace? That should tell you why 
> Spring can't instantiate the bean.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Scheduled DB clean up service with Spring

Posted by Laurie Harper <la...@holoweb.net>.
Peter Theissen wrote:
> Hi,
> 
> the quartz scheduler from Spring seemed to be a quite nice solution for
> my DB clean up service. Thanks for that hint.
> Now I have a quite curios problem. If I, e.g. create a bean in
> applicationContext.xml as follows:
>  >>>
>    <bean id="simpleTrigger" 
> class="org.springframework.scheduling.quartz.SimpleTriggerBean">
> 
>      <!-- props are first commented out, since they are not important 
> for this issue
>      <property name="jobDetail" ref="jobInvokation"/>
>      <property name="repeatInterval" value="10000"/>
>       -->
> 
>    </bean>
> <<<
> I get a org.springframework.beans.factory.BeanCreationException:
> nested exception is 
> org.springframework.beans.factory.CannotLoadBeanClassException:
> Error loading class 
> [org.springframework.scheduling.quartz.SimpleTriggerBean]
> 
> But anyhow, if I import the class using:
> import org.springframework.scheduling.quartz.SimpleTriggerBean;
> in some POJO in the project everything is fine.
> 
> What am I missing?

The 'root cause' section of the stack trace? That should tell you why 
Spring can't instantiate the bean.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] Scheduled DB clean up service with Spring

Posted by Peter Theissen <pe...@web.de>.
Hi,

the quartz scheduler from Spring seemed to be a quite nice solution for
my DB clean up service. Thanks for that hint.
Now I have a quite curios problem. If I, e.g. create a bean in
applicationContext.xml as follows:
 >>>
    <bean id="simpleTrigger" 
class="org.springframework.scheduling.quartz.SimpleTriggerBean">

      <!-- props are first commented out, since they are not important 
for this issue
      <property name="jobDetail" ref="jobInvokation"/>
      <property name="repeatInterval" value="10000"/>
       -->

    </bean>
<<<
I get a org.springframework.beans.factory.BeanCreationException:
nested exception is 
org.springframework.beans.factory.CannotLoadBeanClassException:
Error loading class 
[org.springframework.scheduling.quartz.SimpleTriggerBean]

But anyhow, if I import the class using:
import org.springframework.scheduling.quartz.SimpleTriggerBean;
in some POJO in the project everything is fine.

What am I missing?

Thanks and best regards
Peter




> I've been doing periodic tasks in my web app: I'm using Spring and
> setting a periodic task to execute is kind of straightforward, but has
> nothing to do with Struts 2.
>
> 2008/4/11, Peter Theissen <pe...@web.de>:
>   
>> Hello,
>>
>> I now searched a while to get an idea how to implement
>> a DB clean up service with Struts2. The best link I found
>> was the following one:
>> following
>> http://www.javabeat.net/javabeat/ejb3/articles/timer_services_api_in_ejb_3_0_2.php
>>
>> What I dont understand is how to get the session context.
>> As described in the link Im using dependency injection:
>>     
>> @Resource
>> Private SessionContext s;
>> <<<
>> but unfortunately that doesnt work. Eclipse says that it
>> doesnt know the @Resource annotation.
>> However, the ejb3-persistence.jar is integrated in the
>> libs. Therefore, the annotation should be well known
>> to Eclipse?
>>
>> What I also dont understand that - even when I got that
>> stuff with that timer working -  "who" starts the bean the
>> first time? Do I have to reconfigure something?
>> What happens if I restart the server?
>>
>> Another more general question is:
>> is that the most suitable way to implement the
>> DB clean up service, assuing that further services
>> wont be added in the future (otherwise: scheduler as
>> far from what I've read)?
>>
>> Thanks and best regards
>> Peter
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Scheduled DB clean up service with Struts2

Posted by Gabriel Belingueres <be...@gmail.com>.
I've been doing periodic tasks in my web app: I'm using Spring and
setting a periodic task to execute is kind of straightforward, but has
nothing to do with Struts 2.

2008/4/11, Peter Theissen <pe...@web.de>:
> Hello,
>
> I now searched a while to get an idea how to implement
> a DB clean up service with Struts2. The best link I found
> was the following one:
> following
> http://www.javabeat.net/javabeat/ejb3/articles/timer_services_api_in_ejb_3_0_2.php
>
> What I dont understand is how to get the session context.
> As described in the link Im using dependency injection:
> >>>
> @Resource
> Private SessionContext s;
> <<<
> but unfortunately that doesnt work. Eclipse says that it
> doesnt know the @Resource annotation.
> However, the ejb3-persistence.jar is integrated in the
> libs. Therefore, the annotation should be well known
> to Eclipse?
>
> What I also dont understand that - even when I got that
> stuff with that timer working -  "who" starts the bean the
> first time? Do I have to reconfigure something?
> What happens if I restart the server?
>
> Another more general question is:
> is that the most suitable way to implement the
> DB clean up service, assuing that further services
> wont be added in the future (otherwise: scheduler as
> far from what I've read)?
>
> Thanks and best regards
> Peter
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Scheduled DB clean up service with Struts2

Posted by Frank Fischer <fr...@digitalnomads.ch>.
> I doubt that this filter/interceptor approach to executing a task
> periodically would be a good idea:
> 
> What if it is take too long? What happens to the current user request?
> What if it just time out?

Agree, you're right (btw, i meant context listener when i wrote filter -
sorry). 

But still it depends on the job that has to be done and about the database
design. Think about a clean up job that takes quite a while and the main web
service needs to be suspended meanwhile. Then a Servlet Context Listener
could start the db maintenance while an intercepter could catch ever request
and send back a 503 during that maintenance window. But of course the main
job would then be done from the context listener (or any pojo service that
was injected using spring i.e.).

- Frank

> 
> Typical periodic clean up tasks are better performed when nobody is
> using the system (or at least when the quantity of concurrent users in
> the system be at the absolute minimum), but since this is executed
> when somebody makes a request to the web app, there is no warranty
> that this task be executed at all.
> 
> 2008/4/11, Frank Fischer <fr...@digitalnomads.ch>:
> >
> > I would have thought of implementing the clean up service 
> as servlet filter
> > outside struts. Or doing the same within an interceptor.
> >
> > Are there any dependencies that would need the clean up 
> service to be bound
> > to a session context?
> >
> > - Frank
> >
> >
> > > -----Original Message-----
> > > From: peter.theissen@web.de [mailto:peter.theissen@web.de]
> > > Sent: Friday, April 11, 2008 2:25 PM
> > > To: Struts Users Mailing List
> > > Subject: Scheduled DB clean up service with Struts2
> > >
> > > Hello,
> > >
> > > I now searched a while to get an idea how to implement
> > > a DB clean up service with Struts2. The best link I found
> > > was the following one:
> > > following
> > > http://www.javabeat.net/javabeat/ejb3/articles/timer_services_
> > > api_in_ejb_3_0_2.php
> > >
> > > What I dont understand is how to get the session context.
> > > As described in the link Im using dependency injection:
> > >  >>>
> > > @Resource
> > > Private SessionContext s;
> > > <<<
> > > but unfortunately that doesnt work. Eclipse says that it
> > > doesnt know the @Resource annotation.
> > > However, the ejb3-persistence.jar is integrated in the
> > > libs. Therefore, the annotation should be well known
> > > to Eclipse?
> > >
> > > What I also dont understand that - even when I got that
> > > stuff with that timer working -  "who" starts the bean the
> > > first time? Do I have to reconfigure something?
> > > What happens if I restart the server?
> > >
> > > Another more general question is:
> > > is that the most suitable way to implement the
> > > DB clean up service, assuing that further services
> > > wont be added in the future (otherwise: scheduler as
> > > far from what I've read)?
> > >
> > > Thanks and best regards
> > > Peter
> > >
> > >
> > >
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Scheduled DB clean up service with Struts2

Posted by Gabriel Belingueres <be...@gmail.com>.
I doubt that this filter/interceptor approach to executing a task
periodically would be a good idea:

What if it is take too long? What happens to the current user request?
What if it just time out?

Typical periodic clean up tasks are better performed when nobody is
using the system (or at least when the quantity of concurrent users in
the system be at the absolute minimum), but since this is executed
when somebody makes a request to the web app, there is no warranty
that this task be executed at all.

2008/4/11, Frank Fischer <fr...@digitalnomads.ch>:
>
> I would have thought of implementing the clean up service as servlet filter
> outside struts. Or doing the same within an interceptor.
>
> Are there any dependencies that would need the clean up service to be bound
> to a session context?
>
> - Frank
>
>
> > -----Original Message-----
> > From: peter.theissen@web.de [mailto:peter.theissen@web.de]
> > Sent: Friday, April 11, 2008 2:25 PM
> > To: Struts Users Mailing List
> > Subject: Scheduled DB clean up service with Struts2
> >
> > Hello,
> >
> > I now searched a while to get an idea how to implement
> > a DB clean up service with Struts2. The best link I found
> > was the following one:
> > following
> > http://www.javabeat.net/javabeat/ejb3/articles/timer_services_
> > api_in_ejb_3_0_2.php
> >
> > What I dont understand is how to get the session context.
> > As described in the link Im using dependency injection:
> >  >>>
> > @Resource
> > Private SessionContext s;
> > <<<
> > but unfortunately that doesnt work. Eclipse says that it
> > doesnt know the @Resource annotation.
> > However, the ejb3-persistence.jar is integrated in the
> > libs. Therefore, the annotation should be well known
> > to Eclipse?
> >
> > What I also dont understand that - even when I got that
> > stuff with that timer working -  "who" starts the bean the
> > first time? Do I have to reconfigure something?
> > What happens if I restart the server?
> >
> > Another more general question is:
> > is that the most suitable way to implement the
> > DB clean up service, assuing that further services
> > wont be added in the future (otherwise: scheduler as
> > far from what I've read)?
> >
> > Thanks and best regards
> > Peter
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Scheduled DB clean up service with Struts2

Posted by Gabriel Belingueres <be...@gmail.com>.
Then I guess it would be a good excercice to refactor that database
access code into a DAO to decouple your actions from the DB.

2008/4/11, Peter Theissen <pe...@web.de>:
> No, no dependencies at all. It should just do
> the cleanup every day.
> However, I would like to use my certain action
> methods, since they already contain all the
> funtionalities for DB acces.
>
> Thanks
> Peter
>
>
> > I would have thought of implementing the clean up service as servlet
> filter
> > outside struts. Or doing the same within an interceptor.
> >
> > Are there any dependencies that would need the clean up service to be
> bound
> > to a session context?
> > - Frank
> >
> >
> >
> > > -----Original Message-----
> > > From: peter.theissen@web.de [mailto:peter.theissen@web.de] Sent: Friday,
> April 11, 2008 2:25 PM
> > > To: Struts Users Mailing List
> > > Subject: Scheduled DB clean up service with Struts2
> > >
> > > Hello,
> > >
> > > I now searched a while to get an idea how to implement
> > > a DB clean up service with Struts2. The best link I found
> > > was the following one:
> > > following
> http://www.javabeat.net/javabeat/ejb3/articles/timer_services_
> > > api_in_ejb_3_0_2.php
> > >
> > > What I dont understand is how to get the session context.
> > > As described in the link Im using dependency injection:
> > >  >>>
> > > @Resource
> > > Private SessionContext s;
> > > <<<
> > > but unfortunately that doesnt work. Eclipse says that it
> > > doesnt know the @Resource annotation.
> > > However, the ejb3-persistence.jar is integrated in the
> > > libs. Therefore, the annotation should be well known
> > > to Eclipse?
> > >
> > > What I also dont understand that - even when I got that
> > > stuff with that timer working -  "who" starts the bean the
> > > first time? Do I have to reconfigure something?
> > > What happens if I restart the server?
> > >
> > > Another more general question is:
> > > is that the most suitable way to implement the
> > > DB clean up service, assuing that further services
> > > wont be added in the future (otherwise: scheduler as
> > > far from what I've read)?
> > >
> > > Thanks and best regards
> > > Peter
> > >
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> > >
> > >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Scheduled DB clean up service with Struts2

Posted by Frank Fischer <fr...@digitalnomads.ch>.
Sorry, of course i meant servlet context listener, not servlet filter.... 

> However, I would like to use my certain action
> methods, since they already contain all the
> funtionalities for DB acces.

Then i guess it would be a smart way by letting spring inject the DBA object
into your action(s) and the clean up service as well. 

- Frank



> 
> Thanks
> Peter
> 
> > I would have thought of implementing the clean up service 
> as servlet filter
> > outside struts. Or doing the same within an interceptor.
> >
> > Are there any dependencies that would need the clean up 
> service to be bound
> > to a session context? 
> >
> > - Frank
> >  
> >
> >   
> >> -----Original Message-----
> >> From: peter.theissen@web.de [mailto:peter.theissen@web.de] 
> >> Sent: Friday, April 11, 2008 2:25 PM
> >> To: Struts Users Mailing List
> >> Subject: Scheduled DB clean up service with Struts2
> >>
> >> Hello,
> >>
> >> I now searched a while to get an idea how to implement
> >> a DB clean up service with Struts2. The best link I found
> >> was the following one:
> >> following 
> >> http://www.javabeat.net/javabeat/ejb3/articles/timer_services_
> >> api_in_ejb_3_0_2.php
> >>
> >> What I dont understand is how to get the session context.
> >> As described in the link Im using dependency injection:
> >>  >>>
> >> @Resource
> >> Private SessionContext s;
> >> <<<
> >> but unfortunately that doesnt work. Eclipse says that it
> >> doesnt know the @Resource annotation.
> >> However, the ejb3-persistence.jar is integrated in the
> >> libs. Therefore, the annotation should be well known
> >> to Eclipse?
> >>
> >> What I also dont understand that - even when I got that
> >> stuff with that timer working -  "who" starts the bean the
> >> first time? Do I have to reconfigure something?
> >> What happens if I restart the server?
> >>
> >> Another more general question is:
> >> is that the most suitable way to implement the
> >> DB clean up service, assuing that further services
> >> wont be added in the future (otherwise: scheduler as
> >> far from what I've read)?
> >>
> >> Thanks and best regards
> >> Peter
> >>
> >>
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >>     
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Scheduled DB clean up service with Struts2

Posted by Peter Theissen <pe...@web.de>.
No, no dependencies at all. It should just do
the cleanup every day.
However, I would like to use my certain action
methods, since they already contain all the
funtionalities for DB acces.

Thanks
Peter

> I would have thought of implementing the clean up service as servlet filter
> outside struts. Or doing the same within an interceptor.
>
> Are there any dependencies that would need the clean up service to be bound
> to a session context? 
>
> - Frank
>  
>
>   
>> -----Original Message-----
>> From: peter.theissen@web.de [mailto:peter.theissen@web.de] 
>> Sent: Friday, April 11, 2008 2:25 PM
>> To: Struts Users Mailing List
>> Subject: Scheduled DB clean up service with Struts2
>>
>> Hello,
>>
>> I now searched a while to get an idea how to implement
>> a DB clean up service with Struts2. The best link I found
>> was the following one:
>> following 
>> http://www.javabeat.net/javabeat/ejb3/articles/timer_services_
>> api_in_ejb_3_0_2.php
>>
>> What I dont understand is how to get the session context.
>> As described in the link Im using dependency injection:
>>  >>>
>> @Resource
>> Private SessionContext s;
>> <<<
>> but unfortunately that doesnt work. Eclipse says that it
>> doesnt know the @Resource annotation.
>> However, the ejb3-persistence.jar is integrated in the
>> libs. Therefore, the annotation should be well known
>> to Eclipse?
>>
>> What I also dont understand that - even when I got that
>> stuff with that timer working -  "who" starts the bean the
>> first time? Do I have to reconfigure something?
>> What happens if I restart the server?
>>
>> Another more general question is:
>> is that the most suitable way to implement the
>> DB clean up service, assuing that further services
>> wont be added in the future (otherwise: scheduler as
>> far from what I've read)?
>>
>> Thanks and best regards
>> Peter
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Scheduled DB clean up service with Struts2

Posted by Frank Fischer <fr...@digitalnomads.ch>.
I would have thought of implementing the clean up service as servlet filter
outside struts. Or doing the same within an interceptor.

Are there any dependencies that would need the clean up service to be bound
to a session context? 

- Frank
 

> -----Original Message-----
> From: peter.theissen@web.de [mailto:peter.theissen@web.de] 
> Sent: Friday, April 11, 2008 2:25 PM
> To: Struts Users Mailing List
> Subject: Scheduled DB clean up service with Struts2
> 
> Hello,
> 
> I now searched a while to get an idea how to implement
> a DB clean up service with Struts2. The best link I found
> was the following one:
> following 
> http://www.javabeat.net/javabeat/ejb3/articles/timer_services_
> api_in_ejb_3_0_2.php
> 
> What I dont understand is how to get the session context.
> As described in the link Im using dependency injection:
>  >>>
> @Resource
> Private SessionContext s;
> <<<
> but unfortunately that doesnt work. Eclipse says that it
> doesnt know the @Resource annotation.
> However, the ejb3-persistence.jar is integrated in the
> libs. Therefore, the annotation should be well known
> to Eclipse?
> 
> What I also dont understand that - even when I got that
> stuff with that timer working -  "who" starts the bean the
> first time? Do I have to reconfigure something?
> What happens if I restart the server?
> 
> Another more general question is:
> is that the most suitable way to implement the
> DB clean up service, assuing that further services
> wont be added in the future (otherwise: scheduler as
> far from what I've read)?
> 
> Thanks and best regards
> Peter
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org