3

I've spent a few days understanding this problem, but I have not come up with a solution. The following are posts that are having similar problems: Similar Post 1, Similar Post 2, Similar Post 3. I have tried some of the partial solutions there, but nothing has resolved the problem.

Problem

I'm developing a Google Web Application and using Hibernate for the persistence layer to connect to a Postgresql database. I run it in development mode with the built-in Jetty server that comes with the GWT Eclipse plugin. I have received some help from this post in configuring the Jetty server.

I have used the Hibernate Tools to reverse engineer and export the following:

  • Domain Code (.java)
  • Hibernate XML Mappings (.hbm.xml)
  • DAO code (.java)
  • Hibernate XML Configuration

These have all been exported to the src folder, and I've verified using the Hibernate Tool that the configurations are at least able to pull schema information.

Now the problem comes after the Jetty server starts running. As soon as you visit the site associated with the application, it reports the following errors in Eclipse's debug console:

    com.site.application.<reverse engineered DAO> getSessionFactory
    SEVERE: Could not locate SessionFactory in JNDI
    javax.naming.NameNotFoundException; remaining name 'SessionFactory'
        at org.mortbay.naming.NamingContext.lookup(NamingContext.java:578)
        at org.mortbay.naming.NamingContext.lookup(NamingContext.java:680)
        at org.mortbay.naming.local.localContextRoot.lookup(localContextRoot.java:164)
        at javax.naming.InitialContext.lookup(InitialContext.java:411)
        at com.site.application.<reverse engineered DAO>.getSessionFactory(<reverse engineered DAO>.java:31)

Ending with:

    [ERROR] 500 - POST <application path> (127.0.0.1) xxxx bytes

Please let me know if you need any more details. I did not want to inundate the page with debug information.

Environment

  • Ubuntu 12.04 LTS
  • Eclipse Juno 4.2 Build id: 20120614-1722
  • GWT SDK 2.4.0
  • Hibernate 4.0
  • Postgresql 9.1
Community
  • 1
  • 1
hulkmeister
  • 429
  • 1
  • 5
  • 15
  • 1
    At a glance this is an issue in your application configuration, way above the PostgreSQL/JDBC driver level. – Craig Ringer Oct 17 '12 at 04:14
  • @CraigRinger: Would posting the hibernate.cfg.xml and web.xml files help? – hulkmeister Oct 17 '12 at 05:32
  • The environment is complex enough that I doubt posting random bits of it will help much. I don't work directly with Hibernate though (only via JPA), and only via JBoss AS 7 with container-managed JTA connections, so I can't be of much further help as the configuration mechanisms are completely different. – Craig Ringer Oct 17 '12 at 05:38
  • @CraigRinger: Thank you for the nudge. I think I may have found the solution to the problem. I'll come back with what happened after I test it. – hulkmeister Oct 17 '12 at 12:32
  • @CraigRinger: Unfortunately, I thought the problem was that I was using the Hibernate query incorrectly. I thought you needed a session.beginTransaction() to perform the query first, but it looks like that's not needed when the query is a select statement. – hulkmeister Oct 17 '12 at 16:19
  • Do you have a jetty-env.xml file with the JNDI setup? – Καrτhικ Jan 22 '13 at 13:36
  • @kabram No, I don't have the jetty-env. However, this problem seems to have resolved itself, but I am unsure which changes resolved the problem. – hulkmeister Jan 22 '13 at 15:33

0 Answers0