• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Postgres With WildFly - Missing Table  RSS feed

 
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

My application is using Spring/Hibernate with Postgres on WildFly.

I have configured a datasource which is pointing to a test (testdb) database in Postgres.
Verified that the configuration is good by performing a "Test Connection"
from Datasource details under the "Configuration" tab.


I have also created a few tables and populated them. Granted all privileges to the postgres user.

When I ran up the application, I am getting the error


My understanding was that the "org.h2...." package is used when using the WildFly's in memory database.

In my mind, it seems I have not correctly configured WildFly to use my local instance of Postgres and
hence not finding "MyTable".

So looking for advice as to configuration that I may have missed and/or other suggestions that will help me overcome
the table not found error.

I am using Wildfly 8.2.0.

Many thanks for any help
Pete
 
Sheriff
Posts: 21744
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How have you declared the datasource in your code?
 
Pete Long
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob

Yes , it is picked up via the JNDI name defined in the standalone-full.xml file.

Pete

 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the relevant code where you are looking up the datasource, getting a connection and then firing that query. Also post the relevant persistence.xml or the hibernate configuration that you are using (guessing by the stacktrace).
 
Pete Long
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran,

Below is an example of my codebase which I hope will give you an idea of my implementation and more hopefully you
maybe able to provide a suggestion/explantion as to why the "My_TABLE" database table is not visible.

I am pretty sure dao,domain, spring beans are all good.

My concerns are :-
  • Around steps to create the database and its table.
    MY_TABLE is created is under testdb -> Schemas -> public -> tables... is this correct ?


  • There is some WildFly configuration file which is needed that I am not aware of and not setting.
    Do you think I have missed to set/configure something ?



  • In the stacktrace shown in my original post, it shows "org.h2...." package which would be WildFly's in memory database.
    Is my understanding correct and if so, why would this be the case, as I am using postgres.


  • Will very much appreciate any help you can provide me.

    Many Thanks
    Pete


    Hibernate Configuration File





    Spring Datasource



    Define the session factory



    Define the DAO bean



    DAO Class



    Domain Class




    Hibernate Mapping file - MyDetail.hbm.xml




    Reading the Database table




    WildFly - standalone-full.xml - configure datasource




    Creating database and table in Postgres



    This creates a testdb database in local postgres installation under "Databases".

    The table appears under testdb -> Schemas -> public -> tables

    Owner of database is "postgres"

     
    Pete Long
    Greenhorn
    Posts: 19
    1
    • Likes 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi
    I happened to look at this link
    http://www.coderanch.com/t/648612/JBoss/JBoss-eap-standalone-full-xml

    This was interesting as it highlighted the need for me to add my postgres driver detail under the <drivers> element in standalone-full.xml.

    Adding this detail seems to have fixed this issue.

    Pete
     
    Rob Spoor
    Sheriff
    Posts: 21744
    102
    Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks for sharing the solution
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!