Erreur connection base de donnee netbeans

dalidali86 Messages postés 28 Date d'inscription mardi 14 juillet 2009 Statut Membre Dernière intervention 4 février 2010 - 11 août 2009 à 10:05
dalidali86 Messages postés 28 Date d'inscription mardi 14 juillet 2009 Statut Membre Dernière intervention 4 février 2010 - 13 août 2009 à 11:09
Bonjour ,
j'ai développé un code java qui permet l'insertion des donnees dans une base de données MySQL , la connection est déja établie .
Mais je trouve l'erreur

cannot find symbol
symbol method get userDATAPROVIDOR ()
location :class client.page1


ou user est le nom du table de la base de donnees et client est le nom du package .


Quelqu'un a une idee ?

2 réponses

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
11 août 2009 à 10:10
Salut,

Vu l'erreur (et vu que tu nous montre pas ton code... pratique pour savoir d'où ca vient !) je dirais que c'est un problème de nomenclature : soit un nom mal tapé, soit des majuscules/minuscules pour l'appel à la fonction getuserDATAPROVIDOR() non respectées dans ta classe page1 du package client.
______________________________________
DarK Sidious
0
dalidali86 Messages postés 28 Date d'inscription mardi 14 juillet 2009 Statut Membre Dernière intervention 4 février 2010
13 août 2009 à 11:09
Bonjour ,
j'ai dépassé cet erreur mais malheureusement j'ai tombé dans une autre qui est la suivante :

firstname:javax.el.Exception:javax.faces.el.PropertyNotFoundException:
PropertyNotFoundException:javaxLang.RuntimeException
java.sql.SQLException:jdbcRowSetXlmpl(connectJNDI)Unable to connect:
Access denied for use 'root'@'localhost'(using password:YES)


En realite j'ai suivi un exemple fournie avec netbeans (vehicle incident reprt application ) dans lequel on n' a pas entré aucun mot de passe .

Le code java de la pge est le suivant :



/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package client; 

import com.sun.data.provider.RowKey;
import com.sun.data.provider.impl.CachedRowSetDataProvider;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.Form;
import com.sun.webui.jsf.component.PasswordField;
import com.sun.webui.jsf.component.RadioButtonGroup;
import com.sun.webui.jsf.component.TextField;
import com.sun.webui.jsf.model.SingleSelectOptionsList;
import javax.faces.FacesException;
import javax.faces.validator.LengthValidator;

/**
 * Page bean that corresponds to a similarly named JSP page.  This
 * class contains component definitions (and initialization code) for
 * all components that you have defined on this page, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.


 *
 * @version profile.java
 * @version Created on 10 août 2009, 08:43:30
 * @author DALI
 */

public class profile extends AbstractPageBean {
    // <editor-fold defaultstate= "collapsed" desc="Managed Component Definition">

    /**
     * Automatically managed component initialization.   WARNING: 
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.


     */
    private void _init() throws Exception {
        sexeDefaultOptions.setOptions(new com.sun.webui.jsf.model.Option[]{new com.sun.webui.jsf.model.Option("Homme", "Homme"), new com.sun.webui.jsf.model.Option("Femme", "Femme")});
        userDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.userRowSet}"));
        passwordlengthValidator2.setMaximum(10);
        passwordlengthValidator2.setMinimum(6);
    }
    private SingleSelectOptionsList sexeDefaultOptions  = new SingleSelectOptionsList();

    public SingleSelectOptionsList getSexeDefaultOptions() {
        return sexeDefaultOptions;
    }

    public void setSexeDefaultOptions(SingleSelectOptionsList ssol) {
        this.sexeDefaultOptions =  ssol;
    }
    private LengthValidator passwordlengthValidator = new LengthValidator();

    public LengthValidator getPasswordlengthValidator() {
        return passwordlengthValidator;
    }

    public void setPasswordlengthValidator(LengthValidator lv) {
        this.passwordlengthValidator = lv;
    }
    private CachedRowSetDataProvider userDataProvider = new CachedRowSetDataProvider();

    public CachedRowSetDataProvider getuserDataProvider() {
        return userDataProvider;
    }

    public void setuserDataProvider(CachedRowSetDataProvider crsdp) {
        this.userDataProvider = crsdp;
    }
    private Form form1 = new Form();

    public Form getForm1() {
        return form1;
    }

    public void setForm1(Form f) {
        this.form1 = f;
    }
    private TextField firstname = new TextField();

    public TextField getFirstname() {
        return firstname;
    }

    public void setFirstname(TextField tf) {
        this.firstname = tf;
    }
    private TextField lastname = new TextField();

    public TextField getLastname() {
        return lastname;
    }

    public void setLastname(TextField tf) {
        this.lastname = tf;
    }
    private RadioButtonGroup sexe = new RadioButtonGroup();

    public RadioButtonGroup getSexe() {
        return sexe;
    }

    public void setSexe(RadioButtonGroup rbg) {
        this.sexe = rbg;
    }
    private PasswordField currentpassword = new PasswordField();

    public PasswordField getPassword() {
        return currentpassword;
    }

    public void setcurrentpassword(PasswordField pf) {
        this.currentpassword = pf;
    }
    private PasswordField newpassword = new PasswordField();

    public PasswordField getNewpassword() {
        return newpassword;
    }

    public void setNewpassword(PasswordField pf) {
        this.newpassword = pf;
    }
    private PasswordField retypenewpassword = new PasswordField();

    public PasswordField getRetypenewpassword() {
        return retypenewpassword;
    }

    public void setRetypenewpassword(PasswordField pf) {
        this.retypenewpassword = pf;
    }
    private TextField mobilephone = new TextField();

    public TextField getMobilephone() {
        return mobilephone;
    }

    public void setMobilephone(TextField tf) {
        this.mobilephone = tf;
    }
    private TextField company = new TextField();

    public TextField getCompany() {
        return company;
    }

    public void setCompany(TextField tf) {
        this.company = tf;
    }
    private TextField department = new TextField();

    public TextField getDepartment() {
        return department;
    }

    public void setDepartment(TextField tf) {
        this.department = tf;
    }
    private TextField title = new TextField();

    public TextField getTitle() {
        return title;
    }

    public void setTitle(TextField tf) {
        this.title = tf;
    }
    private TextField cams = new TextField();

    public TextField getCams() {
        return cams;
    }

    public void setCams(TextField tf) {
        this.cams = tf;
    }
    private TextField interests = new TextField();

    public TextField getInterests() {
        return interests;
    }

    public void setInterests(TextField tf) {
        this.interests = tf;
    }
    private TextField login = new TextField();

    public TextField getLogin() {
        return login;
    }

    public void setLogin(TextField tf) {
        this.login = tf;
    }
    private LengthValidator passwordlengthValidator2 = new LengthValidator();

    public LengthValidator getPasswordlengthValidator2() {
        return passwordlengthValidator2;
    }

    public void setPasswordlengthValidator2(LengthValidator lv) {
        this.passwordlengthValidator2 = lv;
    }

    // </editor-fold>

    /**
     * Construct a new Page bean instance.


     */
    public profile() {
    }

    /**
     * Callback method that is called whenever a page is navigated to,
     * either directly via a URL, or indirectly via page navigation.
     * Customize this method to acquire resources that will be needed
     * for event handlers and lifecycle methods, whether or not this
     * page is performing post back processing.


     * 
     * Note that, if the current request is a postback, the property
     * values of the components do  not  represent any
     * values submitted with this request.  Instead, they represent the
     * property values that were saved for this view when it was rendered.


     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here
        
        // <editor-fold defaultstate ="collapsed" desc= "Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("profile Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        }
        
        // </editor-fold>
        // Perform application initialization that must complete
        // *after* managed components are initialized
        // TODO - add your own initialization code here
    }

    /**
     * Callback method that is called after the component tree has been
     * restored, but before any event processing takes place.  This method
     * will  only  be called on a postback request that
     * is processing a form submit.  Customize this method to allocate
     * resources that will be required in your event handlers.


     */
    @Override
    public void preprocess() {
    }

    /**
     * Callback method that is called just before rendering takes place.
     * This method will only be called for the page that
     * will actually be rendered (and not, for example, on a page that
     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.


     */
    @Override
    public void prerender() {
        this.currentpassword.setText(null);
        this.newpassword.setText(null);
        this.retypenewpassword.setText(null);

        RowKey rowKey  = getuserDataProvider().findFirst(
                new String[] {"user.login"},
                new Object[] {getSessionBean1().getLoggedInlogin()}
        );
        getuserDataProvider().setCursorRow(rowKey);

      //  rowKey = getuserDataProvider().findFirst(
       //     new String[] {"user.id"},
        //    new Object[] {getSessionBean1().getLoggedInlogin()}
      //  );
       // getuserDataProvider().setCursorRow(rowKey);
    }

    /**
     * Callback method that is called after rendering is completed for
     * this request, if <code>init()
was called (regardless of whether
* or not this was the page that was actually rendered). Customize this
* method to release resources acquired in the
init()
,
*
preprocess()
, or
prerender()
methods (or
* acquired during execution of an event handler).


*/
@Override
public void destroy() {
userDataProvider.close();
}

