title: org.springframework.orm.hibernate4.HibernateSystemException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor];
body: <p>I am using hibernate4 and spring 3 and jsf2.0
  for injection my using annotation
  i searched for this exception on Google but not find any appropriate solution
  here i have posted my logs , application context and dao implementation  </p>
  
  <pre><code>Here is my logs
  &gt; BlockquoteHibernate: select employee0_.empid as empid0_, employee0_.emailId as emailId0_, employee0_.mobileNo as mobileNo0_, employee0_.password as password0_, employee0_.skypeID as skypeID0_, employee0_.userName as userName0_ from employee employee0_ where employee0_.userName=?
  Aug 10, 2012 5:00:28 PM javax.faces.event.MethodExpressionActionListener processAction
  SEVERE: Received 'org.springframework.orm.hibernate4.HibernateSystemException' when invoking action listener '#{loginBacking.empLogin}' for component 'j_idt16'
  Aug 10, 2012 5:00:28 PM javax.faces.event.MethodExpressionActionListener processAction
  SEVERE: org.springframework.orm.hibernate4.HibernateSystemException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]; nested exception is org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]
      at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:206)
      at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:606)
      at org.springframework.orm.hibernate4.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:507)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:845)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:822)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:411)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      at $Proxy17.empLogin_Service(Unknown Source)
      at com.airwatch.device.backingbeans.LoginBacking.empLogin(LoginBacking.java:66)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.el.parser.AstValue.invoke(AstValue.java:264)
      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:149)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84)
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
      at javax.faces.component.UICommand.broadcast(UICommand.java:296)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:126)
      at org.hibernate.internal.SessionFactoryImpl.getStatisticsImplementor(SessionFactoryImpl.java:1710)
      at org.hibernate.internal.SessionFactoryImpl.getStatistics(SessionFactoryImpl.java:1706)
      at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.afterTransaction(TransactionCoordinatorImpl.java:140)
      at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.afterTransactionCompletion(JdbcTransaction.java:138)
      at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.rollback(AbstractTransactionImpl.java:214)
      at org.springframework.orm.hibernate4.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:500)
      ... 40 more
  
  Aug 10, 2012 5:00:28 PM com.sun.faces.context.ExceptionHandlerImpl log
  SEVERE: JSF1073: javax.faces.event.AbortProcessingException caught during processing of INVOKE_APPLICATION 5 : UIComponent-ClientId=j_idt10:j_idt16, Message=org.springframework.orm.hibernate4.HibernateSystemException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]; nested exception is org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]
  Aug 10, 2012 5:00:28 PM com.sun.faces.context.ExceptionHandlerImpl log
  SEVERE: org.springframework.orm.hibernate4.HibernateSystemException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]; nested exception is org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]
  javax.faces.event.AbortProcessingException: org.springframework.orm.hibernate4.HibernateSystemException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]; nested exception is org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:178)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:84)
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:773)
      at javax.faces.component.UICommand.broadcast(UICommand.java:296)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: org.springframework.orm.hibernate4.HibernateSystemException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]; nested exception is org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]
      at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:206)
      at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:606)
      at org.springframework.orm.hibernate4.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:507)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:845)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:822)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:411)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      at $Proxy17.empLogin_Service(Unknown Source)
      at com.airwatch.device.backingbeans.LoginBacking.empLogin(LoginBacking.java:66)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.el.parser.AstValue.invoke(AstValue.java:264)
      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:149)
      ... 25 more
  Caused by: org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.stat.spi.StatisticsImplementor]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:126)
      at org.hibernate.internal.SessionFactoryImpl.getStatisticsImplementor(SessionFactoryImpl.java:1710)
      at org.hibernate.internal.SessionFactoryImpl.getStatistics(SessionFactoryImpl.java:1706)
      at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.afterTransaction(TransactionCoordinatorImpl.java:140)
      at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.afterTransactionCompletion(JdbcTransaction.java:138)
      at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.rollback(AbstractTransactionImpl.java:214)
      at org.springframework.orm.hibernate4.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:500)
      ... 40 more
  
  &gt; Blockquote&gt;
  </code></pre>
  
  <p>AND Here is my application context</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:jee="http://www.springframework.org/schema/jee"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/jee 
      http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
      http://www.springframework.org/schema/tx 
      http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
      http://www.springframework.org/schema/context 
      http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
      &lt;context:annotation-config/&gt;
      &lt;!-- .....................................Data Base Related Config............................. --&gt;
      &lt;bean id="DataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName"&gt;
              &lt;value&gt;com.mysql.jdbc.Driver&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="url"&gt;
              &lt;value&gt;jdbc:mysql://localhost:3306/test&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="username"&gt;
              &lt;value&gt;root&lt;/value&gt;
          &lt;/property&gt;
          &lt;property name="password"&gt;
              &lt;value&gt;testn&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;!-- Session Factory Declaration --&gt;
      &lt;bean id="SessionFactory"
          class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="DataSource" /&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
          &lt;property name="annotatedClasses"&gt;
              &lt;list&gt;
                  &lt;value&gt;com.airwatch.device.model.Employee&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- Enable the configuration of transactional behavior based on annotations --&gt;
      &lt;tx:annotation-driven transaction-manager="txManager" /&gt;
  
      &lt;!-- Transaction Manager is defined --&gt;
      &lt;bean id="txManager"
          class="org.springframework.orm.hibernate4.HibernateTransactionManager"
          lazy-init="true"&gt;
          &lt;property name="sessionFactory" ref="SessionFactory" /&gt;
      &lt;/bean&gt;
  
  
  
      &lt;!-- ........................DAO and Bussiness Configurations................. --&gt;
      &lt;bean id="loginBussinessImpl" class="com.airwatch.device.bussinessImpl.LoginBussinessImpl"&gt;
  
      &lt;/bean&gt;
      &lt;bean id="loginDaoImpl" class="com.airwatch.device.daoImpl.LoginDaoImpl"&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>This my DAO class implementation</p>
  
  <pre><code>    public class LoginDaoImpl implements ILoginDao {
  
          private Session mSession = null;
  
          @Autowired
          @Qualifier(value = "SessionFactory")
          private SessionFactory mHibernateSessionFcatory;
  
          /**
           * @param sessionfactory
           *            the sessionfactory to set
           */
          public void setSessionfactory(SessionFactory sessionfactory) {
              this.mHibernateSessionFcatory = sessionfactory;
          }
  
          @Override
          public void empLogin_Dao(Employee employee) {
  
              System.out.println("m in dao");
  
              mSession = mHibernateSessionFcatory.getCurrentSession();
  
              System.out.println(employee.getEmpID());
  
              Query query = mSession
                      .createQuery("from Employee where userName = :username ");
              query.setParameter("username", employee.getUserName());
              List list = query.list();
              // mSession.getTransaction().commit();
              mHibernateSessionFcatory.close();
              mSession.close();
  
          }
  
      }
      `
  </code></pre>