-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibenate + Struts
PostPosted: Fri May 13, 2005 7:53 pm 
Newbie

Joined: Thu May 12, 2005 2:24 pm
Posts: 7
Trying to get hibernate working w/ struts. Followed the instructions here for the plugin:

http://www.hibernate.org/105.html

hibernate.cfg.xml :
Code:
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory name="java:/hibernate/SessionFactory">

        <property name="connection.datasource">java:/CummingsDB</property>
       
        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>
       
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
   
        <property name="hbm2ddl.auto">update</property>
       
        <mapping resource="Trailers.hbm.xml"/>
      <mapping resource="TrailerSales.hbm.xml"/>
      <mapping resource="Customers.hbm.xml"/>
      <mapping resource="Makes.hbm.xml"/>
      <mapping resource="Provinces.hbm.xml"/>
      <mapping resource="Countries.hbm.xml"/>
    </session-factory>

</hibernate-configuration>


I'm trying to instantiate like this :

Code:
   SessionFactory sf = null;
   Session session = null;
   
      Context ctx;
      try {
         ctx = new InitialContext();
         sf = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
         session = sf.openSession();   
      } catch (NamingException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }   
   }


I just get null pointer exception:

java.lang.NullPointerException
org.apache.jsp.inventoryForm_jsp._jspService(org.apache.jsp.inventoryForm_jsp:122)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.