/**
* Return a reference to the scoped data bean.


*
* @return reference to the scoped data bean
*/
protected RequestBean1 getRequestBean1() {
return (RequestBean1) getBean("RequestBean1");
}

/**
* Return a reference to the scoped data bean.


*
* @return reference to the scoped data bean
*/
protected ApplicationBean1 getApplicationBean1() {
return (ApplicationBean1) getBean("ApplicationBean1");
}

/**
* Return a reference to the scoped data bean.


*
* @return reference to the scoped data bean
*/
protected SessionBean1 getSessionBean1() {
return (SessionBean1) getBean("SessionBean1");
}
public String update_action() {
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.

String thefirstname = (String) this.firstname.getText();
String thelastname = (String) this.lastname.getText();
RowKey rowKey;
// check if new password is a valid password and equals retyped password.
String thenewpassword = (String) this.newpassword.getText();
String theretypenewpassword = (String) this.retypenewpassword.getText();
if ( theretypenewpassword == null || ! thenewpassword.equals(theretypenewpassword.trim())) {
error("New password and retyped password do not match.");
return null;
}
String thecurrentpassword = (String) this.currentpassword.getText();
rowKey = getuserDataProvider().findFirst(
new String[] {"user.login", "user.password"},
new Object[] {getSessionBean1().getLoggedInlogin(), thecurrentpassword}
);
if (rowKey == null) {
error("Could not login with current password.");
return null;
}

getuserDataProvider().setValue("user.password", rowKey, thenewpassword);
getuserDataProvider().commitChanges();

getuserDataProvider().commitChanges();
getSessionBean1().setLoggedInUserName(
getuserDataProvider().getValue("user.firstname")
+ " "
+ getuserDataProvider().getValue("user.lastname")
);

return "lists";
}


}
</code>




Le code JSP est le suivant :




<?xml version="1.0" encoding="UTF-8"?>
<!-- 
    Document   : profile
    Created on : 10 août 2009, 08:43:29
    Author     : Dali
