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

Glassfish et Payara Java Discussion :

annotations JPA -> tables créées mais pas peuplées lors du déploiement


Sujet :

Glassfish et Payara Java

  1. #1
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut annotations JPA -> tables créées mais pas peuplées lors du déploiement
    bonjour,

    j'ai essayé d'être complet dans le titre, alors voilà: j'ai des pojos annotés JPA, et lorsque je déploie le projet glassfish, les tables sont créées, voir photo1.
    mais lors du déploiement toujours, un message d'erreur m'avertit que la base ne peut être créée. peut-être que le nom du schéma n'est pas le bon (c'est ADMIN et je ne sais pas d'où cela vient).

    le fichier de persistance:

    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="petstorePU" transaction-type="JTA">
    <jta-data-source>jdbc/petstoreDS</jta-data-source>
    <properties>
    <property name="toplink.target-database" value="Derby"/>
    <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    <property name="toplink.create-ddl-jdbc-file-name" value="drop.sql"/>
    <property name="toplink.logging.level" value="finest"/>

    </properties>
    </persistence-unit>
    </persistence>
    le fichier build.xml (le + intéressant est tout à la fin:

    <?xml version="1.0"?>



    <project name="Petstore" default="core">



    <property name="application.name" value="petstore"/>



    <!-- =================================================================== -->

    <!-- Variables -->

    <!-- =================================================================== -->

    <property name="home.dir" value="."/>

    <property name="barkbank.home" value="${home.dir}/BarkBank"/>

    <property name="petex.home" value="${home.dir}/PetEx"/>
    <!-- <property name="yaps.home" value="${home.dir}/Yaps"/>-->
    <property name="yaps.home" value="${home.dir}"/>

    <property name="env.GLASSFISH_HOME" location="/Users/oliviersaint-eve/Documents/glassfish"/>


    <!--YAPS Properties-->

    <property name="yaps.build.dir" value="${yaps.home}/build"/>

    <property name="yaps.config.dir" value="${yaps.home}/config"/>

    <property name="yaps.src.dir" value="${yaps.home}/src"/>

    <property name="yaps.web.dir" value="${yaps.home}/resources"/>

    <property name="yaps.web-inf.dir" value="${yaps.home}/WebContent/WEB-INF"/>

    <property name="yaps.generated.src.dir" value="${yaps.home}/generated"/>

    <property name="yaps.classes.dir" value="${yaps.home}/classes/production"/>

    <property name="yaps.lib.dir" value="${yaps.home}/lib"/>



    <!--BarkBank Properties-->

    <property name="barkbank.build.dir" value="${barkbank.home}/build"/>

    <property name="barkbank.src.dir" value="${barkbank.home}/src"/>

    <property name="barkbank.web.dir" value="${barkbank.home}/resources"/>

    <property name="barkbank.web-inf.dir" value="${barkbank.home}/WEB-INF"/>

    <property name="barkbank.generated.src.dir" value="${barkbank.home}/generated"/>

    <property name="barkbank.classes.dir" value="${barkbank.home}/classes/production"/>



    <!--PetEx Properties-->

    <property name="petex.build.dir" value="${petex.home}/build"/>

    <property name="petex.src.dir" value="${petex.home}/src"/>

    <property name="petex.web.dir" value="${petex.home}/resources"/>

    <property name="petex.web-inf.dir" value="${petex.home}/WEB-INF"/>

    <property name="petex.generated.src.dir" value="${petex.home}/generated"/>

    <property name="petex.classes.dir" value="${petex.home}/classes/production"/>





    <!-- =================================================================== -->

    <!-- Fichier -->

    <!-- =================================================================== -->

    <!--YAPS Files-->

    <property name="yaps.client.jar" value="${yaps.build.dir}/${application.name}.jar"/>

    <property name="yaps.utility.jar" value="${yaps.build.dir}/lib/utility.jar"/>

    <property name="yaps.ws.jar" value="${yaps.build.dir}/lib/ws-interface.jar"/>

    <property name="yaps.entity.jar" value="${yaps.build.dir}/lib/entity.jar"/>

    <property name="yaps.mdb.jar" value="${yaps.build.dir}/mdb.jar"/>

    <property name="yaps.stateless.jar" value="${yaps.build.dir}/stateless.jar"/>

    <property name="yaps.stateful.jar" value="${yaps.build.dir}/stateful.jar"/>

    <property name="yaps.war" value="${yaps.build.dir}/${application.name}.war"/>

    <property name="yaps.ear" value="${yaps.build.dir}/${application.name}.ear"/>



    <!--BarkBank Files-->

    <property name="barkbank.war" value="${barkbank.build.dir}/barkbank.war"/>



    <!--PetEx Files-->

    <property name="petex.war" value="${petex.build.dir}/petex.war"/>





    <!-- =================================================================== -->

    <!-- Utilitaires -->

    <!-- =================================================================== -->

    <property environment="env"/>

    <property name="glassfish.home" value="${env.GLASSFISH_HOME}"/>

    <property name="glassfish.lib" value="${glassfish.home}/lib"/>

    <property name="derby.home" value="${glassfish.home}/javadb"/>

    <property name="derby.lib" value="${derby.home}/lib"/>

    <property name="asadmin" value="${glassfish.home}/bin/asadmin"/>

    <property name="wsgen" value="${glassfish.home}/bin/wsgen"/>

    <property name="wsimport" value="${glassfish.home}/bin/wsimport"/>

    <property name="echo" value="true"/>

    <property name="verifier" value="${glassfish.home}/bin/verifier"/>

    <property name="verifier.dir" value="${home.dir}/verifier"/>



    <!--Glassfish Properties-->

    <property name="server.user.name" value="admin"/>

    <property name="server.passwordfile" value="passwordfile"/>

    <property name="server.host" value="127.0.0.1"/>

    <property name="server.port" value="1081"/>

    <property name="server.admin.port" value="1049"/>



    <!--Database Properties-->

    <property name="db.host" value="127.0.0.1"/>

    <property name="db.sid" value="${application.name}DB"/>

    <property name="db.user" value="dbuser"/>

    <property name="db.password" value="dbpwd"/>

    <!--Derby-->

    <property name="db.port" value="1527"/>

    <property name="db.driver" value="org.apache.derby.jdbc.ClientDriver"/>

    <property name="db.url" value="jdbc:derby://${db.host}:${db.port}/${db.sid}"/>

    <!--MySQL-->
    <!--
    <property name="db.port" value="3306"/>

    <property name="db.driver" value="com.mysql.jdbc.Driver"/>

    <property name="db.url" value="jdbc:mysql://${db.host}:${db.port}/${db.sid}"/>
    -->




    <!-- =================================================================== -->

    <!-- Check variable -->

    <!-- =================================================================== -->

    <target name="check">

    <fail unless="env.GLASSFISH_HOME">

    ####

    #### You must install GlassFish V2 from https://glassfish.dev.java.net/publi...oadsindex.html

    #### And set the GLASSFISH_HOME variable

    </fail>

    </target>





    <!-- =================================================================== -->

    <!-- Classes et Jars utiliser pour compiler et executer l'application -->

    <!-- =================================================================== -->

    <path id="classpath">

    <pathelement location="${glassfish.lib}/appserv-deployment-client.jar"/>

    <pathelement location="${glassfish.lib}/appserv-rt.jar"/>

    <pathelement location="${glassfish.lib}/webservices-rt.jar"/>

    <pathelement location="${glassfish.lib}/appserv-admin.jar"/>

    <pathelement location="${glassfish.lib}/javaee.jar"/>

    <pathelement location="${glassfish.lib}/toplink-essentials-agent.jar"/>

    <pathelement location="${glassfish.lib}/toplink-essentials.jar"/>

    <pathelement location="${glassfish.lib}/install/applications/jmsra/imqjmsra.jar"/>

    <pathelement location="${glassfish.lib}/jigloo.jar"/>

    <!--Derby-->


    <pathelement location="${derby.lib}/derbyclient.jar"/>

    <!--MySQL-->
    <!--
    <pathelement location="${glassfish.lib}/mysql-connector-java-5.1.7-bin.jar"/>
    -->
    </path>

    <pathconvert pathsep="${line.separator}" property="convert.classpath" refid="classpath"/>





    <path id="yaps-classpath">

    <pathelement location="${yaps.classes.dir}"/>

    <pathelement location="${yaps.lib.dir}/vstm-xscore-0.5.0.jar"/>

    <pathelement location="${yaps.lib.dir}/commons-lang-2.3.jar"/>

    </path>

    <pathconvert pathsep="${line.separator}" property="convert.yaps-classpath" refid="yaps-classpath"/>



    <path id="barkbank-classpath">

    <pathelement location="${barkbank.classes.dir}"/>

    </path>

    <pathconvert pathsep="${line.separator}" property="convert.barkbank-classpath" refid="barkbank-classpath"/>



    <path id="petex-classpath">

    <pathelement location="${petex.classes.dir}"/>

    </path>

    <pathconvert pathsep="${line.separator}" property="convert.petex-classpath" refid="petex-classpath"/>





    <!-- =================================================================== -->

    <!-- Suppression des repertoires de travail -->

    <!-- =================================================================== -->=================================================================== -->

    <!-- Compile le code source -->

    <!-- =================================================================== -->

    <target name="compile" depends="prepare">

    <antcall target="yaps-compile"/>

    <antcall target="barkbank-compile"/>

    <antcall target="petex-compile"/>

    </target>



    <!-- Compile YAPS -->

    <!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->

    <target name="yaps-compile" depends="yaps-prepare">

    <echo message="Compile the YAPS generated classes"/>

    <echo message="${convert.classpath}"/>

    <echo message="${convert.yaps-classpath}"/>

    <javac srcdir="${yaps.generated.src.dir}"

    destdir="${yaps.classes.dir}"

    deprecation="on">

    <classpath refid="classpath"/>

    <classpath refid="yaps-classpath"/>

    </javac>

    <echo message="Compile the YAPS classes"/>

    <javac srcdir="${yaps.src.dir}"

    destdir="${yaps.classes.dir}"

    deprecation="on">

    <compilerarg value="-Xlint:unchecked"/>

    <classpath refid="classpath"/>

    <classpath refid="yaps-classpath"/>

    </javac>

    </target>





    <!-- =================================================================== -->

    <!-- Build -->

    <!-- =================================================================== -->

    <target name="build" depends="compile">

    <antcall target="yaps-build"/>

    <antcall target="barkbank-build"/>

    <antcall target="petex-build"/>

    </target>



    <!-- Build YAPS -->

    <!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->

    <target name="yaps-build"

    depends="yaps-compile,yaps-build-client-jar,yaps-build-stateless-jar,yaps-build-stateful-jar,yaps-build-mdb-jar,yaps-build-entity-jar,yaps-build-utility-jar,yaps-build-ws-jar,yaps-build-war,yaps-build-ear"/>



    <target name="yaps-build-client-jar">

    <echo message="Creates the Client jar"/>

    <jar jarfile="${yaps.client.jar}">

    <fileset dir="${yaps.classes.dir}">

    <include name="com/yaps/petstore/client/**/*.class"/>

    <include name="com/yaps/petstore/entity/**/*.class"/>

    <include name="com/yaps/petstore/util/**/*.class"/>

    <include name="com/yaps/petstore/exception/**/*.class"/>

    <include name="com/yaps/petstore/stateless/**/*Remote.class"/>

    <include name="org/**/*.class"/>

    </fileset>

    </jar>

    </target>



    <target name="yaps-build-stateless-jar">

    <echo message="Creates the EJB Stateless jar"/>

    <jar jarfile="${yaps.stateless.jar}">

    <fileset dir="${yaps.classes.dir}">

    <include name="com/yaps/petstore/stateless/**/*.class"/>

    </fileset>

    </jar>

    </target>



    <target name="yaps-build-stateful-jar">

    <echo message="Creates the EJB Stateful jar"/>

    <jar jarfile="${yaps.stateful.jar}">

    <fileset dir="${yaps.classes.dir}">

    <include name="com/yaps/petstore/stateful/**/*.class"/>

    </fileset>

    </jar>

    </target>



    <target name="yaps-build-mdb-jar">

    <echo message="Creates the EJB MDB jar"/>

    <jar jarfile="${yaps.mdb.jar}">

    <fileset dir="${yaps.classes.dir}">

    <include name="com/yaps/petstore/mdb/**/*.class"/>

    </fileset>

    </jar>

    </target>



    <target name="yaps-build-entity-jar">

    <echo message="Creates the EJB Entity jar"/>

    <jar jarfile="${yaps.entity.jar}">

    <fileset dir="${yaps.classes.dir}">

    <include name="com/yaps/petstore/entity/**/*.class"/>

    </fileset>

    <fileset dir="${yaps.config.dir}">

    <include name="META-INF/persistence.xml"/>

    </fileset>

    </jar>

    </target>



    <target name="yaps-build-utility-jar">

    <echo message="Creates the Utility jar"/>

    <jar jarfile="${yaps.utility.jar}">

    <fileset dir="${yaps.classes.dir}">

    <include name="com/yaps/petstore/util/**/*.class"/>

    <include name="com/yaps/petstore/exception/**/*.class"/>

    </fileset>

    </jar>

    </target>



    <target name="yaps-build-ws-jar">

    <echo message="Creates the WebService jar"/>

    <jar jarfile="${yaps.ws.jar}">

    <fileset dir="${yaps.classes.dir}">

    <include name="com/barkbank/**/*.class"/>

    <include name="com/petex/**/*.class"/>

    </fileset>

    </jar>

    </target>



    <target name="yaps-build-war">

    <echo message="Creates the PetStore Web Application"/>

    <war destfile="${yaps.war}" webxml="${yaps.web-inf.dir}/web.xml">

    <fileset dir="${yaps.web.dir}">

    <include name="**/*.jsp"/>

    <include name="**/*.jspf"/>

    <include name="**/*.gif"/>

    <include name="**/*.jpg"/>

    <include name="**/*.css"/>

    </fileset>

    <webinf dir="${yaps.web-inf.dir}">

    <include name="faces-config.xml"/>

    </webinf>

    <classes dir="${yaps.classes.dir}">

    <include name="com/yaps/petstore/jsf/**/*.class"/>

    </classes>

    </war>

    </target>



    <target name="yaps-build-ear">

    <echo message="Creates the PetStore Enterprise Application"/>

    <delete file="${yaps.ear}"/>

    <jar jarfile="${yaps.ear}" basedir="${yaps.build.dir}" excludes="${application.name}.jar"/>

    </target>



    <target name="yaps-build-debug">

    <delete dir="${yaps.build.dir}"/>

    <mkdir dir="${yaps.build.dir}/lib"/>

    <antcall target="yaps-build-client-jar"/>

    <antcall target="yaps-build-stateless-jar"/>

    <antcall target="yaps-build-stateful-jar"/>

    <antcall target="yaps-build-mdb-jar"/>

    <antcall target="yaps-build-entity-jar"/>

    <antcall target="yaps-build-utility-jar"/>

    <antcall target="yaps-build-ws-jar"/>

    <antcall target="yaps-build-war"/>

    <antcall target="yaps-build-ear"/>

    </target>





    <!-- =================================================================== -->

    <!-- Deploiement des Application -->


    <!-- =================================================================== -->

    <target name="deploy">

    <antcall target="barkbank-build"/>

    <antcall target="barkbank-deploy"/>

    <antcall target="barkbank-generate-client-artifacts"/>

    <antcall target="petex-build"/>

    <antcall target="petex-deploy"/>

    <antcall target="petex-generate-client-artifacts"/>

    <antcall target="yaps-build"/>

    <antcall target="yaps-deploy"/>

    </target>



    <!-- Deploy YAPS -->

    <!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->

    <target name="yaps-deploy" depends="check">

    <echo message="Deploys the YAPS application"/>

    <exec executable="${asadmin}">

    <arg line="deploy"/>

    <arg line=" --echo=${echo}"/>

    <arg line=" --user ${server.user.name}"/>

    <arg line=" --passwordfile ${server.passwordfile}"/>

    <arg line=" --host ${server.host}"/>

    <arg line=" --port ${server.admin.port}"/>

    <arg line=" ${yaps.ear}"/>

    </exec>



    <antcall target="db-insert-data"/>

    </target>



    <!-- =================================================================== -->

    <!-- Undeploiement des Application -->

    <!-- =================================================================== -->

    <target name="undeploy">

    <antcall target="yaps-undeploy"/>

    <antcall target="barkbank-undeploy"/>

    <antcall target="petex-undeploy"/>

    </target>



    <!-- Undeploy YAPS -->

    <!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->

    <target name="yaps-undeploy" depends="check">

    <echo message="Undeploys the YAPS application"/>

    <exec executable="${asadmin}">

    <arg line="undeploy"/>

    <arg line=" --echo=${echo}"/>

    <arg line=" --user ${server.user.name}"/>

    <arg line=" --passwordfile ${server.passwordfile}"/>

    <arg line=" --host ${server.host}"/>

    <arg line=" --port ${server.admin.port}"/>

    <arg line=" ${application.name}"/>

    </exec>

    </target>




    <!-- =================================================================== -->

    <!-- Verifie les applications -->

    <!-- =================================================================== -->

    <target name="verify">

    <antcall target="yaps-verify"/>

    <antcall target="barkbank-verify"/>

    <antcall target="petex-verify"/>

    </target>



    <!-- Verifies YAPS -->

    <!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvv -->

    <target name="yaps-verify" depends="check">

    <mkdir dir="${verifier.dir}"/>

    <exec executable="${verifier}">

    <arg line=" -d ${verifier.dir}"/>

    <arg line=" ${yaps.ear}"/>

    </exec>

    </target>



    <!-- =================================================================== -->

    <!-- Autres -->

    <!-- =================================================================== -->

    <target name="show" depends="check">

    <exec executable="${asadmin}">

    <arg line="show-component-status"/>

    <arg line=" --echo=${echo}"/>

    <arg line=" --user ${server.user.name}"/>

    <arg line=" --passwordfile ${server.passwordfile}"/>

    <arg line=" --host ${server.host}"/>

    <arg line=" --port ${server.admin.port}"/>

    <arg line=" ${application.name}"/>

    </exec>

    </target>





    <!-- =================================================================== -->

    <!-- Execute l'application cliente -->

    <!-- =================================================================== -->

    <target name="run-client" depends="yaps-compile,yaps-build-client-jar">

    <echo message="Runs the client application"/>

    <java classname="com.yaps.petstore.client.ui.PetstoreFrame" fork="yes" dir=".">

    <classpath>

    <pathelement location="${yaps.client.jar}"/>

    <path refid="classpath"/>

    <path refid="yaps-classpath"/>

    </classpath>

    </java>

    </target>





    <!-- =================================================================== -->

    <!-- Insere des donnees dans la base -->

    <!-- =================================================================== -->

    <target name="db-insert-data">

    <sql src="${yaps.config.dir}/data.sql"

    driver="${db.driver}"

    url="${db.url}"

    userid="${db.user}"

    password="${db.password}">

    <classpath refid="classpath"/>

    </sql>

    </target>





    <!-- =================================================================== -->


    <!-- Main -->

    <!-- =================================================================== -->

    <target name="core" depends="clean,build"/>



    </project>
    j'ai coupé le fichier build.xml (il est trop long), en ne laissant que ce que je juge le + pertinent.

    le fichier data.sql contient des requêtes INSERT et un UPDATE à la fin.

    merci pour votre attention, d'avance,

    olivier.

  2. #2
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2006
    Messages
    958
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2006
    Messages : 958
    Points : 213
    Points
    213
    Par défaut
    j'ai trouvé! le pb venait du nom d'utilisateur qui n'est pas "dbuser" mais "admin" (ce qui était visible sur une des photos jointes).
    j'ai donc changé l'utilisateur, et le mot de passe et ça marche comme sur des roulettes!

    au fait, bonnes fêtes.

    olivier.

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

Discussions similaires

  1. [WS 2003] Nom netbios dans la table WINS mais pas "pingable"
    Par gagou7 dans le forum Windows Serveur
    Réponses: 4
    Dernier message: 19/12/2012, 11h13
  2. Image Swf Crée mais Pas visible.
    Par Jane Home dans le forum Web
    Réponses: 0
    Dernier message: 03/03/2010, 16h48
  3. Requete tables liées (mais pas toujours )
    Par camyo dans le forum Langage SQL
    Réponses: 2
    Dernier message: 09/02/2010, 13h14
  4. Champ présent dans une table Firebird mais pas dans TIBDataSet
    Par Mirmillon dans le forum Bases de données
    Réponses: 2
    Dernier message: 11/12/2007, 00h41
  5. Fiche créée mais pas reconnue par l'application ??
    Par Leesox dans le forum Langage
    Réponses: 8
    Dernier message: 30/10/2005, 15h10

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