• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NPE hibernate session factory websphere portal

 
Ranch Hand
Posts: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a hibernate code snipped which works on websphere application server. However if I used the same hibernate code on websphere portal (6.0) I get the below stack trace:

line 99 of HibernateUtil.java:99 is

this.currentSession = sessionFactory.openSession();

==================================================================

7/12/08 18:03:34:844 IST 000000eb SystemErr R java.lang.NullPointerException
at au.gov.nsw.railcorp.common.service.util.HibernateUtil.openSession(HibernateUtil.java:99)
at au.gov.nsw.railcorp.common.service.BaseService.openHibernateSession(BaseService.java:14)
at au.gov.nsw.railcorp.healthassess.service.HaService.searchHA(HaService.java:213)
at au.gov.nsw.railcorp.healthassess.view.SearchHAView.uiSearch(SearchHAView.java:251)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:416)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at com.ibm.faces.webapp.WPFacesGenericPortlet.execute(WPFacesGenericPortlet.java:622)
at com.ibm.faces.webapp.WPFacesGenericPortlet.actionPerformed(WPFacesGenericPortlet.java:160)
at com.ibm.wps.pe.pc.legacy.SPIPortletInterceptorImpl.handleEvents(SPIPortletInterceptorImpl.java:323)
at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletDelegateImpl._dispatch(PortletDelegateImpl.java:378)
at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletDelegateImpl.access$200(PortletDelegateImpl.java:61)
at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletDelegateImpl$Context.callPortlet(PortletDelegateImpl.java:492)
at com.ibm.wps.pe.pc.legacy.services.PortletFilterServiceImpl.doFilter(PortletFilterServiceImpl.java:367)
at com.ibm.wps.pe.pc.legacy.services.PortletFilter.doFilter(PortletFilter.java:42)
at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletDelegateImpl.dispatch(PortletDelegateImpl.java:132)
at org.apache.jetspeed.portlet.Portlet.doPost(Portlet.java:505)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at com.ibm.wps.pe.pc.legacy.cache.CacheablePortlet.service(CacheablePortlet.java:120)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at org.apache.jetspeed.portlet.Portlet.service(Portlet.java:493)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:613)
at com.ibm.wps.pe.om.definition.impl.ServletDefinitionImpl$RDWrapper.include(ServletDefinitionImpl.java:406)
at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletInvokerImpl.callMethod(PortletInvokerImpl.java:374)
at com.ibm.wps.pe.pc.legacy.invoker.impl.PortletInvokerImpl.action(PortletInvokerImpl.java:82)
at com.ibm.wps.pe.pc.legacy.PortletContainerImpl.callPortletMethod(PortletContainerImpl.java:1129)
at com.ibm.wps.pe.pc.legacy.EventEnvironmentImpl.includePortlet(EventEnvironmentImpl.java:171)
at com.ibm.wps.pe.pc.legacy.event.ActionEventImpl.prepare(ActionEventImpl.java:201)
at com.ibm.wps.pe.pc.legacy.event.EventQueueManager.processEventLoop(EventQueueManager.java:87)
at com.ibm.wps.pe.pc.legacy.PortletContainerImpl.performEvents(PortletContainerImpl.java:214)
at com.ibm.wps.pe.pc.PortletContainerImpl.performEvents(PortletContainerImpl.java:241)
at com.ibm.wps.engine.phases.WPActionPhase.processPortlets(WPActionPhase.java:889)
at com.ibm.wps.engine.phases.WPActionPhase.execute(WPActionPhase.java:487)
at com.ibm.wps.state.phases.AbstractActionPhase.next(AbstractActionPhase.java:130)
at com.ibm.wps.engine.Servlet.callPortal(Servlet.java:788)
at com.ibm.wps.engine.Servlet.doGet(Servlet.java:629)
at com.ibm.wps.engine.Servlet.doPost(Servlet.java:814)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136)
at com.ibm.wps.state.filter.StateCleanup.doFilter(StateCleanup.java:86)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at com.ibm.wps.mappingurl.impl.URLAnalyzer.doFilter(URLAnalyzer.java:257)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2965)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1931)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:950)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:582)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext.handleAsyncComplete(SSLReadServiceContext.java:505)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext.read(SSLReadServiceContext.java:467)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext.read(SSLReadServiceContext.java:305)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.readyInboundPostHandshake(SSLConnectionLink.java:655)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyHandshakeCompletedCallback.complete(SSLConnectionLink.java:364)
at com.ibm.ws.ssl.channel.impl.SSLUtils.handleHandshake(SSLUtils.java(Compiled Code))
at com.ibm.ws.ssl.channel.impl.SSLHandshakeIOCallback.complete(SSLHandshakeIOCallback.java:70)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

The same code works on websphere application server 6.0.0.9

Thank you.
--Ayub
 
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems your sessionFactory is null, did you instantiate your sessionFactory?

Check how did you implement the HibernateUtil.java. Is there anything you obtained by using JNDI look up? Where did you put your hibernate.cfg.xml
file, if the path is correct?

In addition, Why not use sessionFactory.getCurrentSession()? By getting the session this way, you do not bother to close the session. Do not forget to config your hibernate.cfg.xml file when you want to use getCurrentSession().
[ December 17, 2008: Message edited by: damu liu ]
 
Ayub ali khan
Ranch Hand
Posts: 399
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you Damu, everything was proper, dont know why sessionFactory was being displayed as null. I was able to resolve the error by changing to datasource configuration with spring.

may be some issue about where I placed the config files.

Thank you
Ayub
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic