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

Spring Java Discussion :

Spring AOP et AspectJ [Framework]


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    91
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 91
    Par défaut Spring AOP et AspectJ
    Salut!
    Je commence avec Spring et j'essaie d'implémenter Spring AOP avec AspectJ.
    J'ai eu un (bon) exemple quand à "la" démarche à suivre ici. J'ai essayer de faire autant avec des classes perso mais j'ai un souci : une exception est levée lors de la lecture du fichier xml, exactement sur la ligne de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <aop:aspectj-autoproxy/>
    .
    L'exception se présente ainsi :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 29; schema_reference.4 : Echec de la lecture du document de schéma 'http://www.springframework.org/schema/aop/spring-aop-2.5.xsd/spring-spring-aop-2.5.xsd-2.0.8.xsd' pour les raisons suivantes : 1) Le document est introuvable ; 2) Le document n'a pas pu être lu ; 3) L'élément racine du document n'est pas <xsd:schema>.
    A vrai dire, je n'y comprends pas grand chose, surtout que je suis encore novice en Java.
    Quelqu'un pourrait m'aider à résoudre ce (petit) problème ?

  2. #2
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd/spring-spring-aop-2.5.xsd-2.0.8.xsd

    -> cette adresse m'a l'air d'un beau meltingpot

    Le schema pour aop (spring 3.x) est

    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

    cf point C.2.7 ici http://static.springsource.org/sprin...sd-config.html

  3. #3
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    91
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 91
    Par défaut
    En fait, j'utilise un fichier jar de Spring 2.5.
    Je crée le fichier xml à partir de NetBeans et les lignes d'en-tête du fichiers sont écrites automatiquement :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:aop="http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"
           xmlns:context="http://www.springframework.org/schema/context/spring-context-2.5.xsd"
           xmlns:lang="http://www.springframework.org/schema/lang/spring-lang-2.5.xsd"
           xmlns:util="http://www.springframework.org/schema/util/spring-util-2.5.xsd"
           xmlns:p="http://www.springframework.org/schema/p"
     
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
              http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/aop/spring-aop-2.5.xsd/spring-spring-aop-2.5.xsd-2.0.8.xsd
              http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/context/spring-context-2.5.xsd/spring-spring-context-2.5.xsd-2.0.8.xsd
              http://www.springframework.org/schema/lang/spring-lang-2.5.xsd http://www.springframework.org/schema/lang/spring-lang-2.5.xsd/spring-spring-lang-2.5.xsd-2.0.8.xsd
              http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/util/spring-util-2.5.xsd/spring-spring-util-2.5.xsd-2.0.8.xsd
    ">

  4. #4
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Section A.2.5

    http://static.springsource.org/sprin...sd-config.html

    A mon avis, ton netbeans il a mis du gros caca comme xsd :s

  5. #5
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    91
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 91
    Par défaut
    Même quand j'enlève les dans le "xsi:schemaLocation", l'appli fonctionne normalement sans le "<aop:aspectj-autoproxy/>" mais fonctionne mal avec.

  6. #6
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    91
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 91
    Par défaut
    tchize_, j'ai respecté la syntaxe décrite dans le lien que tu as donné. C'est vrai que NetBeans à fait n'importe quoi. J'ai donc modifié l'en-tête et j'obtiens ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:lang="http://www.springframework.org/schema/lang"
           xmlns:util="http://www.springframework.org/schema/util"
           xmlns:p="http://www.springframework.org/schema/p"
     
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
              http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
              http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
    ">
    .
    Du coup, plus d'erreur au niveau de l'autoproxy.
    Mais l'exception s'est déplacée : "le proxy ne peut être 'casté' en la classe dont j'ai besoin". Cette exception est levée dès que j'essaie d'accéder au bean de la classe sur laquelle porte mes pointcut.
    Je n'y comprends que dalle et je ne trouve pas l'origine de cette exception.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Framework] Spring AOP et AspectJ
    Par gh_rachid dans le forum Spring
    Réponses: 3
    Dernier message: 30/05/2014, 10h59
  2. Réponses: 36
    Dernier message: 21/03/2011, 16h54
  3. [Framework] Choisir entre Spring AOP ou le support AspectJ
    Par damien77 dans le forum Spring
    Réponses: 0
    Dernier message: 19/07/2009, 12h08
  4. [Framework] Spring AOP avec @AspectJ
    Par zooba dans le forum Spring
    Réponses: 1
    Dernier message: 27/03/2008, 17h06
  5. [Framework] Spring AOP et AspectJ
    Par Ganymede dans le forum Spring
    Réponses: 2
    Dernier message: 10/03/2008, 21h09

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