-->
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
        <webuijsf:page id="page1">
            <webuijsf:html id="html1">
                <webuijsf:head id="head1">
                    <webuijsf:link id="link1" url="/resources/stylesheet.css"/>
                </webuijsf:head>
                <webuijsf:body id="body1" style="-rave-layout: grid">
                    <webuijsf:form binding="#{profile.form1}" id="form1">
                        <webuijsf:staticText id="staticText2" style="left: 96px; top: 216px; position: absolute" text="Login"/>
                        <webuijsf:staticText id="staticText4" style="left: 96px; top: 312px; position: absolute" text="Last name"/>
                        <webuijsf:staticText id="staticText5" style="position: absolute; left: 96px; top: 360px" text="Sexe"/>
                        <webuijsf:staticText id="staticText6" style="left: 96px; top: 648px; position: absolute" text="Department"/>
                        <webuijsf:staticText id="staticText7" style="left: 96px; top: 408px; position: absolute" text="Current Password"/>
                        <webuijsf:staticText id="staticText8" style="left: 96px; top: 456px; position: absolute" text="New Password"/>
                        <webuijsf:staticText id="staticText9" style="left: 96px; top: 504px; position: absolute" text="Retype New Password"/>
                        <webuijsf:staticText id="staticText10" style="left: 96px; top: 552px; position: absolute" text="Mobile Phone"/>
                        <webuijsf:staticText id="staticText11" style="left: 96px; top: 600px; position: absolute" text="Company"/>
                        <webuijsf:radioButtonGroup binding="#{profile.sexe}" columns="2" id="sexe" items="#{profile.sexeDefaultOptions.options}" style="left: 240px; top: 360px; position: absolute"/>
                        <webuijsf:passwordField binding="#{profile.currentpassword}" id="currentpassword" style="left: 240px; top: 408px; position: absolute" validatorExpression="#{profile.currentpasswordlengthValidator.validate}"/>
                        <webuijsf:passwordField binding="#{profile.newpassword}" id="newpassword" style="left: 240px; top: 456px; position: absolute" validatorExpression="#{profile.lengthValidator.validate}"/>
                        <webuijsf:passwordField binding="#{profile.retypenewpassword}" id="retypenewpassword" style="left: 240px; top: 504px; position: absolute"/>
                        <webuijsf:textField binding="#{profile.login}" id="login" style="left: 240px; top: 216px; position: absolute"/>
                        <webuijsf:textField binding="#{profile.firstname}" id="firstname" style="left: 216px; top: 264px; position: absolute" text="#{profile.userDataProvider.value['user.firstname']}"/>
                        <webuijsf:textField binding="#{profile.lastname}" id="lastname" style="left: 240px; top: 312px; position: absolute" text="#{profile.userDataProvider.value['user.lasttname']}"/>
                        <webuijsf:textField binding="#{profile.mobilephone}" id="mobilephone" style="left: 240px; top: 552px; position: absolute" text="#{profile.userDataProvider.value['user.mobilephone']}"/>
                        <webuijsf:textField binding="#{profile.company}" id="company" style="left: 240px; top: 600px; position: absolute" text="#{profile.userDataProvider.value['user.company']}"/>
                        <webuijsf:textField binding="#{profile.department}" id="department" style="left: 240px; top: 648px; position: absolute" text="#{profile.userDataProvider.value['user.department']}"/>
                        <webuijsf:message for="login" id="message1" showDetail="false" showSummary="true" style="left: 432px; top: 216px; position: absolute"/>
                        <webuijsf:message for="firstname" id="message2" showDetail="false" showSummary="true" style="left: 432px; top: 264px; position: absolute"/>
                        <webuijsf:message for="lastname" id="message3" showDetail="false" showSummary="true" style="left: 432px; top: 312px; position: absolute"/>
                        <webuijsf:message for="sexe" id="message4" showDetail="false" showSummary="true" style="left: 432px; top: 360px; position: absolute"/>
                        <webuijsf:message for="password" id="message5" showDetail="false" showSummary="true" style="left: 432px; top: 408px; position: absolute"/>
                        <webuijsf:message for="newpassword" id="message6" showDetail="false" showSummary="true" style="left: 432px; top: 456px; position: absolute"/>
                        <webuijsf:message for="retypenewpassword" id="message7" showDetail="false" showSummary="true" style="left: 432px; top: 504px; position: absolute"/>
                        <webuijsf:message for="mobilephone" id="message8" showDetail="false" showSummary="true" style="left: 432px; top: 552px; position: absolute"/>
                        <webuijsf:message for="company" id="message9" showDetail="false" showSummary="true" style="left: 432px; top: 600px; position: absolute"/>
                        <webuijsf:message for="department" id="message10" showDetail="false" showSummary="true" style="left: 432px; top: 648px; position: absolute"/>
                        <webuijsf:staticText id="staticText12" style="left: 96px; top: 696px; position: absolute" text="Title"/>
                        <webuijsf:staticText id="staticText13" style="left: 96px; top: 744px; position: absolute" text="Cams"/>
                        <webuijsf:staticText id="staticText14" style="left: 96px; top: 792px; position: absolute" text="Interests"/>
                        <webuijsf:textField binding="#{profile.title}" id="title" style="left: 240px; top: 696px; position: absolute" text="#{profile.userDataProvider.value['user.title']}"/>
                        <webuijsf:textField binding="#{profile.cams}" id="cams" style="left: 240px; top: 744px; position: absolute" text="#{profile.userDataProvider.value['user.cams']}"/>
                        <webuijsf:textField binding="#{profile.interests}" id="interests" style="left: 240px; top: 792px; position: absolute"/>
                        <webuijsf:message for="title" id="message11" showDetail="false" showSummary="true" style="left: 432px; top: 696px; position: absolute"/>
                        <webuijsf:message for="cams" id="message12" showDetail="false" showSummary="true" style="left: 432px; top: 744px; position: absolute"/>
                        <webuijsf:message for="interests" id="message13" showDetail="false" showSummary="true" style="left: 432px; top: 792px; position: absolute"/>
                        <webuijsf:button id="update" style="left: 95px; top: 864px; position: absolute; width: 72px" text="Update"/>
                        <webuijsf:messageGroup id="messageGroup1" style="left: 96px; top: 96px; position: absolute"/>
                        <webuijsf:staticText id="staticText1" style="left: 96px; top: 24px; position: absolute" text="Profile "/>
                        <webuijsf:staticText id="staticText3" style="left: 96px; top: 264px; position: absolute" text="First Name"/>
                    </webuijsf:form>
                </webuijsf:body>
            </webuijsf:html>
        </webuijsf:page>
    </f:view>
</jsp:root>
0
Rejoignez-nous