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

C# Discussion :

Débutant, perdu avec erreur Spring


Sujet :

C#

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    10
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 10
    Points : 6
    Points
    6
    Par défaut Débutant, perdu avec erreur Spring
    Bonjour,

    Je débute en C#... Avec le tutoriel de Serge Tahé que j'ai trouvé sur ce site.

    J'arrive à la fin du chapitre 4, sur l'architecture 3 couches. J'ai réalisé les différents TP et celui où je dois intégrer la couche Spring me pose problème.

    Je cale dessus depuis deux semaines, donc j'en viens à vous pour m'aider... J'ai intégré Spring dans mon programme. Dès que je lance celui-ci, il s'arrête, et j'ai droit à un message dans la Console, ce message fait presque 200 lignes... Donc autant dire que je ne peux le recopier, il le définit au début comme étant une "unhandled Exception". Auriez-vous une idée ?

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bon pour avoir un truc plus sympa tu peux mettre la partie du code que tu penses être à l'origine du problème.
    Dans le catch t'affiche le message d'erreur renvoyée.

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    10
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 10
    Points : 6
    Points
    6
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    IApplicationContext ctx = null;
    try
    {
    ctx = ContextRegistry.GetContext();
    }
    catch (ImpotException e1)
    {...}
    Voici mon code.
    Lors de l'arrêt du programme, il signale l'erreur à la ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ctx = ContextRegistry.GetContext();
    J'ai réussi à copier l'erreur signalée dans la Console :

    Edit : Il ne copie pas tous les caractères...

    Unhandled Exception: System.Configuration.ConfigurationErrorsException
    eating context 'spring.root': The element 'objects' in namespace 'http
    ingframework.net' has invalid child element 'objects' in namespace 'ht
    pringframework.net'. List of possible elements expected: 'import, alia
    in namespace 'http://www.springframework.net' as well as any element
    ce '##other'. ---> Spring.Objects.Factory.ObjectDefinitionStoreExcepti
    in XML document from config [C:\Documents and Settings\secrétaire\mes
    \visual studio 2010\Projects\ImpotV5\ui\bin\Debug\ui.exe.Config#spring
    violates the schema. The element 'objects' in namespace 'http://www.s
    work.net' has invalid child element 'objects' in namespace 'http://www
    mework.net'. List of possible elements expected: 'import, alias, objec
    space 'http://www.springframework.net' as well as any element in names
    her'. ---> System.Xml.Schema.XmlSchemaValidationException: The element
    in namespace 'http://www.springframework.net' has invalid child eleme
    s' in namespace 'http://www.springframework.net'. List of possible ele
    cted: 'import, alias, object' in namespace 'http://www.springframework
    ell as any element in namespace '##other'.
    at Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.HandleValid
    ct sender, ValidationEventArgs args)
    at System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(Validat
    ndler eventHandler, Object sender, XmlSchemaValidationException e, Xml
    pe severity)
    at System.Xml.Schema.XmlSchemaValidator.ElementValidationError(XmlQ
    me name, ValidationState context, ValidationEventHandler eventHandler,
    nder, String sourceUri, Int32 lineNo, Int32 linePos, XmlSchemaSet sche
    at System.Xml.Schema.XmlSchemaValidator.ValidateElementContext(XmlQ
    me elementName, Boolean& invalidElementInContext)
    at System.Xml.Schema.XmlSchemaValidator.ValidateElement(String loca
    ing namespaceUri, XmlSchemaInfo schemaInfo, String xsiType, String xsi
    g xsiSchemaLocation, String xsiNoNamespaceSchemaLocation)
    at System.Xml.XsdValidatingReader.ProcessElementEvent()
    at System.Xml.XsdValidatingReader.ProcessReaderEvent()
    at System.Xml.XsdValidatingReader.Read()
    at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
    at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
    at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boo
    rveWhitespace)
    at System.Xml.XmlDocument.Load(XmlReader reader)
    at Spring.Util.ConfigXmlDocument.Load(XmlReader reader)
    at Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.DoLoadObjec
    ns(Stream stream, IResource resource)
    --- End of inner exception stack trace ---
    at Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.DoLoadObjec
    ns(Stream stream, IResource resource)
    at Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.LoadObjectD
    (IResource resource)
    at Spring.Objects.Factory.Support.AbstractObjectDefinitionReader.Lo
    finitions(String location)
    at Spring.Objects.Factory.Support.AbstractObjectDefinitionReader.Lo
    finitions(String[] locations)
    at Spring.Context.Support.AbstractXmlApplicationContext.LoadObjectD
    (XmlObjectDefinitionReader objectDefinitionReader)
    at Spring.Context.Support.AbstractXmlApplicationContext.LoadObjectD
    (DefaultListableObjectFactory objectFactory)
    at Spring.Context.Support.AbstractXmlApplicationContext.RefreshObje
    )
    at Spring.Context.Support.AbstractApplicationContext.Refresh()
    at _dynamic_Spring.Context.Support.XmlApplicationContext..ctor(Obje
    at Spring.Reflection.Dynamic.SafeConstructor.Invoke(Object[] argume
    at Spring.Context.Support.ContextHandler.RootContextInstantiator.In
    tConstructor(ConstructorInfo ctor)
    at Spring.Context.Support.ContextHandler.ContextInstantiator.Instan
    xt()
    at Spring.Context.Support.ContextHandler.InstantiateContext(IApplic
    xt parentContext, Object configContext, String contextName, Type conte
    olean caseSensitive, String[] resources)
    at Spring.Context.Support.ContextHandler.Create(Object parent, Obje
    ontext, XmlNode section)
    --- End of inner exception stack trace ---
    at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[
    ctionInput input, Boolean isTrusted, FactoryRecord factoryRecord, Sect
    sectionRecord, Object parentResult)
    at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRec
    yRecord, SectionRecord sectionRecord, Object parentResult, Boolean get
    an getRuntimeObject, Object& result, Object& resultRuntimeObject)
    at System.Configuration.BaseConfigurationRecord.GetSectionRecursive
    nfigKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeOb
    ean requestIsHere, Object& result, Object& resultRuntimeObject)
    at System.Configuration.BaseConfigurationRecord.GetSectionRecursive
    nfigKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeOb
    ean requestIsHere, Object& result, Object& resultRuntimeObject)
    at System.Configuration.BaseConfigurationRecord.GetSectionRecursive
    nfigKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeOb
    ean requestIsHere, Object& result, Object& resultRuntimeObject)
    at System.Configuration.BaseConfigurationRecord.GetSection(String c
    at System.Configuration.ClientConfigurationSystem.System.Configurat
    al.IInternalConfigSystem.GetSection(String sectionName)
    at System.Configuration.ConfigurationManager.GetSection(String sect
    at Spring.Util.ConfigurationUtils.GetSection(String sectionName)
    at Spring.Context.Support.ContextRegistry.InitializeContextIfNeeded
    at Spring.Context.Support.ContextRegistry.GetContext()
    at Impotv5.ui.Dialogue2.Main() in C:\Documents and Settings\secréta
    cuments\visual studio 2010\Projects\ImpotV5\ui\ui\Dialogue2.cs:line 23

  4. #4
    Expert éminent
    Avatar de StormimOn
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2005
    Messages
    2 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 593
    Points : 7 660
    Points
    7 660
    Par défaut
    Tu pourrais monter le contenu de ton app.config ? Car le problème vient de là.

    Vu l'erreur tu as du faire quelque chose comme
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <objects>
        <objects>
        ...
        </objects>
    </objects>
    au lieu de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <objects>
        <object>
        ...
        </object>
    </objects>

  5. #5
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    10
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 10
    Points : 6
    Points
    6
    Par défaut
    Merci, en effet, il y avait déjà ce problème.
    Ensuite, j'ai maintenant d'autres erreurs... Lorsque dans Visual Studio 10 je lance le programme via F5 (debugging), une ConfigurationErrorException se pose.

    Il me fait alors référence toujours à cette ligne dans mon code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ctx = ContextRegistry.GetContext();
    Et me dit ceci :

    Error creating context 'spring.root': Could not load type 'dao.FileImpot' from assembly 'dao, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
    J'ai des références vers mon fichier App.config où il me dit (à chaque fois, en me référençant au lignes de ce fichier).

    Could note find schema information for the element spring
    Could note find schema information for the element context
    Could note find schema information for the element resource
    Could note find schema information for the attribute uri
    Could note find schema information for the element 'http://www.springframework.net:objects'.
    Could note find schema information for the element spring
    Merci de m'aider.

  6. #6
    Expert éminent
    Avatar de StormimOn
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2005
    Messages
    2 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 593
    Points : 7 660
    Points
    7 660
    Par défaut
    Tu pourrais montrer ton app.config, ainsi que tes fichiers de configuration pour spring ?

  7. #7
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    10
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 10
    Points : 6
    Points
    6
    Par défaut
    Voici mon fichier App.config

    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
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
     
      <configSections>
        <sectionGroup name="spring">
          <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
          <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
        </sectionGroup>
      </configSections>
     
      <spring>
     
        <context>
          <resource uri="config://spring/objects" />
        </context>
     
        <objects xmlns="http://www.springframework.net">
     
          <object name="dao" type="dao.FileImpot, dao">
            <constructor-arg index="0" value="DataImpotinexist.txt"/>
          </object>
     
          <object name="metier" type="metier.ImpotMetier, metier">
            <constructor-arg index="0" ref="dao"/>
          </object>
     
        </objects>
     
      </spring>
      </configuration>

  8. #8
    Expert éminent
    Avatar de StormimOn
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2005
    Messages
    2 593
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2005
    Messages : 2 593
    Points : 7 660
    Points
    7 660
    Par défaut
    Le nom de la classe est bien FileImpot ?
    La classe FileImpot est bien dans le namespace dao ?
    La classe est publique ?
    L'assembly qui contient la classe FileImpot c'est bien dao.dll ?

    Vu l'erreur une de ces affirmations devrait être fausse.

  9. #9
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    10
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 10
    Points : 6
    Points
    6
    Par défaut
    J'ai pu remarque que dans les propriétés de mes projets, mon "target Framework" était ".NET Framework 4 client profile."

    Je l'ai donc modifié en .NET Framework 3.5 comme dans le tutoriel. Depuis, j'ai ces erreurs qui s'affichent dans output :

    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Documents and Settings\secrétaire\mes documents\visual studio 2010\Projects\ImpotV5\ui\bin\Debug\ui.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    The thread 'vshost.LoadReference' (0xe60) has exited with code 0 (0x0).
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Documents and Settings\secrétaire\mes documents\visual studio 2010\Projects\ImpotV5\ui\bin\Debug\ui.exe', Symbols loaded.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Documents and Settings\secrétaire\mes documents\visual studio 2010\Projects\ImpotV5\ui\bin\Debug\Spring.Core.dll'
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Documents and Settings\secrétaire\mes documents\visual studio 2010\Projects\ImpotV5\ui\bin\Debug\dao.dll', Symbols loaded.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Documents and Settings\secrétaire\mes documents\visual studio 2010\Projects\ImpotV5\ui\bin\Debug\metier.dll', Symbols loaded.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Documents and Settings\secrétaire\mes documents\visual studio 2010\Projects\ImpotV5\ui\bin\Debug\Common.Logging.dll'
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    Unable to read configuration section common/logging. Using no-op implemenation.
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'Spring.DynamicReflection'
    'ui.vshost.exe' (Managed (v2.0.50727)): Loaded 'Spring.DynamicReflection'
    A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
    The program '[4000] ui.vshost.exe: Managed (v2.0.50727)' has exited with code -1073741510 (0xc000013a).
    Pas facile, le C# !!!

Discussions similaires

  1. [débutant] Formulaire avec Spring
    Par cyberface dans le forum Spring Web
    Réponses: 5
    Dernier message: 25/05/2009, 00h10
  2. Réponses: 1
    Dernier message: 25/05/2009, 00h01
  3. Modifier le nom d'une base de donnée avec erreur sy
    Par mmn dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 25/11/2003, 10h12
  4. [débutant] Problèmes avec CRegKey
    Par Pedro dans le forum MFC
    Réponses: 4
    Dernier message: 10/11/2003, 15h28
  5. [Débutant] Lenteur avec TComPort
    Par PhDt76 dans le forum C++Builder
    Réponses: 22
    Dernier message: 27/09/2003, 21h43

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