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

Struts 1 Java Discussion :

No action instance for path could be created


Sujet :

Struts 1 Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut No action instance for path could be created
    bonjour
    je suis entrain de faire un programme en java/ struts pour afficher une table dans la base de donnée oracle 9:

    il me donne cette erreur :
    type Rapport d'état
    message No action instance for path /Appli could be created
    description Le serveur a rencontré une erreur interne (No action instance for path /Appli could be created) qui l'a empêché de satisfaire la requête.
    voici code source de appli : merci de votre service et ton aide, je suis bloqué;

    voici fichier strut-config.xml :

    Code xml : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC 
    "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" 
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
     
    <data-sources>
    <data-source key = "xxxStruts2" type="org.apache.commons.dbcp.BasicDataSource">
    <set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <set-property property="url" value="jdbc:oracle:thin:@xxxx:basedonee" />
    <set-property property="username" value="*****" />
    <set-property property="password" value="******" />
    <set-property property="minCount" value="3" />
    <set-property property="validationQuery" value="select 1 from dual" />
    </data-source>
    </data-sources> 
    <form-beans>
    <form-bean name="ApplicationListAction" type="action.ApplicationListAction">
    </form-bean>
    </form-beans> 
    <action-mappings type="org.apache.struts.action.ActionMapping">
    <action path="/Appli" type="action.ApplicationListAction" 
    name="applicationListAction" scope="request" input="/applicationListe.jsp">
    <forward name="success" path="/ApplicationListe.jsp" redirect="false" />
    </action>
    </action-mappings>
    </struts-config>
    voici le controleur :
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    package action;
    import model.Application;
     
    import java.io.IOException;
    import javax.servlet.ServletContext;
     
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
     
     
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.actions.DispatchAction;
     
    import javax.sql.DataSource;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
     
    import java.util.ArrayList;
     
     
    public class ApplicationListAction extends Action {
     
     
        private ArrayList getApplications () {
        Application application=null;
        ArrayList applications = new ArrayList();
        Connection conn =null;
        Statement stmt =null;
        ResultSet rs=null;
        ServletContext context=servlet.getServletContext();
     
        DataSource dataSource = (DataSource)
        context.getAttribute(Action.DATA_SOURCE_KEY);
        try {
     
            conn = dataSource.getConnection();
            stmt = conn.createStatement();
            rs =
              stmt.executeQuery("select * from ARIANE.applications  " );
     
            while ( rs.next() ) {
     
                application = new Application();
     
                application.setNom(rs.getString("nom"));
                application.setEnvDeveloppement(rs.getString("envDeveloppement"));
                application.setEnvRecette(rs.getString("envRecette"));
                application.setEnvProduction(rs.getString("envProduction"));
                applications.add(application);
     
              }
     
    }
     
        catch (SQLException e) {
     
            System.err.println(e.getMessage());
          }
        finally {
     
            if (rs != null) {
     
              try {
     
                rs.close();
              }
              catch (SQLException sqle) {
     
                System.err.println(sqle.getMessage());
              }
              rs = null;
            }
            if (stmt != null) {
     
              try {
     
                stmt.close();
              }
              catch (SQLException sqle) {
     
                System.err.println(sqle.getMessage());
              }
              stmt = null;
            }
            if (conn != null) {
     
              try {
     
                conn.close();
              }
              catch (SQLException sqle) {
     
                System.err.println(sqle.getMessage());
              }
              conn = null;
            }
          }
        return applications;
     
    }
     
         public ActionForward execute(ActionMapping mapping,
                    ActionForm form,
                    HttpServletRequest request,
                    HttpServletResponse response)  throws IOException, ServletException
     
                    {
     
                 ArrayList applications = null;
     
                applications = getApplications();
                request.setAttribute("applications", applications);
     
                return mapping.findForward("success");
                    }
     
     
         }
    et voici le package model :
    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
    31
    32
    public class Application {
    private String nom;
    private String envDeveloppement;
    private String envRecette;
    private String envProduction;
     
    public String getEnvDeveloppement() {
    return envDeveloppement;
    }
    public void setEnvDeveloppement(String envDeveloppement) {
    this.envDeveloppement = envDeveloppement;
    }
    public String getEnvProduction() {
    return envProduction;
    }
    public void setEnvProduction(String envProduction) {
    this.envProduction = envProduction;
    }
    public String getEnvRecette() {
    return envRecette;
    }
    public void setEnvRecette(String envRecette) {
    this.envRecette = envRecette;
    }
    public String getNom() {
    return nom;
    }
    public void setNom(String nom) {
    this.nom = nom;
    }
     
    }
    et le fichier index.jsp est :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <html>
    <head>
    <title>Ariane</title>
    <link rel="stylesheet" href="/css/styles.css" type="text/css">
    </head>
    <c:redirect url="http://localhost:8080/Application/Appli.do"/>
    </html>
    merci pour ton aide

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    230
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 230
    Points : 310
    Points
    310
    Par défaut
    Bonjour,

    J'avoue ne pas avoir tout regardé mais déjà :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <form-bean name="ApplicationListAction" type="action.ApplicationListAction">
    me semble poser un problème puisque tu devrais déclarer un formulaire et non pas une action.

    Ensuite,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <action path="/Appli" type="action.ApplicationListAction" 
    name="applicationListAction" scope="request" input="/applicationListe.jsp">
    Name ça devrait être le nom de ton formulaire défini plus haut en faisant attention à la casse (là tu mets un 'a' et plus haut un 'A').

  3. #3
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    Citation Envoyé par Benouze
    Bonjour,

    J'avoue ne pas avoir tout regardé mais déjà :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <form-bean name="ApplicationListAction" type="action.ApplicationListAction">
    me semble poser un problème puisque tu devrais déclarer un formulaire et non pas une action.

    Ensuite,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <action path="/Appli" type="action.ApplicationListAction" 
    name="applicationListAction" scope="request" input="/applicationListe.jsp">
    Name ça devrait être le nom de ton formulaire défini plus haut en faisant attention à la casse (là tu mets un 'a' et plus haut un 'A').




    merci pour ton aide,
    en fait, toujours la meme erreur : message No action instance for path /Appli could be created


    merci de m'eclaircir ou il ya erreur

    merci

  4. #4
    Membre habitué
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    123
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France, Côte d'Or (Bourgogne)

    Informations forums :
    Inscription : Avril 2007
    Messages : 123
    Points : 129
    Points
    129
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <form-bean name="ApplicationListAction" type="action.ApplicationListAction">
    cette balise doit contenir une classe java qui extends ActionForm (ou tout autre dérivé) qui définie le formulaire que tu es sensé avoir dans une de tes pages jsp (sinon il ne faut pas utilisé de form-bean)

  5. #5
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    merci pour ton aide, en fait j'ai fait la modification dans struts-config :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <action-mappings type="org.apache.struts.action.ActionMapping">
      <action path="/Appli" type="action.ApplicationListAction" 
               name="appliForm" scope="request" input="/applicationListe.jsp">
          <forward name="success" path="/ApplicationListe.jsp" redirect="false" />
      </action>
     </action-mappings>
    mais toujours il y a meme erreur

    merci de votre aide

  6. #6
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    peut etre probleme de connection à la base de donnée:
    est-ce que cette instruction est correcte merci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    DataSource dataSource = (DataSource)
    context.getAttribute(Action.DATA_SOURCE_KEY);
    merci de votre aide

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    230
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 230
    Points : 310
    Points
    310
    Par défaut
    Re,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <action path="/Appli" type="action.ApplicationListAction" 
    name="appliForm" scope="request" input="/applicationListe.jsp">
    <forward name="success" path="/ApplicationListe.jsp" redirect="false" />
    </action>
    Attention, encore une erreur de casse :
    input="/applicationListe.jsp"
    path="/ApplicationListe.jsp"

    Ensuite, comme tu écris :
    name="appliForm"
    cela signifie bien que tu as plus haut déclaré ce formulaire avec une ligne style :
    <form-bean name="appliForm" type="l_emplacement_de_la_classe_correspondante">

    ???

  8. #8
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    Citation Envoyé par Benouze
    Re,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <action path="/Appli" type="action.ApplicationListAction" 
    name="appliForm" scope="request" input="/applicationListe.jsp">
    <forward name="success" path="/ApplicationListe.jsp" redirect="false" />
    </action>
    Attention, encore une erreur de casse :
    input="/applicationListe.jsp"
    path="/ApplicationListe.jsp"

    Ensuite, comme tu écris :
    name="appliForm"
    cela signifie bien que tu as plus haut déclaré ce formulaire avec une ligne style :
    <form-bean name="appliForm" type="l_emplacement_de_la_classe_correspondante">

    ???

    merci pour ton aide

    toujours meme message d'erreur

    merci de votre aide

  9. #9
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Tu ne sembles pas utiliser d'ActionForm donc le mapping de ton Action doit être simplement comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <action path="/Appli" type="action.ApplicationListAction">
       <forward name="success" path="/ApplicationListe.jsp" />
    </action>
    Modératrice Java - Struts, Servlets/JSP, ...

  10. #10
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    Citation Envoyé par c_nvy
    Tu ne sembles pas utiliser d'ActionForm donc le mapping de ton Action doit être simplement comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <action path="/Appli" type="action.ApplicationListAction">
       <forward name="success" path="/ApplicationListe.jsp" />
    </action>

    merci pour ton aide,
    en fait, toujours la meme erreur
    merci de votre aide?

    est ce que vous avez une autre solution
    merci

  11. #11
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Montre-nous le struts-config.xml après modification.
    Modératrice Java - Struts, Servlets/JSP, ...

  12. #12
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    Citation Envoyé par c_nvy
    Montre-nous le struts-config.xml après modification.

    merci de ton aide

    en fait voici fichier strut-confg

    Code xml : 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
    31
    32
    33
    34
    35
    36
    37
    38
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC 
              "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" 
              "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
     
     
    <data-sources>
     
            <data-source key = "arianeStruts2" type="org.apache.commons.dbcp.BasicDataSource">
                <set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
                <set-property property="url" value="jdbc:oracle:thin:@dv1ora01:1111:basededonnee" />
                <set-property property="username" value="bd" />
                <set-property property="password" value="bd" />
                <set-property property="minCount" value="2" />
                <set-property property="validationQuery" value="select 1 from dual" />
            </data-source>
     
      </data-sources> 
     
      <form-beans>
      <form-bean name="appliForm" type="form.AppliForm">
      </form-bean>
      </form-beans>  
     
        <action-mappings type="org.apache.struts.action.ActionMapping" >
     
          <forward name="success" path="/applicationListe.jsp" redirect="false" />
      </action>
     </action-mappings>
     
     <!-- ========== Controller Configuration ================================ -->
        <controller/>
     
     
     
     
    </struts-config>
    merci de ton aide

  13. #13
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Tu as codé ceci :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
          <forward name="success" path="/applicationListe.jsp" redirect="false" />
      </action>
    au lieu de ceci :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <action path="/Appli" type="action.ApplicationListAction">
       <forward name="success" path="/ApplicationListe.jsp" />
    </action>
    normal qu'il ne trouve pas l'Action de path /Appli.

    De plus, tu as oublié une balise de fin à la balise form-bean :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
      <form-bean name="appliForm" type="form.AppliForm"/>
    mais comme tu n'utilises pas de form-bean dans ton Action pour le moment, tu peux enlever cette ligne.
    Modératrice Java - Struts, Servlets/JSP, ...

  14. #14
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    bonjour, je suis debutant en programmation , en fait, depuis 3 jours , je suis toujours à la recherche d'une solution de mon probleme: petit appli de struts, voici
    type Rapport d'état

    message No action instance for path /Appli could be created

    description Le serveur a rencontré une erreur interne (No action instance for path /Appli could be created) qui l'a empêché de satisfaire la requête.
    merci de votre aide

  15. #15
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    As-tu corrigé le struts-config.xml comme je te l'ai indiqué plus haut ?
    Modératrice Java - Struts, Servlets/JSP, ...

  16. #16
    Nouveau membre du Club
    Inscrit en
    Janvier 2007
    Messages
    126
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 126
    Points : 37
    Points
    37
    Par défaut
    oui j'ai fait toutes vos propositions

    merci de votre coopearation

Discussions similaires

  1. Réponses: 6
    Dernier message: 11/01/2011, 18h29
  2. Réponses: 2
    Dernier message: 29/01/2008, 11h34
  3. [WPF] Could not create an instance of type
    Par Doug_ dans le forum Windows Presentation Foundation
    Réponses: 3
    Dernier message: 10/09/2007, 09h04
  4. No action instance for path /action could be created
    Par gentil dans le forum Struts 1
    Réponses: 20
    Dernier message: 10/04/2007, 13h54
  5. Erreur : "could not create process"
    Par spéculteur dans le forum C++
    Réponses: 3
    Dernier message: 29/03/2005, 11h31

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