ejb@glassfish.java.net

RE: TopLink/PostGres table creation issues...

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Mon, 20 Oct 2008 17:41:06 +0100

Hi Drayton,
 
If it pings from the admin console then try dropping all your tables and recreating them.
 
You can do this by changing this:
 
   <property name="toplink.ddl-generation" value="create-tables"/>
 
the value to drop and create in your persistence unit.
 
Once it drops and creates, change it back to just create-tables.
 
It's easier to edit your persistence unit file with Netbeans.
 
Sometimes it works by deploying it more than once.
 
eve



Date: Sun, 19 Oct 2008 02:27:28 +0100From: draytonbrown_at_gmail.comTo: persistence_at_glassfish.dev.java.netSubject: TopLink/PostGres table creation issues...
Hi

I've been using Glassfish for a while now at work and I've found it such a pleasure to work with that when I decided to start putting together my own web site I opted for it!

Unfortunately though I cannot say that the experience with it in my personal endeavours has been as good, and I would greatly appreciate any input that may help to put me back on track again.

Ok, so this is what has happened so far...

On my laptop running Vista business I have:

Installed a fresh copy of Netbeans 6.1.
Installed a fresh copy of Postgres 8.3.3.1



I then placed a copy of the following files:
toplink-essentials.jar
toplink-essentials-agent.jar

into the following directory:
C:\Program Files\glassfish-v2ur2\lib

I have also placed a copy of the following file:
postgresql-8.3-603.jdbc3

into the following directories:
C:\Program Files\glassfish-v2ur2\lib
C:\Program Files\glassfish-v2ur2\domains\domain1\lib
C:\Program Files\glassfish-v2ur2\domains\domain1\lib\ext
(bit of overkill I thought, but I'm desperate!)
I created a database using Postgres.
I then created a new Web Application in Netbeans, and used the code generator to create entity classes from the Postgres database I created. During this I have had to create a persistence unit, which I did. The persistence.xml file which was created looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
  <persistence-unit name="WebApplication3PU" transaction-type="JTA">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>jdbc/postgres</jta-data-source>
    <properties>
      <property name="toplink.ddl-generation" value="create-tables"/>
    </properties>
  </persistence-unit>
</persistence>

The entity classes are created as expected.

Up till this point everything works as expected. The thing I want to do is to be able to deploy the web application to the Glassfish server and have it create the database tables while it does this. I know this sounds a little silly as I have used the tables to generate the classes, but the idea is that in future I will be deploying to a live environment and not my test machine. Unfortunately though when I deploy the application new tables are not created (I have tried removing a table in order to verify that the table creation is taking place). I do not even get any error messages for this so I'm finding it really hard to debug. The only logging I get are as follows:


init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
In-place deployment at C:\Users\Drayton\Documents\NetBeansProjects\WebApplication3\build\web
Start registering the project's server resources
Finished registering server resources
moduleID=WebApplication3
deployment started : 0%
deployment finished : 100%
Deploying application in domain completed successfully
Trying to create reference for application in target server completed successfully
Trying to start application in target server completed successfully
Deployment of application WebApplication3 completed successfully
Enable of WebApplication3 in target server completed successfully
Enable of application in all targets completed successfully
All operations completed successfully
run-deploy:
BUILD SUCCESSFUL (total time: 1 second)


And from Glassfish:


deployed with moduleid = WebApplication3

The application is deployed though. I have checked the application and found it listed in the appropriate place.
I have also ensured that the jta-data-source (jdbc/postgres) is correctly setup in the application server, by ensuring that I am able to 'ping' it from the Glassfish admin web console.
I have also ensured that user credentials being used have all the required rights to the database (infact I have resorted to granting all access to the user I am now using!)


I have also tried using a sun-resources.xml file to configure the jta-data-source on the application server, but this has had no effect either.

I'm now completely stuck, and extremely desperate! So please, please could someone please help me!

Desperate
Drayton Brown

PS. Your response is eagerly anticipated!
_________________________________________________________________
See the most popular videos on the web
http://clk.atdmt.com/GBL/go/115454061/direct/01/