Hello,
ich have (in my opinion) a strange Exception, I start my web- Application (with TOMCAT) and it runs a few minutes or longer and after a while I get the Exception above and I don't know, what's the problem,
Thanks a lot for help,
All the best,
Generic1
Code:
23.11.2009 16:08:49 org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
23.11.2009 16:08:49 org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing org.springframework.web.context.support.XmlWebApplicationContext@16f0be8: display name [Root WebApplicationContext]; startup date [Mon Nov 23 16:07:38 CET 2009]; root of context hierarchy
23.11.2009 16:08:49 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d507e9: defining beans [org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.
internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.
springframework.context.annotation.internalRequiredAnnotationProcessor,xmlElementProvider,reader,startdatabase,
starttcp,trendservice,_delegatingMethodDefinitionSource,_accessManager,_methodSecurityInterceptor,_methodSecurityInterceptorPostProcessor,_methodDefinitionSourceAdvisor,org.springframework.aop.config.internalAutoProxyCreator,
_authenticationManager,_filterChainProxy,_httpSessionContextIntegrationFilter,_filterChainProxyPostProcessor,_filterChainList,_securityContextHolderAwareRequestFilter,_portMapper,_exceptionTranslationFilter,_channelProcessingFilter,_channelDecisionManager,
_filterSecurityInterceptor,_sessionFixationProtectionFilter,_anonymousAuthenticationProvider,_anonymousProcessingFilter,_rememberMeServices,_rememberMeAuthenticationProvider,_rememberMeFilter,_rememberMeServicesInjectionBeanPostProcessor,_logoutFilter,_basicAuthenticationEntryPoint,_basicAuthenticationFilter,_formLoginFilter,_formLoginEntryPoint,_entryPointInjectionBeanPostProcessor,_userServiceInjectionPostProcessor,org.springframework.security.providers.dao.DaoAuthenticationProvider#0,
org.springframework.security.userdetails.memory.InMemoryDaoImpl#0,org.springframework.security.config.AuthenticationProviderBeanDefinitionParser$AuthenticationProviderCacheResolver#0]; root of factory hierarchy
Exception in thread "Timer-0" org.hibernate.HibernateException: No CurrentSessionContext configured!
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:620)
at net.hibernate.BasicManager.getSession(BasicManager.java:29)
at net.hibernate.EventManager.storeTrendVariable(EventManager.java:55)
at net.hibernate.DatabaseInterface.createAndStoreTrendVariable(DatabaseInterface.java:59)
at net..hibernate.StartDatabase.createAndStoreTrendVariable(StartDatabase.java:200)
at net.trend.TrendWriteTimerTask.writeCurrentValueInDatabase(TrendWriteTimerTask.java:30)
at net.trend.TrendWriteTimerTask.run(TrendWriteTimerTask.java:22)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Exception in thread "receiveDataThread" org.hibernate.HibernateException: No CurrentSessionContext configured!
Here is the class, where I get the Exception:
Code:
package net.ppos.hibernate;
import java.sql.Timestamp;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
public abstract class BasicManager {
private SessionFactory factory = null;
private boolean transactionHandled;
protected BasicManager() {}
protected void ensureTransaction() {
if (transactionHandled) {
getSession().getTransaction().commit();
transactionHandled = false;
}
else if (!getSession().getTransaction().isActive()) {
getSession().beginTransaction();
transactionHandled = true;
}
}
public synchronized Session getSession() {
if (factory == null)
factory = InitSessionFactory.getInstance();
return factory.getCurrentSession(); // here is the problem
}
And here is my config- file:
Code:
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">driver ...</property>
<property name="connection.url">url ...</property>
<property name="connection.username">User</property>
<property name="connection.password">Pass ...</property>
<property name="connection.pool_size">1</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="dialect">dialect ...</property>
<!-- SQL dialect -->
<property name="current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
<property name="transaction.auto_close_session">true</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Disable the second-level cache -->
<property name="show_sql">false</property>
<!-- Echo all executed SQL to stdout -->
<property name="hbm2ddl.auto">create</property>
<!-- Drop and re-create the database schema on startup -->
<property name="c3p0.max_size">5</property>
<property name="c3p0.max_size">2</property>
<!-- mapping to the entity- config- classes -->
<mapping resource="..."/>
<mapping resource="..."/>
<mapping resource="..."/>
<mapping resource="..."/>
<mapping resource="..."/>
</session-factory>
</hibernate-configuration>