Menu

#2132 NPE in HibernateContext.prepareSession

v4.0
closed
nobody
Hibernate (3)
3
2004-12-29
2004-10-27
No

Hi,
this might be a pilot error ...

When I try to obtain a session like this:

Session =
HibernateContext.getSession("java:/hibernate/SessionFactory");

I get a NPE

Caused by: java.lang.NullPointerException
at
org.jboss.hibernate.session.HibernateContext.prepareSession(HibernateContext.java:171)
at
org.jboss.hibernate.session.HibernateContext.getSession(HibernateContext.java:99)
at
de.bsd.adb_hibernate.server.ServerFacade.beispiel(ServerFacade.java:22)

If I do it the classical way

InitialContext ic = new InitialContext();
Object o = ic.lookup("java:/hibernate/SessionFactory");
sf = (SessionFactory)o;

Session sess = sf.openSession()

it works as intended.

Discussion

  • Scott M Stark

    Scott M Stark - 2004-12-29
    • status: open --> closed
     
  • Scott M Stark

    Scott M Stark - 2004-12-29

    Logged In: YES
    user_id=175228

    All issues have been moved to http://jira.jboss.com. Existing
    issues have been moved. New issues will be closed with this
    canned reponse.

     

Log in to post a comment.