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

Weblogic Java Discussion :

Erreur "java.lang.NullPointerException" findViewObject Object view


Sujet :

Weblogic Java

  1. #1
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut Erreur "java.lang.NullPointerException" findViewObject Object view
    Bonjour,

    J'ai créé un object view
    Entete
    qui est basé sur quatre tables.
    Dans la partie Data Control AppModuleDataControl de JDeveloper, j'ai le nom.
    Entete1 comme objet.
    Alors dans mon script :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
        public static ApplicationModuleImpl getApplicationModule() {
     
                return (ApplicationModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
         }
    qui doit me permettre d'avoir les données de cet object view.

    Mais à l'exécution j'ai l'erreur:
    javax.faces.FacesException: oracle.adf.controller.ControllerException: ADFC-10001: impossible d'instancier la classe 'com.redsamurai.view.beans.DoPreForm'
    at oracle.adfinternal.controller.util.Utils.createAndLogFacesException(Utils.java:196)

    Caused By: java.lang.NullPointerException
    at com.redsamurai.view.beans.DoPreForm.findData(DoPreForm.java:38)
    at com.redsamurai.view.beans.DoPreForm.<init>(DoPreForm.java:34)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    Je précise que dans mon data control, j'ai un seul object view
    Entete1
    Voici le code où ça plante
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
        public void findData(){
            ViewObject view = (ViewObject) Utilities.getApplicationModule().findViewObject("Entete1"); 
            view.setNamedWhereClauseParam("p_user",Utilities.getCurrentUser());  
            view.executeQuery();
            //Row row = view.first();
            EnteteRowImpl row = (EnteteRowImpl)view.first();
            this._username    = (String)row.getlogin();
            this._password    = (String)row.getpwd();
            this._code_poste  = (String)row.getpc_code();
            this._poste       = (String)row.getpc_code()+'-'+(String)row.getpc_libelle();
            this._service     = (String)row.getprofil_liibelle()+"-"+row.getdate_debut()+"-"+row.getdate_fin();
            //this._fonction = (String)row.getAttribute(getFonction());
            this._agent       = (String)row.getmatricule()+"-"+(String)row.getnom()+" "+(String)row.getprenom();
        }
    Quelqu'un saurait-il m'indiquer d'où peut venir le problème ?

    Merci d'avance pour votre aide.

  2. #2
    Membre expérimenté Avatar de Nico02
    Homme Profil pro
    Developpeur Java/JEE
    Inscrit en
    Février 2011
    Messages
    728
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Developpeur Java/JEE
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 728
    Points : 1 622
    Points
    1 622
    Par défaut
    A vu de nez je ne vois que 2 possibilités,
    - Soit Utilities.getApplicationModule() te renvoie null
    - Soit la ViewObject "Entete1" n'est pas référencé dans ton module d'application, auquel cas c'est normal qu'il te renvoie null.

    Dans quel contexte est cette méthode est exécutée ?

    Peux tu nous montrer la structure de ta classe Entete1 ?

    Cdt.

  3. #3
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    J'ai mis en fichier joint l'image pour la description de mon object view
    Images attachées Images attachées  

  4. #4
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    Citation Envoyé par Nico02 Voir le message
    A vu de nez je ne vois que 2 possibilités,
    - Soit Utilities.getApplicationModule() te renvoie null
    - Soit la ViewObject "Entete1" n'est pas référencé dans ton module d'application, auquel cas c'est normal qu'il te renvoie null.

    Dans quel contexte est cette méthode est exécutée ?

    Peux tu nous montrer la structure de ta classe Entete1 ?

    Cdt.
    Effectivement comme vous l'avez dit Utilities.getApplicationModule() me renvoie null.
    J'ai utilisé les deux classes ADFUtils et JSFUtils pour recuperer l'aaplication module à travers la méthode getApplicationModuleForDataControl
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    public class Utilities {
     
    public static ApplicationModuleImpl getApplicationModule(){
     return (ApplicationModuleImpl) ADFUtils .getApplicationModuleForDataControl("AppModuleDataControl");
    }
     
    }
    Images attachées Images attachées  

  5. #5
    Membre expérimenté Avatar de Nico02
    Homme Profil pro
    Developpeur Java/JEE
    Inscrit en
    Février 2011
    Messages
    728
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Developpeur Java/JEE
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 728
    Points : 1 622
    Points
    1 622
    Par défaut
    Bon on ne voit pas grand chose sur ta photo mais au vu de ta méthode getApplicationModule j'en déduis que tu n'a qu'un seul module d'application.

    Si c'est effectivement le cas tu dois pouvoir utiliser cette ligne pour le récupérer

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    public void findData(){
       ApplicationModuleImpl am = (ApplicationModuleImpl )BindingContext.getCurrent().getDefaultDataControl().getApplicationModule();
    ....

  6. #6
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    J'ai mis un fichier attaché au msg précédent montrant clairement mon data control et la object view

  7. #7
    Membre expérimenté Avatar de Nico02
    Homme Profil pro
    Developpeur Java/JEE
    Inscrit en
    Février 2011
    Messages
    728
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Developpeur Java/JEE
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 728
    Points : 1 622
    Points
    1 622
    Par défaut
    Si Entete1 hérite bien d'une ViewObjectImpl tu dois pouvoir appeler directement getApplicationModule();

    Edit : moi ce que je veux savoir c'est quelle classe contient cette méthode findData

  8. #8
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    Citation Envoyé par Nico02 Voir le message
    Si Entete1 hérite bien d'une ViewObjectImpl tu dois pouvoir appeler directement getApplicationModule();
    je ne cerne pas ce que tu veux dire par là.
    J'ai créer un object view basé sur qautre tables que j'ai appélé Entete.
    Et le système m'a généré dans le data control entete1
    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
    package com.redsamurai.model.views;
     
    import java.sql.ResultSet;
     
    import oracle.adf.share.ADFContext;
     
    import oracle.jbo.Row;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    // ---------------------------------------------------------------------
    // ---    File generated by Oracle ADF Business Components Design Time.
    // ---    Mon Sep 02 14:13:54 GMT 2013
    // ---    Custom code may be added to this class.
    // ---    Warning: Do not modify method signatures of generated methods.
    // ---------------------------------------------------------------------
    public class EnteteImpl extends ViewObjectImpl {
        /**
         * This is the default constructor (do not remove).
         */
        public EnteteImpl() {
        }
     
        /**
         * Returns the bind variable value for current_user.
         * @return bind variable value for current_user
         */
        public String getcurrent_user() {
            return ADFContext.getCurrent().getSecurityContext().getUserName();
            //return (String) getNamedWhereClauseParam("current_user");
        }
     
        /**
         * Sets <code>value</code> for bind variable current_user.
         * @param value value to bind as current_user
         */
        public void setcurrent_user(String value) {
            setNamedWhereClauseParam("current_user", value);
        }
     
        /**
         * executeQueryForCollection - overridden for custom java data source support.
         */
        @Override
        protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {
            super.executeQueryForCollection(qc, params, noUserParams);
        }
     
        /**
         * hasNextForCollection - overridden for custom java data source support.
         */
        @Override
        protected boolean hasNextForCollection(Object qc) {
            boolean bRet = super.hasNextForCollection(qc);
            return bRet;
        }
     
        /**
         * createRowFromResultSet - overridden for custom java data source support.
         */
        @Override
        protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet resultSet) {
            ViewRowImpl value = super.createRowFromResultSet(qc, resultSet);
            return value;
        }
     
        /**
         * getQueryHitCount - overridden for custom java data source support.
         */
        @Override
        public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
            long value = super.getQueryHitCount(viewRowSet);
            return value;
        }
     
        /**
         * getCappedQueryHitCount - overridden for custom java data source support.
         */
        @Override
        public long getCappedQueryHitCount(ViewRowSetImpl viewRowSet, Row[] masterRows, long oldCap, long cap) {
            long value = super.getCappedQueryHitCount(viewRowSet, masterRows, oldCap, cap);
            return value;
        }
    }
    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
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    package com.redsamurai.model.views;
     
    import oracle.adf.share.ADFContext;
     
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.ViewObject;
    import oracle.jbo.domain.Date;
    import oracle.jbo.server.AttributeDefImpl;
    import oracle.jbo.server.ViewRowImpl;
    // ---------------------------------------------------------------------
    // ---    File generated by Oracle ADF Business Components Design Time.
    // ---    Mon Sep 02 14:13:52 GMT 2013
    // ---    Custom code may be added to this class.
    // ---    Warning: Do not modify method signatures of generated methods.
    // ---------------------------------------------------------------------
    public class EnteteRowImpl extends ViewRowImpl {
        /**
         * AttributesEnum: generated enum for identifying attributes and accessors. DO NOT MODIFY.
         */
        public enum AttributesEnum {
            matricule {
                public Object get(EnteteRowImpl obj) {
                    return obj.getmatricule();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            nom {
                public Object get(EnteteRowImpl obj) {
                    return obj.getnom();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            prenom {
                public Object get(EnteteRowImpl obj) {
                    return obj.getprenom();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            civilite {
                public Object get(EnteteRowImpl obj) {
                    return obj.getcivilite();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            login {
                public Object get(EnteteRowImpl obj) {
                    return obj.getlogin();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            pwd {
                public Object get(EnteteRowImpl obj) {
                    return obj.getpwd();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            status {
                public Object get(EnteteRowImpl obj) {
                    return obj.getstatus();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            lockdate {
                public Object get(EnteteRowImpl obj) {
                    return obj.getlockdate();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            date_debut {
                public Object get(EnteteRowImpl obj) {
                    return obj.getdate_debut();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            date_fin {
                public Object get(EnteteRowImpl obj) {
                    return obj.getdate_fin();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            pc_code {
                public Object get(EnteteRowImpl obj) {
                    return obj.getpc_code();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            pc_libelle {
                public Object get(EnteteRowImpl obj) {
                    return obj.getpc_libelle();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            pcc {
                public Object get(EnteteRowImpl obj) {
                    return obj.getpcc();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            adm {
                public Object get(EnteteRowImpl obj) {
                    return obj.getadm();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            pctype {
                public Object get(EnteteRowImpl obj) {
                    return obj.getpctype();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            profil_code {
                public Object get(EnteteRowImpl obj) {
                    return obj.getprofil_code();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ,
            profil_liibelle {
                public Object get(EnteteRowImpl obj) {
                    return obj.getprofil_liibelle();
                }
     
                public void put(EnteteRowImpl obj, Object value) {
                    obj.setAttributeInternal(index(), value);
                }
            }
            ;
            private static AttributesEnum[] vals = null;
            private static final int firstIndex = 0;
     
            public abstract Object get(EnteteRowImpl object);
     
            public abstract void put(EnteteRowImpl object, Object value);
     
            public int index() {
                return EnteteRowImpl.AttributesEnum.firstIndex() + ordinal();
            }
     
            public static final int firstIndex() {
                return firstIndex;
            }
     
            public static int count() {
                return EnteteRowImpl.AttributesEnum.firstIndex() + EnteteRowImpl.AttributesEnum.staticValues().length;
            }
     
            public static final AttributesEnum[] staticValues() {
                if (vals == null) {
                    vals = EnteteRowImpl.AttributesEnum.values();
                }
                return vals;
            }
        }
        public static final int MATRICULE = AttributesEnum.matricule.index();
        public static final int NOM = AttributesEnum.nom.index();
        public static final int PRENOM = AttributesEnum.prenom.index();
        public static final int CIVILITE = AttributesEnum.civilite.index();
        public static final int LOGIN = AttributesEnum.login.index();
        public static final int PWD = AttributesEnum.pwd.index();
        public static final int STATUS = AttributesEnum.status.index();
        public static final int LOCKDATE = AttributesEnum.lockdate.index();
        public static final int DATE_DEBUT = AttributesEnum.date_debut.index();
        public static final int DATE_FIN = AttributesEnum.date_fin.index();
        public static final int PC_CODE = AttributesEnum.pc_code.index();
        public static final int PC_LIBELLE = AttributesEnum.pc_libelle.index();
        public static final int PCC = AttributesEnum.pcc.index();
        public static final int ADM = AttributesEnum.adm.index();
        public static final int PCTYPE = AttributesEnum.pctype.index();
        public static final int PROFIL_CODE = AttributesEnum.profil_code.index();
        public static final int PROFIL_LIIBELLE = AttributesEnum.profil_liibelle.index();
     
        /**
         * This is the default constructor (do not remove).
         */
        public EnteteRowImpl() {
        }
     
        /**
         * Gets the attribute value for the calculated attribute matricule.
         * @return the matricule
         */
        public String getmatricule() {
            return (String) getAttributeInternal(MATRICULE);
        }
     
        /**
         * Gets the attribute value for the calculated attribute nom.
         * @return the nom
         */
        public String getnom() {
            return (String) getAttributeInternal(NOM);
        }
     
        /**
         * Gets the attribute value for the calculated attribute prenom.
         * @return the prenom
         */
        public String getprenom() {
            return (String) getAttributeInternal(PRENOM);
        }
     
        /**
         * Gets the attribute value for the calculated attribute civilite.
         * @return the civilite
         */
        public String getcivilite() {
            return (String) getAttributeInternal(CIVILITE);
        }
     
        /**
         * Gets the attribute value for the calculated attribute login.
         * @return the login
         */
        public String getlogin() {
            return (String) getAttributeInternal(LOGIN);
        }
     
        /**
         * Gets the attribute value for the calculated attribute pwd.
         * @return the pwd
         */
        public String getpwd() {
            return (String) getAttributeInternal(PWD);
        }
     
        /**
         * Gets the attribute value for the calculated attribute status.
         * @return the status
         */
        public String getstatus() {
            return (String) getAttributeInternal(STATUS);
        }
     
        /**
         * Gets the attribute value for the calculated attribute lockdate.
         * @return the lockdate
         */
        public Date getlockdate() {
            return (Date) getAttributeInternal(LOCKDATE);
        }
     
        /**
         * Gets the attribute value for the calculated attribute date_debut.
         * @return the date_debut
         */
        public Date getdate_debut() {
            return (Date) getAttributeInternal(DATE_DEBUT);
        }
     
        /**
         * Gets the attribute value for the calculated attribute date_fin.
         * @return the date_fin
         */
        public Date getdate_fin() {
            return (Date) getAttributeInternal(DATE_FIN);
        }
     
        /**
         * Gets the attribute value for the calculated attribute pc_code.
         * @return the pc_code
         */
        public String getpc_code() {
            return (String) getAttributeInternal(PC_CODE);
        }
     
        /**
         * Gets the attribute value for the calculated attribute pc_libelle.
         * @return the pc_libelle
         */
        public String getpc_libelle() {
            return (String) getAttributeInternal(PC_LIBELLE);
        }
     
        /**
         * Gets the attribute value for the calculated attribute pcc.
         * @return the pcc
         */
        public String getpcc() {
            return (String) getAttributeInternal(PCC);
        }
     
        /**
         * Gets the attribute value for the calculated attribute adm.
         * @return the adm
         */
        public String getadm() {
            return (String) getAttributeInternal(ADM);
        }
     
        /**
         * Gets the attribute value for the calculated attribute pctype.
         * @return the pctype
         */
        public String getpctype() {
            return (String) getAttributeInternal(PCTYPE);
        }
     
        /**
         * Gets the attribute value for the calculated attribute profil_code.
         * @return the profil_code
         */
        public String getprofil_code() {
            return (String) getAttributeInternal(PROFIL_CODE);
        }
     
        /**
         * Gets the attribute value for the calculated attribute profil_liibelle.
         * @return the profil_liibelle
         */
        public String getprofil_liibelle() {
            return (String) getAttributeInternal(PROFIL_LIIBELLE);
        }
     
        /**
         * getAttrInvokeAccessor: generated method. Do not modify.
         * @param index the index identifying the attribute
         * @param attrDef the attribute
     
         * @return the attribute value
         * @throws Exception
         */
        protected Object getAttrInvokeAccessor(int index, AttributeDefImpl attrDef) throws Exception {
            if ((index >= AttributesEnum.firstIndex()) && (index < AttributesEnum.count())) {
                return AttributesEnum.staticValues()[index - AttributesEnum.firstIndex()].get(this);
            }
            return super.getAttrInvokeAccessor(index, attrDef);
        }
     
        /**
         * setAttrInvokeAccessor: generated method. Do not modify.
         * @param index the index identifying the attribute
         * @param value the value to assign to the attribute
         * @param attrDef the attribute
     
         * @throws Exception
         */
        protected void setAttrInvokeAccessor(int index, Object value, AttributeDefImpl attrDef) throws Exception {
            if ((index >= AttributesEnum.firstIndex()) && (index < AttributesEnum.count())) {
                AttributesEnum.staticValues()[index - AttributesEnum.firstIndex()].put(this, value);
                return;
            }
            super.setAttrInvokeAccessor(index, value, attrDef);
        }
     
        public ViewObject getViewData() {
            ApplicationModule am = this.getApplicationModule();
            if ( am == null ) {
                System.out.println("ApplicationModule is null");
            }
            else{
                System.out.println("ApplicationModule is not null");
            }
            ViewObject vo = (ViewObject)am.findViewObject("Entete1");
            vo.setNamedWhereClauseParam("p_user", "alj");  
            //vo.setNamedWhereClauseParam("p_user", ADFContext.getCurrent().getSecurityContext().getUserName());  
            vo.executeQuery();
            return vo;
        }
    }
    Voir fichier attaché pour les tables
    Images attachées Images attachées  

  9. #9
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    J'ai modifier le script pour l'application module comme vs l'avez indiqué.
    L'application module n'est plus null mais il se trouve que la ViewObject me renvoie null.
    Le paramètre Entet1 n'est t'il pas correct dans
    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
        public void findData(){
            ApplicationModule am = Utilities.getApplicationModule();
            if ( am == null ) {
                System.out.println("ApplicationModule is null");
            }
            else{
                System.out.println("ApplicationModule is not null");
            }
            System.out.println("Current User: " + Utilities.getCurrentUser() );
            ViewObject view = (ViewObject) am.findViewObject("Entete1");
            if ( view == null ) {
                System.out.println("ViewObject is null");
            }
            else{
                System.out.println("ViewObject is not null");
            }        
            view.setNamedWhereClauseParam("p_user", "alj");  
            //view.setNamedWhereClauseParam("p_user",Utilities.getCurrentUser());  
            view.executeQuery();
    ou Entete1 ne se trouve pas dans la default data control.

    Comment passer en paramètre la data control pour avoir l'application module associé?

    dans le log j'ai
    ApplicationModule is not null
    Current User: redsam
    ViewObject is null
    <5 sept. 2013 08 h 29 GMT> <Error> <oracle.adfinternal.controller.application.AdfcExceptionHandler> <ADFC-50018> <ADFc : aucun gestionnaire d'exception n'a été trouvé pour l'exception d'application.
    javax.faces.FacesException: oracle.adf.controller.ControllerException: ADFC-10001: impossible d'instancier la classe 'com.redsamurai.view.beans.DoPreForm'
    at oracle.adfinternal.controller.util.Utils.createAndLogFacesException(Utils.java:196)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:189)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.instantiateBean(ManagedBeanFactory.java:896)
    at oracle.adfinternal.controller.application.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:150)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)

  10. #10
    Membre expérimenté Avatar de Nico02
    Homme Profil pro
    Developpeur Java/JEE
    Inscrit en
    Février 2011
    Messages
    728
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Developpeur Java/JEE
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 728
    Points : 1 622
    Points
    1 622
    Par défaut
    Montre moi cette classe DoPreForm car c'est elle qui pose probleme

  11. #11
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    Citation Envoyé par Nico02 Voir le message
    Montre moi cette classe DoPreForm car c'est elle qui pose probleme
    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
     
     
    import oracle.adf.share.ADFContext;
     
    import com.redsamurai.view.util.Utilities;
     
    import oracle.jbo.Row;
    import oracle.jbo.ViewObject;
    import oracle.jbo.server.ViewObjectImpl;
     
    import com.redsamurai.model.views.EnteteImpl;
    import com.redsamurai.model.views.EnteteRowImpl;
     
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.server.ViewRowImpl;
     
     
    public class DoPreForm {
        private String _username;
        private String _password;
        private String _code_poste;
        private String _poste;
        private String _service;
        private String _fonction;
        private String _agent;
     
        public void setCode_poste(String _code_poste) {
            this._code_poste = _code_poste;
        }
     
        public String getCode_poste() {
            return _code_poste;
        }
     
        public DoPreForm() {
            super();
            findData();
        }
     
        public void findData(){
            ApplicationModule am = Utilities.getApplicationModule();
            if ( am == null ) {
                System.out.println("ApplicationModule is null");
            }
            else{
                System.out.println("ApplicationModule is not null");
            }
            System.out.println("Current User: " + Utilities.getCurrentUser() );
            ViewObject view = (ViewObject) am.findViewObject("Entete1");
            if ( view == null ) {
                System.out.println("ViewObject is null");
            }
            else{
                System.out.println("ViewObject is not null");
            }        
            view.setNamedWhereClauseParam("p_user", "alj");  
            //view.setNamedWhereClauseParam("p_user",Utilities.getCurrentUser());  
            view.executeQuery();
            ////Row row = view.first();
            //ViewObject view = new EnteteRowImpl().getViewData();
            EnteteRowImpl row = (EnteteRowImpl)view.first();
            this._username    = (String)row.getlogin();
            this._password    = (String)row.getpwd();
            this._code_poste  = (String)row.getpc_code();
            this._poste       = (String)row.getpc_code()+'-'+(String)row.getpc_libelle();
            this._service     = (String)row.getprofil_liibelle()+"-"+row.getdate_debut()+"-"+row.getdate_fin();
            //this._fonction = (String)row.getAttribute(getFonction());
            this._agent       = (String)row.getmatricule()+"-"+(String)row.getnom()+" "+(String)row.getprenom();
        }
     
        public void setUsername(String _username) {
            this._username = _username;
        }
     
        public String getUsername() {
            //return _username;
            return Utilities.getCurrentUser();
        }
     
        public void setPassword(String _password) {
            this._password = _password;
        }
     
        public String getPassword() {
            return _password;
        }
     
        public void setPoste(String _poste) {
            this._poste = _poste;
        }
     
        public String getPoste() {
            return _poste;
        }
     
        public void setService(String _service) {
            this._service = _service;
        }
     
        public String getService() {
            return _service;
        }
     
        public void setFonction(String _fonction) {
            this._fonction = _fonction;
        }
     
        public String getFonction() {
            return _fonction;
        }
     
        public void setAgent(String _agent) {
            this._agent = _agent;
        }
     
        public String getAgent() {
            return _agent;
        }
     
     
     
    }
    dans le log j'ai:
    ApplicationModule is not null
    Current User: redsam
    ViewObject is null
    <5 sept. 2013 08 h 29 GMT> <Error> <oracle.adfinternal.controller.application.AdfcExceptionHandler> <ADFC-50018> <ADFc : aucun gestionnaire d'exception n'a été trouvé pour l'exception d'application.
    javax.faces.FacesException: oracle.adf.controller.ControllerException: ADFC-10001: impossible d'instancier la classe 'com.redsamurai.view.beans.DoPreForm'
    at oracle.adfinternal.controller.util.Utils.createAndLogFacesException(Utils.java:196)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:189)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.instantiateBean(ManagedBeanFactory.java:896)
    at oracle.adfinternal.controller.application.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:150)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)

  12. #12
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    J'ai modifier le script pour avoir le nom dudefault data control
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
          public static ApplicationModuleImpl getApplicationModule() {                   System.out.println("Default data control: " + BindingContext.getCurrent().getDefaultDataControl().toString());
                ApplicationModuleImpl am = (ApplicationModuleImpl )BindingContext.getCurrent().getDefaultDataControl().getApplicationModule();

    Et voici ce que j'obtiens:
    détectée dans panelGridLayout, clientId = "Header:pgl4", ID gridRow = "gr3", ID gridCell = "gc8", largeur = "70%" car la valeur columnSpan n'est pas égale à 1 (columnSpan = "3").>
    Default data control: HrModuleDataControl
    ApplicationModule is not nulloracle.jbo.server.ApplicationModuleImpl@d89bd4
    Current User: redsam
    ViewObject is null
    <5 sept. 2013 09 h 52 GMT> <Error> <oracle.adfinternal.controller.application.AdfcExceptionHandler> <ADFC-50018> <ADFc : aucun gestionnaire d'exception n'a été trouvé pour l'exception d'application.
    Alors que mon object view Entete1 se trouve plutot dans le data control AppModuleDataControl.
    Alors comment avoir l'application module correspondant au data control AppModuleDataControl?

  13. #13
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    Seul le data control HrDataControl semble être reconnu. Comment faire pour que les autres soient reconnus.

    DataBinding.cpx
    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
    <?xml version="1.0" encoding="UTF-8" ?>
    <Application xmlns="http://xmlns.oracle.com/adfm/application"
                 version="11.1.1.56.60" id="DataBindings" SeparateXMLFiles="false"
                 Package="com.redsamurai.view" ClientType="Generic">
      <pageMap>
        <page path="/login.jspx" usageId="com_redsamurai_view_loginPageDef"/>
        <page path="/main.jspx" usageId="com_redsamurai_view_mainPageDef"/>
        <page path="/Accueil.jspx" usageId="com_redsamurai_view_AccueilPageDef"/>
      </pageMap>
      <pageDefinitionUsages>
        <page id="com_redsamurai_view_loginPageDef"
              path="com.redsamurai.view.pageDefs.loginPageDef"/>
        <page id="com_redsamurai_view_mainPageDef"
              path="com.redsamurai.view.pageDefs.mainPageDef"/>
        <page id="com_redsamurai_view_AccueilPageDef" path="com.redsamurai.view.pageDefs.AccueilPageDef"/>
      </pageDefinitionUsages>
      <dataControlUsages>
        <BC4JDataControl id="HrModuleDataControl" Package="com.redsamurai.model"
                         FactoryClass="oracle.adf.model.bc4j.DataControlFactoryImpl"
                         SupportsTransactions="true" SupportsFindMode="true"
                         SupportsRangesize="true" SupportsResetState="true"
                         SupportsSortCollection="true" Configuration="HrModuleLocal"
                         syncMode="Immediate"
                         xmlns="http://xmlns.oracle.com/adfm/datacontrol"/>
      </dataControlUsages>
    </Application>

  14. #14
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    J'ai franchi l'étape du data control.
    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
        public void findData(){
            FacesContext context = FacesContext.getCurrentInstance();
            if ( context == null ) {
                System.out.println("context is null");
            }
            else{
                System.out.println("context is not null" + context.toString());
            }
            ValueBinding vb = context.getApplication().createValueBinding("#{data}");
            if ( vb == null ) {
                System.out.println("vb is null");
            }
            else{
                System.out.println("vb is not null" + vb.toString());
            }
            BindingContext bc = (BindingContext) vb.getValue(context);
            if ( bc == null ) {
                System.out.println("bc is null");
            }
            else{
                System.out.println("bc is not null" + bc.toString());
            }
            DCDataControl dc  = bc.findDataControl("AppModuleDataControl");
            if ( dc == null ) {
                System.out.println("dc is null");
            }
            else{
                System.out.println("dc is not null" + dc.toString());
            }
            ApplicationModule am = (ApplicationModuleImpl) dc.getDataProvider();
            if ( am == null ) {
                System.out.println("ApplicationModule is null");
            }
            else{
                System.out.println("ApplicationModule is not null" + am.toString());
            }
            System.out.println("Current User: " + Utilities.getCurrentUser() );
            ViewObject view = (ViewObject) am.findViewObject("Entete");
            if ( view == null ) {
                System.out.println("ViewObject is null");
            }
            else{
                System.out.println("ViewObject is not null");
            }
            System.out.println("View initialize parameter");
            view.setNamedWhereClauseParam("current_user", "alj"); 
            System.out.println("View executeQuery");
            //view.setNamedWhereClauseParam("p_user",Utilities.getCurrentUser());  
            view.executeQuery();
            ////Row row = view.first();
            //ViewObject view = new EnteteRowImpl().getViewData();
            System.out.println("View rows");
            EnteteRowImpl row = (EnteteRowImpl)view.first();
            if ( row == null ) {
                System.out.println("row is null");
            }
            else{
                System.out.println("row is not null");
                row.toXString();
            }
    Log
    context is not nullorg.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$CacheRenderKit@19b4199
    vb is not nullcom.sun.faces.application.ValueBindingValueExpressionAdapter@2eefaa
    bc is not nulloracle.adf.model.servlet.HttpBindingContext@193fbd5
    dc is not nullAppModuleDataControl
    ApplicationModule is not nulloracle.jbo.server.ApplicationModuleImpl@1980d75
    Current User: redsam
    ViewObject is not null
    View initialize parameter
    View executeQuery
    <5 sept. 2013 14 h 32 GMT> <Error> <oracle.adfinternal.controller.application.AdfcExceptionHandler> <ADFC-50018> <ADFc : aucun gestionnaire d'exception n'a été trouvé pour l'exception d'application.
    javax.faces.FacesException: oracle.adf.controller.ControllerException: ADFC-10001: impossible d'instancier la classe 'com.redsamurai.view.beans.DoPreForm'
    at oracle.adfinternal.controller.util.Utils.createAndLogFacesException(Utils.java:196)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:189)
    at oracle.adfinternal.controller.beans.ManagedBeanFactory.instantiateBean(ManagedBeanFactory.java:896)
    ça bloque au niveau du executequery

  15. #15
    Membre expérimenté Avatar de Nico02
    Homme Profil pro
    Developpeur Java/JEE
    Inscrit en
    Février 2011
    Messages
    728
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Developpeur Java/JEE
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2011
    Messages : 728
    Points : 1 622
    Points
    1 622
    Par défaut
    Salut,

    j'avoue ne pas très bien comprendre ce qu'est sensé faire cette méthode. Que cherches tu à faire au juste ?

  16. #16
    Membre régulier
    Inscrit en
    Mai 2003
    Messages
    350
    Détails du profil
    Informations forums :
    Inscription : Mai 2003
    Messages : 350
    Points : 84
    Points
    84
    Par défaut
    J'ai fini par résoudre le problème:
    1 - mon data control n'était pas visible par le bean alors il fallait créer une autre page adf et afficher une form Layout dessus avec les champs de ma vue Entete.

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

Discussions similaires

  1. Réponses: 9
    Dernier message: 31/05/2011, 10h40
  2. erreur compilation java.lang.NullPointerException
    Par muslim1987 dans le forum JDBC
    Réponses: 6
    Dernier message: 26/06/2008, 09h16
  3. Erreur exception java.lang.NullPointerException
    Par geol99 dans le forum Langage
    Réponses: 2
    Dernier message: 14/06/2007, 20h24
  4. erreur de java.lang.NullPointerException
    Par vince351 dans le forum Langage
    Réponses: 1
    Dernier message: 25/03/2007, 12h29

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