• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get data from database

 
bubu lina
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to load some data from db, using hibernate. It breaks when i call the dao service:

List<TestService> list = service.getTests(date);
calls the
public List<TestService> getTests(String date) {
return testDAO.getTestsDetails(date);
}

that calls the dao..

public List<TestService> getTestsDetails(final String date) {
final List<TestService> details = (List<TestService>) find("from TestServiceTb t where t.modified= '?"
+ date+ "'");

return details== null ? new LinkedList<TestService>() : details;
}



From my servlet controller, it goes to the bussiness logic (
public List<TestService> getTests(String date) {
return testDAO.getTestsDetails(date);
}
) and here it breaks...i get a null pointer exception...don't get why ....


DEBUG HibernateSessionInterceptor(doFilter:52) - ---> cleaning-up session for request [27841632]
ERROR StandardWrapperValve(invoke:260) - Servlet.service() for servlet TestServlet threw exception
java.lang.NullPointerException
at fr.test.services.business.Test.getTestsDetails(TestServiceImpl.java:36)
at fr.test.web.TestServlet.createLastDayLog(TestServlet .java:439)
at dfr.test.web.TestServlet.showSomething(TestServlet .java:417)
at fr.test.web.TestServlet.doPost(TestServlet .java:228)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at fr.test.hibernate.HibernateSessionInterceptor.doFilter(HibernateSessionInterceptor.java:50)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which line is it throwing on? The stack trace's line number isn't useful out-of-context.
 
bubu lina
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the error occurs in the bussines logic on return:
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the testDAO is most likely null.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on Servlets. For more information, please read this.

This post has been moved to a more appropriate forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic