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

Persistance des données Java Discussion :

[Eclipse / JBoss - Derby] Générer des tables à partir des entités


Sujet :

Persistance des données Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Février 2012
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Février 2012
    Messages : 39
    Points : 29
    Points
    29
    Par défaut [Eclipse / JBoss - Derby] Générer des tables à partir des entités
    Bonjour à tous,

    J'essaye de mettre en place un JPA-Project avec Eclipse Indigo, Jboss as 7.1.1, Derby et EclipseLink 2.3.2.

    Je vais commencer par vous expliquer ce que j'ai fait avant de vous exposer mon problème :

    - Création de la base de données DerbyDB via le Data Source Explorer d'Eclipse.

    - J'ai inséré la librairie derbyclient.jar dans le répertoire Standalone/Deployments de JBoss

    - J'ai créé (et activé) une nouvelle DataSource (via le JBoss management localhost:8080)
    voici un extrait du code du fichier Standalone.xml qui est généré :
    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
                    <datasource jta="false" jndi-name="java:/DerbyDS" pool-name="DerbyDS" enabled="true" use-ccm="false">
                        <connection-url>jdbc:derby://localhost:1527/DerbyDB</connection-url>
                        <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>
                        <driver>derbyclient.jar</driver>
                        <security>
                            <user-name>dev</user-name>
                            <password>dev</password>
                        </security>
                        <validation>
                            <validate-on-match>false</validate-on-match>
                            <background-validation>false</background-validation>
                        </validation>
                        <statement>
                            <share-prepared-statements>false</share-prepared-statements>
                        </statement>
                    </datasource>
    - lancement du serveur JBoss via Standalone.bat :
    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
    Calling "C:\Documents and Settings\user\Bureau\TestJPA\jboss-as-7.1.1.Final\bi
    n\standalone.conf.bat"
    ===============================================================================
     
      JBoss Bootstrap Environment
     
      JBOSS_HOME: C:\Documents and Settings\user\Bureau\TestJPA\jboss-as-7.1.1.Fin
    al
     
      JAVA: C:\Program Files\Java\jdk1.6.0_30\bin\java
     
      JAVA_OPTS: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xms64M -Xmx51
    2M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.se
    rver.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.war
    ning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.server.default.c
    onfig=standalone.xml
     
    ===============================================================================
     
    10:41:15,728 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
    10:41:15,989 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
    10:41:16,079 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" sta
    rting
    10:41:17,761 INFO  [org.xnio] XNIO Version 3.0.3.GA
    10:41:17,771 INFO  [org.jboss.as.server] JBAS015888: Creating http management se
    rvice using socket-binding (management-http)
    10:41:17,841 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
    10:41:17,851 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
    10:41:17,972 INFO  [org.jboss.as.security] JBAS013101: Activating Security Subsy
    stem
    10:41:17,992 INFO  [org.jboss.as.osgi] JBAS011940: Activating OSGi Subsystem
    10:41:18,012 INFO  [org.jboss.as.naming] JBAS011800: Activating Naming Subsystem
     
    10:41:18,082 INFO  [org.jboss.as.clustering.infinispan] JBAS010280: Activating I
    nfinispan subsystem.
    10:41:18,252 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log han
    dlers
    10:41:19,664 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408:
     Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
    10:41:19,694 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC se
    rvice thread 1-2) JBoss Web Services - Stack CXF Server 4.0.2.GA
    10:41:19,724 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS01
    5400: Bound mail session [java:jboss/mail/Default]
    10:41:19,794 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread
     1-1) DÚmarrage de Coyote HTTP/1.1 sur http--127.0.0.1-8080
    10:41:19,814 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread
    1-2) JBAS015012: Started FileSystemDeploymentService for directory C:\Documents
    and Settings\user\Bureau\TestJPA\jboss-as-7.1.1.Final\standalone\deployments
    10:41:20,045 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100:
    Listening on /127.0.0.1:9999
    10:41:20,095 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100:
    Listening on /127.0.0.1:4447
    10:41:20,445 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service
    thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
    10:41:20,686 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774
    : Service status report
    JBAS014775:    New missing/unsatisfied dependencies:
          service jboss.jdbc-driver.derbyclient_jar (missing) dependents: [service j
    boss.data-source.java:/DerbyDS]
     
    10:41:20,736 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBA
    S015876: Starting deployment of "derby.jar"
    10:41:20,736 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBA
    S015876: Starting deployment of "derbyclient.jar"
    10:41:20,736 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBA
    S015876: Starting deployment of "derbynet.jar"
    10:41:20,756 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBA
    S015876: Starting deployment of "derbytools.jar"
    10:41:20,856 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derby.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jbo
    ss-as-7.1.1.Final/bin/content/derbynet.jar"  does not point to a valid jar for a
     Class-Path reference.
    10:41:21,026 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_cs.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a val
    id jar for a Class-Path reference.
    10:41:21,036 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_de_DE.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a
    valid jar for a Class-Path reference.
    10:41:21,036 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_es.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a val
    id jar for a Class-Path reference.
    10:41:21,116 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_fr.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a val
    id jar for a Class-Path reference.
    10:41:21,116 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_hu.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a val
    id jar for a Class-Path reference.
    10:41:21,126 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_it.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a val
    id jar for a Class-Path reference.
    10:41:21,126 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_ja_JP.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a
    valid jar for a Class-Path reference.
    10:41:21,126 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_ko_KR.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a
    valid jar for a Class-Path reference.
    10:41:21,136 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_pl.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a val
    id jar for a Class-Path reference.
    10:41:21,146 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_pt_BR.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a
    valid jar for a Class-Path reference.
    10:41:21,156 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_ru.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a val
    id jar for a Class-Path reference.
    10:41:21,166 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_zh_CN.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a
    valid jar for a Class-Path reference.
    10:41:21,166 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_zh_TW.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbyclient.jar"  does not point to a
    valid jar for a Class-Path reference.
    10:41:21,176 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_cs.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid jar
     for a Class-Path reference.
    10:41:21,176 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_de_DE.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid
    jar for a Class-Path reference.
    10:41:21,186 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_es.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid jar
     for a Class-Path reference.
    10:41:21,186 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_fr.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid jar
     for a Class-Path reference.
    10:41:21,196 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_hu.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid jar
     for a Class-Path reference.
    10:41:21,196 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_it.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid jar
     for a Class-Path reference.
    10:41:21,196 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_ja_JP.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid
    jar for a Class-Path reference.
    10:41:21,206 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_ko_KR.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid
    jar for a Class-Path reference.
    10:41:21,216 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_pl.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid jar
     for a Class-Path reference.
    10:41:21,226 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_pt_BR.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid
    jar for a Class-Path reference.
    10:41:21,226 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_ru.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid jar
     for a Class-Path reference.
    10:41:21,236 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_zh_CN.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid
    jar for a Class-Path reference.
    10:41:21,236 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Cla
    ss Path entry derbyLocale_zh_TW.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derby.jar"  does not point to a valid
    jar for a Class-Path reference.
    10:41:21,256 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_cs.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a vali
    d jar for a Class-Path reference.
    10:41:21,266 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_de_DE.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a v
    alid jar for a Class-Path reference.
    10:41:21,266 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_es.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a vali
    d jar for a Class-Path reference.
    10:41:21,266 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_fr.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a vali
    d jar for a Class-Path reference.
    10:41:21,276 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_hu.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a vali
    d jar for a Class-Path reference.
    10:41:21,276 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_it.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a vali
    d jar for a Class-Path reference.
    10:41:21,357 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_ja_JP.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a v
    alid jar for a Class-Path reference.
    10:41:21,357 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_ko_KR.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a v
    alid jar for a Class-Path reference.
    10:41:21,367 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_pl.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a vali
    d jar for a Class-Path reference.
    10:41:21,367 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_pt_BR.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a v
    alid jar for a Class-Path reference.
    10:41:21,367 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_ru.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a vali
    d jar for a Class-Path reference.
    10:41:21,447 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_zh_CN.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a v
    alid jar for a Class-Path reference.
    10:41:21,447 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-2) Cla
    ss Path entry derbyLocale_zh_TW.jar in "/C:/Documents and Settings/user/Bureau/TestJPA/jboss-as-7.1.1.Final/bin/content/derbytools.jar"  does not point to a v
    alid jar for a Class-Path reference.
    10:41:21,467 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1
    -1) JBAS010403: Deploying JDBC-compliant driver class org.apache.derby.jdbc.Clie
    ntDriver (version 10.8)
    10:41:21,507 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service
    thread 1-1) JBAS010400: Bound data source [java:/DerbyDS]
    10:41:21,757 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1
    -2) JBAS010403: Deploying JDBC-compliant driver class org.apache.derby.jdbc.Auto
    loadedDriver (version 10.8)
    10:41:21,767 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015951: Admin con
    sole listening on http://127.0.0.1:9990
    10:41:21,767 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015874: JBoss AS
    7.1.1.Final "Brontes" started in 6509ms - Started 220 of 304 services (82 servic
    es are passive or on-demand)
    10:41:21,877 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018
    559: Deployed "derbytools.jar"
    10:41:21,877 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018
    559: Deployed "derbynet.jar"
    10:41:21,877 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018
    559: Deployed "derbyclient.jar"
    10:41:21,887 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018
    559: Deployed "derby.jar"
    10:41:21,887 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBA
    S014774: Service status report
    JBAS014776:    Newly corrected services:
          service jboss.jdbc-driver.derbyclient_jar (no longer required)
    - Création d'un JPA-project avec le provider EclipseLink 2.3.2 et la connexion à ma base de données.

    - Modification du fichier persistence.xml de cette manière :
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
        <persistence-unit name="jpa-SocleIHM" transaction-type="JTA">
     
            <!-- Eclipse link JPA implementation -->
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
     
            <!-- Data source definition -->
            <jta-data-source>DerbyDS</jta-data-source>
     
            <properties>
                <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
            </properties>
     
        </persistence-unit>
    </persistence>
    - Création d'une JPA Entity :
    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
    package entity;
     
    import java.io.Serializable;
    import java.lang.String;
    import javax.persistence.*;
     
    @Entity(name="test")
    @Table(name="test")
    public class Test implements Serializable {
     
     
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private long id;
        private String nom;
        private static final long serialVersionUID = 1L;
     
        public Test() {
            super();
        }   
        public long getId() {
            return this.id;
        }
     
        public void setId(long id) {
            this.id = id;
        }   
        public String getNom() {
            return this.nom;
        }
     
        public void setNom(String nom) {
            this.nom = nom;
        }
    }
    Lors de la création de l'entité, j'ai un message d'erreur
    Table "Test" cannot be resolved
    Je fais un clic-droit sur mon projet - JPA Tools - Generate Tables from Entities. Je m'attends donc à ce que ma table soit créée dans ma base de données et que le message d'erreur disparaisse mais :
    [EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
    [EL Severe]: Local Exception Stack:
    Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot acquire data source [DerbyDS].
    Internal Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:497)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:109)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:83)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:74)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:61)
    Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:103)
    ... 11 more

    Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot acquire data source [DerbyDS].
    Internal Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:517)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:83)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:74)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:61)
    Caused by: Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot acquire data source [DerbyDS].
    Internal Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:497)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:109)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
    ... 7 more
    Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:103)
    ... 11 more
    Ai-je oublié quelque chose ? Visiblement oui, d'après les messages d'erreur mais je ne vois pas trop...

    Merci

  2. #2
    Rédacteur/Modérateur
    Avatar de andry.aime
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    8 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

    Informations forums :
    Inscription : Septembre 2007
    Messages : 8 391
    Points : 15 059
    Points
    15 059
    Par défaut
    Bonjour,

    <jta-data-source>DerbyDS</jta-data-source>
    C'est quoi ton jndi? tu peux nous montrer sa déclaration dans le ressource du serveur? ça ne doit pas être:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <jta-data-source>jdbc/DerbyDS</jta-data-source>
    ?

    A+.

  3. #3
    Nouveau membre du Club
    Inscrit en
    Février 2012
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Février 2012
    Messages : 39
    Points : 29
    Points
    29
    Par défaut
    La déclaration se fait dans le Standalone.xml.
    Citation Envoyé par Hole_geek Voir le message
    voici un extrait du code du fichier Standalone.xml qui est généré :
    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
                    <datasource jta="false" jndi-name="java:/DerbyDS" pool-name="DerbyDS" enabled="true" use-ccm="false">
                        <connection-url>jdbc:derby://localhost:1527/DerbyDB</connection-url>
                        <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>
                        <driver>derbyclient.jar</driver>
                        <security>
                            <user-name>dev</user-name>
                            <password>dev</password>
                        </security>
                        <validation>
                            <validate-on-match>false</validate-on-match>
                            <background-validation>false</background-validation>
                        </validation>
                        <statement>
                            <share-prepared-statements>false</share-prepared-statements>
                        </statement>
                    </datasource>
    J'avais mis jdbc/DerbyDS mais le message d'erreur était exactement le même.

  4. #4
    Rédacteur/Modérateur
    Avatar de andry.aime
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    8 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

    Informations forums :
    Inscription : Septembre 2007
    Messages : 8 391
    Points : 15 059
    Points
    15 059
    Par défaut
    DerbyDs correspond à ton pool mais pas à ton datasource.
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    <jta-data-source>java:/DerbyDS</jta-data-source>

  5. #5
    Nouveau membre du Club
    Inscrit en
    Février 2012
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Février 2012
    Messages : 39
    Points : 29
    Points
    29
    Par défaut
    Je viens d'essayer et toujours la même chose...
    [EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461
    [EL Severe]: Local Exception Stack:
    Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot acquire data source [java:/DerbyDS].
    Internal Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:497)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:109)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:83)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:74)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:61)
    Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:385)
    at javax.naming.InitialContext.lookup(InitialContext.java:396)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:103)
    ... 11 more

    Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot acquire data source [java:/DerbyDS].
    Internal Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:517)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.perform(Main.java:83)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:74)
    at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:61)
    Caused by: Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot acquire data source [java:/DerbyDS].
    Internal Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at org.eclipse.persistence.exceptions.ValidationException.cannotAcquireDataSource(ValidationException.java:497)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:109)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
    ... 7 more
    Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:385)
    at javax.naming.InitialContext.lookup(InitialContext.java:396)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:103)
    ... 11 more
    ps : le test de connexion à la BD via la vue JDBC Datasources de l'interface d'administration du serveur JBoss répond positivement.

Discussions similaires

  1. Réponses: 3
    Dernier message: 08/04/2012, 23h02
  2. Générer les tables à partir des Entités
    Par dv-2008 dans le forum Plateformes (Java EE, Jakarta EE, Spring) et Serveurs
    Réponses: 0
    Dernier message: 26/12/2011, 00h04
  3. Réponses: 0
    Dernier message: 20/03/2011, 16h50
  4. [MySQL] Générer un MCD à partir des tables déjà existantes
    Par namstou3 dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 01/11/2007, 18h07
  5. Réponses: 3
    Dernier message: 23/01/2007, 08h14

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