• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate error

 
Pratik Parekh
Greenhorn
Posts: 21
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am getting following error

org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not inspect JDBC autocommit mode; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.; - nested throwable: (javax.resource.ResourceException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.); nested exception is org.jboss.util.NestedSQLException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.; - nested throwable: (javax.resource.ResourceException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)
at com.ew.esp.dao.impl.WindowDataProviderDaoImpl.persist(WindowDataProviderDaoImpl.java:78)
at com.ew.esp.service.impl.QuoteDBListener.update(QuoteDBListener.java:28)
at com.espertech.esper.core.StatementResultServiceImpl.processDispatch(StatementResultServiceImpl.java:221)
at com.espertech.esper.core.StatementResultServiceImpl.execute(StatementResultServiceImpl.java:197)
at com.espertech.esper.core.UpdateDispatchViewBase.execute(UpdateDispatchViewBase.java:75)
at com.espertech.esper.core.UpdateDispatchFutureSpin.execute(UpdateDispatchFutureSpin.java:85)
at com.espertech.esper.dispatch.DispatchServiceImpl.dispatchFromQueue(DispatchServiceImpl.java:57)
at com.espertech.esper.dispatch.DispatchServiceImpl.dispatch(DispatchServiceImpl.java:31)
at com.espertech.esper.core.EPRuntimeImpl.dispatch(EPRuntimeImpl.java:1053)
at com.espertech.esper.core.EPRuntimeImpl.processWrappedEvent(EPRuntimeImpl.java:411)
at com.espertech.esper.core.EPRuntimeImpl.processEvent(EPRuntimeImpl.java:380)
at com.espertech.esper.core.EPRuntimeImpl.sendEvent(EPRuntimeImpl.java:210)
at com.ew.esp.service.impl.StatementRepositoryImpl.sendEvent(StatementRepositoryImpl.java:59)
at com.ew.esp.service.impl.AbstractQuoteParser.sendQuote(AbstractQuoteParser.java:57)
at com.ew.esp.service.impl.FlatRatePremiumParser.parseQuote(FlatRatePremiumParser.java:31)
at com.ew.esp.service.impl.AbstractQuoteParser.update(AbstractQuoteParser.java:42)
at com.espertech.esper.core.StatementResultServiceImpl.processDispatch(StatementResultServiceImpl.java:221)
at com.espertech.esper.core.StatementResultServiceImpl.execute(StatementResultServiceImpl.java:197)
at com.espertech.esper.core.UpdateDispatchViewBase.execute(UpdateDispatchViewBase.java:75)
at com.espertech.esper.core.UpdateDispatchFutureSpin.execute(UpdateDispatchFutureSpin.java:85)
at com.espertech.esper.dispatch.DispatchServiceImpl.dispatchFromQueue(DispatchServiceImpl.java:57)
at com.espertech.esper.dispatch.DispatchServiceImpl.dispatch(DispatchServiceImpl.java:31)
at com.espertech.esper.core.EPRuntimeImpl.dispatch(EPRuntimeImpl.java:1053)
at com.espertech.esper.core.EPRuntimeImpl.processWrappedEvent(EPRuntimeImpl.java:411)
at com.espertech.esper.core.EPRuntimeImpl.processEvent(EPRuntimeImpl.java:380)
at com.espertech.esper.core.EPRuntimeImpl.sendEvent(EPRuntimeImpl.java:210)
at com.ew.esp.service.impl.StatementRepositoryImpl.sendEvent(StatementRepositoryImpl.java:59)
at com.ew.esp.service.impl.CommodityQuoteListener.update(CommodityQuoteListener.java:35)
at com.espertech.esper.core.StatementResultServiceImpl.processDispatch(StatementResultServiceImpl.java:221)
at com.espertech.esper.core.StatementResultServiceImpl.execute(StatementResultServiceImpl.java:197)
at com.espertech.esper.core.UpdateDispatchViewBase.execute(UpdateDispatchViewBase.java:75)
at com.espertech.esper.core.UpdateDispatchFutureSpin.execute(UpdateDispatchFutureSpin.java:85)
at com.espertech.esper.dispatch.DispatchServiceImpl.dispatchFromQueue(DispatchServiceImpl.java:57)
at com.espertech.esper.dispatch.DispatchServiceImpl.dispatch(DispatchServiceImpl.java:31)
at com.espertech.esper.core.EPRuntimeImpl.dispatch(EPRuntimeImpl.java:1053)
at com.espertech.esper.core.EPRuntimeImpl.processWrappedEvent(EPRuntimeImpl.java:411)
at com.espertech.esper.core.EPRuntimeImpl.processEvent(EPRuntimeImpl.java:380)
at com.espertech.esper.core.EPRuntimeImpl.sendEvent(EPRuntimeImpl.java:210)
at com.ew.esp.service.impl.StatementRepositoryImpl.sendEvent(StatementRepositoryImpl.java:59)
at com.ew.esp.service.impl.McxTcpSubscriber.pushData(McxTcpSubscriber.java:147)
at com.ew.esp.service.impl.McxTcpSubscriber.access$100(McxTcpSubscriber.java:26)
at com.ew.esp.service.impl.McxTcpSubscriber$3.run(McxTcpSubscriber.java:94)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.util.NestedSQLException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.; - nested throwable: (javax.resource.ResourceException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:210)
at $Proxy278.isClosed(Unknown Source)
at org.hibernate.jdbc.ConnectionManager.isAutoCommit(ConnectionManager.java:189)
at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:243)
at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:417)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1166)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:334)
at com.ew.esp.dao.impl.WindowDataProviderDaoImpl$3.doInHibernate(WindowDataProviderDaoImpl.java:80)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
... 46 more
Caused by: javax.resource.ResourceException: You are trying to use a connection factory that has been shut down: ManagedConnectionFactory is null.
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:487)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
... 56 more

