-->
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.  [ 2 posts ] 
Author Message
 Post subject: NullPointer exception on closing Hibernate Session
PostPosted: Thu Jul 12, 2007 3:14 am 
Newbie

Joined: Fri Mar 18, 2005 8:54 am
Posts: 4
Hibernate version: Hibernate3-3.2.0

Full stack trace of any exception that occurs:
12:17:59,968 ERROR [SessionFactoryUtils] Unexpected exception on closing Hibernate Session
java.lang.NullPointerException
at org.hibernate.jdbc.AbstractBatcher.closeStatements(AbstractBatcher.java:310)
at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:376)
at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:318)
at org.hibernate.impl.SessionImpl.close(SessionImpl.java:298)
at org.springframework.orm.hibernate3.SessionFactoryUtils.doClose(SessionFactoryUtils.java:787)
at org.springframework.orm.hibernate3.SessionFactoryUtils.closeSessionOrRegisterDeferredClose(SessionFactoryUtils.java:775)
at org.springframework.orm.hibernate3.SessionFactoryUtils.releaseSession(SessionFactoryUtils.java:748)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCleanupAfterCompletion(HibernateTransactionManager.java:662)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:541)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:473)
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:267)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy52.getFlightAvailabilityAndPrice(Unknown Source)
at com.tg.delegate.FlightSearchDelegate.getAvailability(FlightSearchDelegate.java:100)
at com.tg.controller.FlightSearchController.processFormSubmission(FlightSearchController.java:239)
at org.springframework.web.servlet.mvc.AbstractFormController.handleInvalidSubmit(AbstractFormController.java:649)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:256)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:723)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:216)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:108)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:195)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
at com.tg.acegi.FilterProxy.doFilter(FilterProxy.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.acegisecurity.securechannel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:138)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)



Name and version of the database you are using: mysql 5

Problems with Session and transaction handling? yes

I am getting null pointer exception here. Please help me to fix it.

settings are following

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>/com/tg/hbm/User.hbm.xml</value> //other hbm xmls

</list>

</property>
</bean>

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>

<bean id= "hibernateSessionFactory" class="com.tg.hibernate.HibernateSessionFactory">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>

<bean id="tgBusinessServiceMgrTarget" class="com.tg.service.TGBusinessServiceMgrImpl">
<property name="pricingMgr">
<ref bean="flightPricingMgrImpl" />
</property>
<property name="flightAvailabilityMngr">
<ref bean="FlightAvailabilityMngr" />
</property>
<property name="paymentService">
<ref bean="paymentService" />
</property>
<property name="passengerManager">
<ref bean="passengerManager" />
</property>
<property name="flightBookingMgr">
<ref bean="flightBookingMgrImpl" />
</property>
<property name="pnrManager">
<ref bean="pnrManager" />
</property>
<property name="pnrUtil">
<ref bean="pnrUtil" />
</property>
<property name="smsAppMgr">
<ref bean="smsAppMgr" />
</property>
</bean>

<bean id="tgTxnManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>

<bean id="smsAppMgr" class="com.tg.sms.SMSAppMgrImpl">
<property name="smsDAO" ref="smsDAO"/>
</bean>

<bean id="tgBusinessServiceMgr"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="tgTxnManager"/>
<property name="target" ref="tgBusinessServiceMgrTarget"/>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

code in FlightSearchDelegate java class:

public FlightResult getAvailability(final FlightSearchReq flightRequestBean, HttpSession session)
throws Exception {

/** Check for getBean.... */
Map userInfoMap = new HashMap();
if(session != null){
Object userInfo = session.getAttribute(CommonSessionConstant.USER_INFO);
Object customerInfo = session.getAttribute(CommonSessionConstant.CUSTOMER_INFO);
userInfoMap.put(TGBusinessServiceConstants.USER_INFO, userInfo);
userInfoMap.put(TGBusinessServiceConstants.CUSTOMER_INFO, customerInfo);
}

FlightResult result = null;
try {
final List<FlightResult> flightResultList = this.tgBusinessServiceMgr
.getFlightAvailabilityAndPrice(flightRequestBean, userInfoMap);

if (flightResultList != null && flightResultList.size() > 0) {
result = convertToSingleFlightResult(flightResultList);
}

} catch (final Exception exception) {
TGLogger.error(this.getClass(), "getAvailability", exception);
throw exception;
}
return result;

}

code in TGBusinessServiceMgrImpl java class


/**
* @see com.tg.service.TGBusinessServiceMgr
* #getFlightAvailabilityAndPrice(com.tg.ws.FlightSearchReq, java.util.Map)
*/
public List<FlightResult> getFlightAvailabilityAndPrice(
final FlightSearchReq flightSearchRequest, final Map auditInfo)
throws TGBizServiceException {

TGLogger.debug(this.getClass(), "getFlightAvailabilityAndPrice", "START");
final DurationEvent event = DurationEvent.fireStartMeasureEvent(this.getClass(),
"TGEngine:getFlightAvailabilityAndPrice", StringUtil.EMPTY_STRING);
List<FlightResult> flightResults = null;
try {
// Invoking the flight availability manager to serch for the available flights.
flightResults = this.flightAvailabilityMngr.getAvailability(flightSearchRequest);

// call pricing manager to calculate actual offer price by travel guru based on search.
if (flightResults != null) {
final int resultSize = flightResults.size();
for (int i = 0; i < resultSize; i++) {
final FlightResult currentResult = flightResults.get(i);

final List<Product> onwardFlights = currentResult.getOnwardJourneyResp();
final List<Product> validOnwardFlights = getValidFlightList(onwardFlights);
currentResult.setOnwardJourneyResp(validOnwardFlights);
if (validOnwardFlights != null
&& validOnwardFlights.size() > 0) {
pricingMgr.getGrossFare(validOnwardFlights, auditInfo);

}

final List<Product> returnFlights = currentResult.getReturnJourneyResp();
final List<Product> validReturnFlights = getValidFlightList(returnFlights);
currentResult.setReturnJourneyResp(validReturnFlights);
if (validReturnFlights != null
&& validReturnFlights.size() > 0) {
pricingMgr.getGrossFare(validReturnFlights, auditInfo);
}

}
}
} catch (Exception exception) {
TGLogger
.error(this.getClass(), "getFlightAvailabilityAndPrice", exception.getMessage());
throw new TGBizServiceException(exception);
}
DurationEvent.fireEndMeasureEvent(event);
TGLogger.debug(this.getClass(), "getFlightAvailabilityAndPrice", "END");

return flightResults;
}

Please help me

Thanks in advance

_________________
Ashish Nath Jha


Last edited by Ashish Jha on Mon Jul 16, 2007 5:45 am, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 12, 2007 12:47 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
What's the code look like here?

at com.tg.delegate.FlightSearchDelegate.getAvailability(FlightSearchDelegate.java:100)


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

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.