title: Dependency Injection failing - hibernate with struts2 using the full-hibernate-plugin
body: <p>i'm trying to use hibernate in a struts2 example using the struts2 full hibernate plugin (<a href="http://code.google.com/p/full-hibernate-plugin-for-struts2" rel="nofollow noreferrer">http://code.google.com/p/full-hibernate-plugin-for-struts2</a>).</p>
  
  <p>I've placed all the Jars in my lib folder:</p>
  
  <pre><code>antlr-2.7.6.jar
  commons-collections-3.1.jar
  commons-fileupload-1.2.1.jar
  commons-io-1.3.2.jar
  commons-lang-2.3.jar
  commons-logging-1.0.4.jar
  commons-logging-api-1.1.jar
  dom4j-1.6.1.jar
  freemarker-2.3.15.jar
  hibernate3.jar
  javassist-3.9.0.GA.jar
  jta-1.1.jar
  jtds-1.2.4.jar
  log4j-1.2.15.jar
  ognl-2.7.3.jar
  slf4j-api-1.5.8.jar
  slf4j-log4j12-1.5.8.jar
  spring-beans-2.5.6.jar
  spring-context-2.5.6.jar
  spring-core-2.5.6.jar
  spring-test-2.5.6.jar
  spring-web-2.5.6.jar
  struts2-core-2.1.8.jar
  struts2-fullhibernatecore-plugin-1.5-GA.jar
  struts2-spring-plugin-2.1.8.jar
  xwork-core-2.1.6.jar
  </code></pre>
  
  <p>And here is the code to my action class:</p>
  
  <pre><code>package sample;
  import org.hibernate.Session;
  import data.*;
  import java.util.*;
  
  public class Events {
    org.hibernate.Session hibernateSession;
  
    public void setHibernateSession(org.hibernate.Session hibernateSession) throws Exception {
      this.hibernateSession = hibernateSession;
    }
    public void sethibernateSession(org.hibernate.Session hibernateSession) throws Exception {
      this.hibernateSession = hibernateSession;
    }
  
    @SuppressWarnings("unchecked")
    public String execute() {
  
      List&lt;Event&gt; events = hibernateSession.createQuery("from Event").list();
  
      for (Event theEvent : events) {
        // blah blah...
      }
  
      return "success";
    }
  }
  </code></pre>
  
  <p>I've supposedly configured the full hibernate plugin to inject the hibernate session into my action class, with this configuration in the struts.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE struts PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
      "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;
  &lt;struts&gt;
    &lt;constant name="hibernatePlugin.sessionTarget" value="hibernateSession" /&gt;
    &lt;constant name="hibernatePlugin.transactionTarget" value="hibernateTransaction" /&gt;
    ..etc..
  &lt;/struts&gt;
  </code></pre>
  
  <p>But my action class always falls over when it tries to access the hibernateSession variable, it is always null. So the dependency injection is failing it seems.</p>
  
  <p>Any ideas why?
  Please help, thanks a lot.
  Also ask if you need to see any other config files.</p>