salut,

j'utilise eclipse et glassfish, sur CentOS(clone de redhat).

il s'agit d'eclipse helios avec l'adaptateur pour glazssfish 3.0.1.

j'ai créé à partir d'un livre des entities JPA dans un projet java, et un projet EJB contenu dans un projet EAR.


le projet EAR a des références sur le projet EJB et le projet JPA.

l'action de créer les tables à partir des entities marche bien.
mais quand je déploie l'EJB (qui contient des stateless beans avec leurs interfaces) j'ai l'erreur suivante:

************************************************************
cannot Deploy ear2
Deployment Error for module: ear2: Error occurred during deployment: Exception while loading the app : EJB Container initialization error. Please see server.log for more details.
PER01003: Deployment encountered SQL Exceptions:
PER01000: Got SQLException executing statement "CREATE TABLE t_category (ID BIGINT NOT NULL, DESCRIPTION VARCHAR(255) NOT NULL, NAME VARCHAR(30) NOT NULL, PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_category' already exists
PER01000: Got SQLException executing statement "CREATE TABLE t_product (ID BIGINT NOT NULL, DESCRIPTION VARCHAR(255) NOT NULL, NAME VARCHAR(30) NOT NULL, category_fk BIGINT NOT NULL, PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_product' already exists
PER01000: Got SQLException executing statement "CREATE TABLE t_item (ID BIGINT NOT NULL, image LONGBLOB, NAME VARCHAR(30) NOT NULL, unit_cost FLOAT NOT NULL, product_fk BIGINT NOT NULL, PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_item' already exists
PER01000: Got SQLException executing statement "CREATE TABLE t_customer (ID BIGINT NOT NULL, date_of_birth DATE, EMAIL VARCHAR(255), FIRSTNAME VARCHAR(30) NOT NULL, LASTNAME VARCHAR(30) NOT NULL, LOGIN VARCHAR(8) NOT NULL UNIQUE, PASSWORD VARCHAR(8) NOT NULL, TELEPHONE VARCHAR(255), address_fk BIGINT, PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_customer' already exists
PER01000: Got SQLException executing statement "CREATE TABLE t_address (ID BIGINT NOT NULL, CITY VARCHAR(100) NOT NULL, COUNTRY VARCHAR(50) NOT NULL, STATE VARCHAR(255), STREET1 VARCHAR(255) NOT NULL, STREET2 VARCHAR(255), zip_code VARCHAR(8) NOT NULL, PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_address' already exists
PER01000: Got SQLException executing statement "CREATE TABLE t_order (ID BIGINT NOT NULL, order_date DATE, credit_card_expiry_date VARCHAR(5), credit_card_number VARCHAR(30), credit_card_type VARCHAR(255), customer_fk BIGINT NOT NULL, address_fk BIGINT NOT NULL, PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_order' already exists
PER01000: Got SQLException executing statement "CREATE TABLE t_order_line (ID BIGINT NOT NULL, QUANTITY INTEGER NOT NULL, item_fk BIGINT NOT NULL, PRIMARY KEY (ID))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_order_line' already exists
PER01000: Got SQLException executing statement "CREATE TABLE t_order_order_line (order_fk BIGINT NOT NULL, order_line_fk BIGINT NOT NULL, PRIMARY KEY (order_fk, order_line_fk))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 't_order_order_line' already exists
PER01000: Got SQLException executing statement "ALTER TABLE t_product ADD CONSTRAINT FK_t_product_category_fk FOREIGN KEY (category_fk) REFERENCES t_category (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "ALTER TABLE t_item ADD CONSTRAINT FK_t_item_product_fk FOREIGN KEY (product_fk) REFERENCES t_product (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "ALTER TABLE t_customer ADD CONSTRAINT FK_t_customer_address_fk FOREIGN KEY (address_fk) REFERENCES t_address (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "ALTER TABLE t_order ADD CONSTRAINT FK_t_order_address_fk FOREIGN KEY (address_fk) REFERENCES t_address (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "ALTER TABLE t_order ADD CONSTRAINT FK_t_order_customer_fk FOREIGN KEY (customer_fk) REFERENCES t_customer (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "ALTER TABLE t_order_line ADD CONSTRAINT FK_t_order_line_item_fk FOREIGN KEY (item_fk) REFERENCES t_item (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "ALTER TABLE t_order_order_line ADD CONSTRAINT FK_t_order_order_line_order_fk FOREIGN KEY (order_fk) REFERENCES t_order (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "ALTER TABLE t_order_order_line ADD CONSTRAINT FK_t_order_order_line_order_line_fk FOREIGN KEY (order_line_fk) REFERENCES t_order_line (ID)": java.sql.SQLException: Can't create table 'base2.#sql-1e3b_fe' (errno: 121)
PER01000: Got SQLException executing statement "CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(38), PRIMARY KEY (SEQ_NAME))": com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'SEQUENCE' already exists
PER01000: Got SQLException executing statement "INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0)": com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'SEQ_GEN' for key 'PRIMARY'
************************************************************
les erreurs sont multiples : certaines car je n'ai pas vidé la base entre 2 déploiements (pas grave), et d'autres dues à une "erreur 121" dont je ne peux rien dire, je ne comprends pas.

j'ai créé un pool de connexion puis une datasource dans glassfish (le ping du pool marche).
voici le fichier persistence.xml:

************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
<persistence-unit name="jpa3">
<jta-data-source>jdbc/MyDS1</jta-data-source>
<class>entities.Category</class>
<class>entities.Product</class>
<class>entities.Item</class>
<class>entities.Customer</class>
<class>entities.Address</class>
<class>entities.Order</class>
<class>entities.OrderLine</class>
<class>entities.CreditCard</class>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
<property name="eclipselink.target-database" value="MySQL" />
<property name="eclipselink.logging.level" value="INFO" />
</properties>
************************************************************
pouvez-vous m'aider?

olivier