so need to understand where is the problem and what is the solution for this.
Please help me .
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...You are trying to use a connection factory that has been shut down: ManagedConnectionFactory...

As the exception says, your connection factory may not have initialized or closed...You need to tell more details of your application/scenario where you get this issue with some code related to them (TellTheDetails).
 
Pratik Parekh
Greenhorn
Posts: 21
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well in my portal, I am inserting records in DB every second that I am receiving from data server and the data is received through Esper events.
so while inserting the records in DB I have received this error and it has been resolved after restarting my App Server and since then we have never face such issue. Also this issue has been suspected for the first time in this portal.
So looking for solution to prevent it from future failure with such issues.
The following code is executing every second.

public void persist(final ValueAddedQuoteEvent quoteEvent) {
try{
Integer updatedCount = (Integer)getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session){
return session.createSQLQuery(quoteUpdateSql)
.setBigDecimal("ask", ConverterUtil.round(quoteEvent.getPrice(), RoundingMode.HALF_UP))
.setLong("eventTime", quoteEvent.getTradeTime())
.setString("subscriptionCode", quoteEvent.getSubscriptionCode())
.executeUpdate();
}
});
if(updatedCount.intValue()==0){
getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session){
return session.createSQLQuery(quoteInsertSql)
.setBigDecimal("ask", ConverterUtil.round(quoteEvent.getPrice(), RoundingMode.HALF_UP))
.setLong("eventTime", quoteEvent.getTradeTime())
.setString("subscriptionCode", quoteEvent.getSubscriptionCode())
.executeUpdate();
}
});
}
}catch(Exception e) {

}
}
@Override
public void persistDayChat(final ValueAddedQuoteEvent quoteEvent) {
try {
getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session){
// //System.out.println("chat table "+quoteEvent.getLocationCode());

Query query = session.createSQLQuery("call Proc_Active(:CommodityCode,:ClassCode,:LocationCode,:Price,:TradeTime,:SubscriptionCode)")
.setParameter("CommodityCode", quoteEvent.getCommodityCode())
.setParameter("ClassCode",quoteEvent.getUserClassCode())
.setParameter("LocationCode",quoteEvent.getLocationCode())
.setParameter("Price",quoteEvent.getPrice().toString())
.setParameter("TradeTime",quoteEvent.getTradeTime())
.setParameter("SubscriptionCode",quoteEvent.getSubscriptionCode());
////System.out.println(query.getQueryString());
query.executeUpdate();

return null;
}
});
}catch(Exception e) {

}

try {
getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session){
////System.out.println("chat table ");
return session.createSQLQuery(dayChatLookupSql)
.setString("commodity",quoteEvent.getCommodityCode())
.setString("class",quoteEvent.getUserClassCode() )
.setString("location", quoteEvent.getLocationCode())
.setString("value",quoteEvent.getPrice().toString())
.setLong("date_time",quoteEvent.getTradeTime())
.executeUpdate();
}
});
}catch(Exception e) {

}


}
In code you can find ValueAddedQuoteEvent is event handler class which is carrying data through esper engine.

If above details are enough to understand the issue then kindly revert with the solution.
 
Pratik Parekh
Greenhorn
Posts: 21
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also with previous post, I want to add that
before I have received the mentioned error I have also received following error.

2012-Jan-20 19:53:46,031 [TCP Listener Thread] com.ew.esp.service.impl.McxTcpSubscriber
ERROR An error Has occurred. Reconnecting Again
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:87)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.access$000(McxTcpSubscriber.java:26)
at com.ew.esp.service.impl.McxTcpSubscriber$2.run(McxTcpSubscriber.java:49)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
2012-Jan-20 19:54:23,265 [TCP Listener Thread] com.ew.esp.service.impl.McxTcpSubscriber
ERROR An error Has occurred. Reconnecting Again
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:87)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.startConnection(McxTcpSubscriber.java:117)
at com.ew.esp.service.impl.McxTcpSubscriber.access$000(McxTcpSubscriber.java:26)
at com.ew.esp.service.impl.McxTcpSubscriber$2.run(McxTcpSubscriber.java:49)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
2012-Jan-20 20:03:51,921 [TCP-Esper-Event-Sender-0] org.hibernate.util.JDBCExceptionReporter
ERROR Communications link failure
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic