IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Java EE Discussion :

[Strategie] Déclenchement en J2EE


Sujet :

Java EE

  1. #1
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut [Strategie] Déclenchement en J2EE
    Bonjour,

    Je suis sur une plateforme J2EE avec des EJB et j'ai une petite question , il s'agit d'une vente d'articles avec une date limite et je voulais donc mettre en place un déclencheur qui tournerait sur le serveur pour vérifier si la date est atteinte et donc déclencher la fin de lavente de l'article.

    Existe-til des bibliotheques permettant cela?

    Merci


    [Modéré par Didier] : ajout de tag dans le titre - Les règles du forum Java

  2. #2
    Membre éprouvé
    Avatar de yolepro
    Profil pro
    Architecte de système d'information
    Inscrit en
    Mai 2002
    Messages
    918
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations professionnelles :
    Activité : Architecte de système d'information

    Informations forums :
    Inscription : Mai 2002
    Messages : 918
    Points : 1 144
    Points
    1 144
    Par défaut
    Tu peux utiliser un scheduler, mais fait attention à respecter les normes J2EE (pas de requete direct d'un thread sur une base).

    Je te conseille QUARTZ qui est très simple et évolué (tu peux utiliser des les formats cron).

    http://www.opensymphony.com/quartz/
    Etre c'est etre relatif.

  3. #3
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut
    Merci ,

    C'est exactement ce qu'il me faut et je suis aller regarder un exemple mais leur exemple fonctionne avec une servlet , moi j'aimerais que cela demarre avec le déploiement de jboss aurais-tu de la doc ou un exemple pour ce type de fonctionnement?

    Merci

  4. #4
    Membre éprouvé
    Avatar de yolepro
    Profil pro
    Architecte de système d'information
    Inscrit en
    Mai 2002
    Messages
    918
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations professionnelles :
    Activité : Architecte de système d'information

    Informations forums :
    Inscription : Mai 2002
    Messages : 918
    Points : 1 144
    Points
    1 144
    Par défaut
    Tu peux forcer le déclenchement d'une servlet au démarage de ton appli. Il suffit de rajouter une methode init dans la servlet et d'ajouter une parametre start-on-load dans ton fichier web.xml
    Etre c'est etre relatif.

  5. #5
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut
    Bjr,

    L'unique moyen est de passer ar une servlet ou il y a un auter moyen?

  6. #6
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut
    Apparemment pas d'auters moyens , j'ai donc implémenter cette méthode mais j'ai un petit souci , j'ai suivi le tutorial qui se trouve à cette adresse :http://www.theserverside.com/blogs/s...chedulerInJ2EE

    J'ai donc un nouveau projet (un pour le serveur et un pour le client qui est donc un webProject) j'ai mis ma servlet sur le projet client et lorsuqe je déploie jboss j'ai l'erreur suivante :


    17:07:03,142 WARN [ServiceController] Problem starting service jboss.web.deployment:war=Client.war,id=-4147840
    org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: ejb-ref: ejb/CreateArticle, no ejb-link in web.xml and no jndi-name in jboss-web.xml)
    at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:366)
    at org.jboss.web.WebModule.startModule(WebModule.java:68)
    at org.jboss.web.WebModule.startService(WebModule.java:46)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
    at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceController.java:428)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
    at $Proxy43.start(Unknown Source)
    at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:400)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
    at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
    at $Proxy44.start(Unknown Source)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
    at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
    at $Proxy9.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)
    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:265)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
    at $Proxy0.start(Unknown Source)
    at org.jboss.system.ServiceController.start(ServiceController.java:428)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
    at $Proxy4.start(Unknown Source)
    at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
    at $Proxy5.deploy(Unknown Source)
    at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
    at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
    at org.jboss.Main.boot(Main.java:187)
    at org.jboss.Main$1.run(Main.java:438)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.naming.NamingException: ejb-ref: ejb/CreateArticle, no ejb-link in web.xml and no jndi-name in jboss-web.xml
    at org.jboss.web.AbstractWebDeployer.linkEjbRefs(AbstractWebDeployer.java:668)
    at org.jboss.web.AbstractWebDeployer.parseWebAppDescriptors(AbstractWebDeployer.java:499)
    at org.jboss.web.AbstractWebDeployer$DescriptorParser.parseWebAppDescriptors(AbstractWebDeployer.java:851)
    at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:141)
    at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:88)
    at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:357)
    ... 109 more
    D'ou vient cette erreur?

  7. #7
    Membre éprouvé
    Profil pro
    Développeur Back-End
    Inscrit en
    Avril 2003
    Messages
    782
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Back-End

    Informations forums :
    Inscription : Avril 2003
    Messages : 782
    Points : 935
    Points
    935
    Par défaut
    Citation Envoyé par c+cool
    Apparemment pas d'auters moyens , j'ai donc implémenter cette méthode mais j'ai un petit souci , j'ai suivi le tutorial qui se trouve à cette adresse :http://www.theserverside.com/blogs/s...chedulerInJ2EE

    J'ai donc un nouveau projet (un pour le serveur et un pour le client qui est donc un webProject) j'ai mis ma servlet sur le projet client et lorsuqe je déploie jboss j'ai l'erreur suivante :


    17:07:03,142 WARN [ServiceController] Problem starting service jboss.web.deployment:war=Client.war,id=-4147840
    org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: ejb-ref: ejb/CreateArticle, no ejb-link in web.xml and no jndi-name in jboss-web.xml)
    il te faut définir dans le web.xml un lien vers ton ejb :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    The Servlet accesses the TestEJB so we need to create the ejb-ref entry in the web.xml as follows:
     
    <ejb-ref>
    <ejb-ref-name>ejb/TestEJB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>howto.quartz.ejb.TestEJBHome</home>
    <remote>howto.quartz.ejb.TestEJB</remote>
    </ejb-ref>

  8. #8
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut
    bjr,

    J'ai effectivement défini le lien ... peut-etre pas de la bonne maniere
    faut-il mettre ejb/MonEjb ou bien MonEjb tout cours ou encore comp/env/ejb/MonEjb

  9. #9
    Membre éprouvé
    Profil pro
    Développeur Back-End
    Inscrit en
    Avril 2003
    Messages
    782
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Back-End

    Informations forums :
    Inscription : Avril 2003
    Messages : 782
    Points : 935
    Points
    935
    Par défaut
    d'après le message de l'erreur, je mettrais : ejb/CreateArticle

  10. #10
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut
    c'est ce que j'ai mis et c'est l'erreur qu'il m'a alors sorti ...

  11. #11
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut
    Aussi une auter question, le fichier quartz-service.xml doit-il figurer quelque part ? at-il une importance?

    Merci

  12. #12
    Membre confirmé

    Inscrit en
    Avril 2005
    Messages
    317
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 317
    Points : 553
    Points
    553
    Par défaut
    J'ai l'impression que tu utilises JBOSS
    Tu peux donc utiliser le scheduler de Jboss

  13. #13
    Membre du Club

    Inscrit en
    Avril 2005
    Messages
    246
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 246
    Points : 57
    Points
    57
    Par défaut
    scheduler de Jboss
    c'est à dire?

  14. #14
    Membre confirmé

    Inscrit en
    Avril 2005
    Messages
    317
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 317
    Points : 553
    Points
    553
    Par défaut
    Jboss integre un planificateur de tache qui te permet d'appeler des classes
    -> http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch10.html#ch10.sched.sect

Discussions similaires

  1. Réponses: 67
    Dernier message: 16/12/2007, 13h41
  2. [Stratégie] Comment on met un démon dans une appli j2ee ?
    Par nico2280 dans le forum API standards et tierces
    Réponses: 4
    Dernier message: 23/11/2005, 17h11
  3. Déclenchement Programme sur Virtual Key
    Par Tom-G dans le forum API, COM et SDKs
    Réponses: 9
    Dernier message: 09/05/2003, 12h58
  4. Gros problème avec JB8 et appli J2EE
    Par patbier dans le forum JBuilder
    Réponses: 10
    Dernier message: 07/03/2003, 10h52
  5. [Strategie][Java][XML] Import dans une base de données
    Par nad dans le forum XML/XSL et SOAP
    Réponses: 2
    Dernier message: 23/09/2002, 11h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo