grails-samples / grails-petclinic

The introductory sample application for Grails
68 stars 93 forks source link

No tables created #23

Open gentunian opened 10 years ago

gentunian commented 10 years ago

I've cloned the repo and I get an error:

[host] ~ JAVA_HOME=/etc/alternatives/java_sdk ./grailsw run-app 
| Running Grails application
| Error 2014-09-01 17:26:46,182 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table pet drop constraint FK_98le5nat0hd479mg10eua8xn0 if exists
| Error 2014-09-01 17:26:46,184 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "PET" not found; SQL statement:
    alter table pet 
        drop constraint FK_98le5nat0hd479mg10eua8xn0 if exists [42102-176]
| Error 2014-09-01 17:26:46,185 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table pet drop constraint FK_f265r1o5eddpmock5mflwfywl if exists
| Error 2014-09-01 17:26:46,185 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "PET" not found; SQL statement:
    alter table pet 
        drop constraint FK_f265r1o5eddpmock5mflwfywl if exists [42102-176]
| Error 2014-09-01 17:26:46,185 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table vet_speciality drop constraint FK_obpuagylkoe92jbh89228tfam if exists
| Error 2014-09-01 17:26:46,186 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "VET_SPECIALITY" not found; SQL statement:
    alter table vet_speciality 
        drop constraint FK_obpuagylkoe92jbh89228tfam if exists [42102-176]
| Error 2014-09-01 17:26:46,186 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table vet_speciality drop constraint FK_2y6r6dv8pf8b3fxvwek33exqy if exists
| Error 2014-09-01 17:26:46,186 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "VET_SPECIALITY" not found; SQL statement:
    alter table vet_speciality 
        drop constraint FK_2y6r6dv8pf8b3fxvwek33exqy if exists [42102-176]
| Error 2014-09-01 17:26:46,187 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table visit drop constraint FK_ifoofk96i1wm1ck2eu2518ehq if exists
| Error 2014-09-01 17:26:46,187 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "VISIT" not found; SQL statement:
    alter table visit 
        drop constraint FK_ifoofk96i1wm1ck2eu2518ehq if exists [42102-176]
| Parent process shutdown. Exiting...
| Error Forked Grails VM exited with error
| Server running. Browse to http://localhost:8080/petclinic
[host] ~   netstat -lptun | grep 8080
[host] ~

No server running. Did I miss something from README.md? DB scripts or something?

gentunian commented 10 years ago

Hey folks... I really wanted to try grails, but you seem not interested in that. From the grails site:

Simply unpack the zip file and run either ./grailsw run-app (Unix-like systems)

It isn't working at all. No configuration info was provided. Isn't it supposed to work out-of-the-box? Do I need to create the tables?

Hope to hear something from you, regards

caseyscarborough commented 10 years ago

Those error messages appear to be an issue with Hibernate 4 and the H2 in-memory database, but it doesn't stop the application from running.

Does the application start if you make the following change in the grails-app/conf/BuildConfig.groovy file?

// Change this line:
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],

// To this:
run: false,

Then run:

$ ./grailsw clean
$ ./grailsw run-app
jeffscottbrown commented 10 years ago

I don't know why your server is exiting right away but I am not sure that it is related to the error messages related to dropping constraints. When I run the app on OS X I do see the error messages about dropping constraints but the app works. I can verify that not only be interacting with the app but also by looking at the database and/or turning SQL logging on. Tables are in fact created and the app is functioning as designed. The errors about dropping constraints should be addressed, but they don't appear to be problematic in a way that prevents that app from functioning.

gentunian commented 10 years ago

The errors are about inexistent tables. I've tried what @caseyscarborough said without luck. The only difference is that after executing the command is not returning to prompt and the server seems to be running:

| Running Grails application
| Error 2014-09-21 22:36:41,787 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table pet drop constraint FK_98le5nat0hd479mg10eua8xn0 if exists
| Error 2014-09-21 22:36:41,789 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "PET" not found; SQL statement:

    alter table pet 
        drop constraint FK_98le5nat0hd479mg10eua8xn0 if exists [42102-176]
| Error 2014-09-21 22:36:41,789 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table pet drop constraint FK_f265r1o5eddpmock5mflwfywl if exists
| Error 2014-09-21 22:36:41,789 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "PET" not found; SQL statement:

    alter table pet 
        drop constraint FK_f265r1o5eddpmock5mflwfywl if exists [42102-176]
| Error 2014-09-21 22:36:41,790 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table vet_speciality drop constraint FK_obpuagylkoe92jbh89228tfam if exists
| Error 2014-09-21 22:36:41,790 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "VET_SPECIALITY" not found; SQL statement:

    alter table vet_speciality 
        drop constraint FK_obpuagylkoe92jbh89228tfam if exists [42102-176]
| Error 2014-09-21 22:36:41,790 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table vet_speciality drop constraint FK_2y6r6dv8pf8b3fxvwek33exqy if exists
| Error 2014-09-21 22:36:41,791 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "VET_SPECIALITY" not found; SQL statement:

    alter table vet_speciality 
        drop constraint FK_2y6r6dv8pf8b3fxvwek33exqy if exists [42102-176]
| Error 2014-09-21 22:36:41,791 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table visit drop constraint FK_ifoofk96i1wm1ck2eu2518ehq if exists
| Error 2014-09-21 22:36:41,791 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Table "VISIT" not found; SQL statement:

    alter table visit 
        drop constraint FK_ifoofk96i1wm1ck2eu2518ehq if exists [42102-176]
| Server running. Browse to http://localhost:8080/petclinic

# netstat -lptun | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      2830/java   

But:

Firefox can't establish a connection to the server at localhost:8080.

I'm puzzled with the sample...