title: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use
body: <p>I want to create a simple web project app. I am using struts2 and hibernate and I am new to both of this frameworks and I am getting this error: </p>
  
  <pre>Unable to instantiate Action, org.project.actions.UserAction,  defined for 'saveUser' in namespace '/'An AnnotationConfiguration instance is required to use 
      com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:306)
      com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
      com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
      org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
      org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
      com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
      org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
      org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
  
  root cause
  
  org.hibernate.MappingException: An AnnotationConfiguration instance is required to use 
      org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1634)
      org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1589)
      org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1568)
      org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
      org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
      org.hibernate.cfg.Configuration.configure(Configuration.java:1448)
      org.project.actions.UserAction.(UserAction.java:23)
      sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      java.lang.reflect.Constructor.newInstance(Unknown Source)
      java.lang.Class.newInstance0(Unknown Source)
      java.lang.Class.newInstance(Unknown Source)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:119)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
      com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
      com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
      com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:287)
      com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
      com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
      org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
      org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
      com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
      org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
      org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
  </pre>
  
  <p>I have tried to use AnnotationConfiguration() to create SessionFactory, but the same error occurs. Please help. Thanks in advance. </p>