0 Replies Latest reply on May 14, 2012 6:37 AM by choupi

    Generate Tables from entities (Eclipse - Jboss - Derby)

    choupi

      Hi,

       

      I try to use JPA-Project with Eclipse Indigo, Jboss as 7.1.1, Derby and EclipseLink 2.3.2.

       

      I'll start by explaining what I did before going out my problem :

       

      - Create Database DerbyDB with Data Source Explorer  from Eclipse.

       

      - I inserted the library derbyclient.jar in the folder Standalone/Deployments from JBoss

       

      - i created (and activated) a new DataSource (with the JBoss management localhost:8080)

      Here is an excerpt of the code file Standalone.xml that is generated :

       <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>
      

       

      - launch the server JBoss with Standalone.bat :

      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)

       

      - Create JPA-project with provider EclipseLink 2.3.2 and with the connection to my DataBase.

       

      - Changing the persistence.xml file in this way :

       

      <?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>

       

      - Create JPA Entity :

      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;
           }
      }

       

      When creating the entity, I have an error message"Table "Test" cannot be resolved". I right-clickon my project - JPA Tools - Generate Tables from Entities. I expect that my table is created in my database and the error message disappears but :

      [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

       

      Did I miss something?

       

      Thanks a lot