title: Unknown entity bean class after hot deploy: netbeans 6.9 + glassfish 2.1 + eclipselink jpa 2.0
body: <p>When I deploy my app, it works perfectly until I make a change, save, and netbeans hot deploys the application. At this point I get an unknown entity bean class error on a class that has the @entity and it's included in my persistence.xml. When this happens, anything dealing with jpa stops working. Only if I restart the server will my jpa stuff start working again.</p>
  
  <p>If I turn deploy on save off in my project and I only manually save and deploy I get the same results. </p>
  
  <p>Is this just a netbeans/glassfish error? Or is there something wrong with my jpa setup?</p>
  
  <p>Exception<br /></p>
  
  <pre><code>java.lang.IllegalArgumentException: Unknown entity bean class: class amc.nase.idms.persistence.model.SecSession, please verify that this class has been marked with the @Entity annotation.
          at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:592)
          at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:476)
          at amc.nase.idms.persistence.controllers.SecSessionJpaController.findSecSession(SecSessionJpaController.java:134)
          at amc.nase.idms.services.SecurityServiceHelper.validateSession(SecurityServiceHelper.java:106)
          at amc.nase.idms.services.SecurityService.validateSession(SecurityService.java:78)
          at amc.nase.idms.web.extensions.SecurityInterceptor.intercept(SecurityInterceptor.java:64)
          at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
          at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
  </code></pre>
  
  <p>Entity<br /></p>
  
  <pre><code>import java.io.Serializable;
  
  import java.util.Date;
  import javax.persistence.Basic;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.NamedQueries;
  import javax.persistence.NamedQuery;
  import javax.persistence.Table;
  import javax.persistence.Temporal;
  import javax.persistence.TemporalType;
  
  
  @Entity
  @Table(name = "SEC_SESSION",schema = "APPLOCK")
  @NamedQueries({
      @NamedQuery(name = "SecSession.findAll", query = "SELECT s FROM SecSession s"),
      @NamedQuery(name = "SecSession.findBySessionid", query = "SELECT s FROM SecSession s WHERE s.sessionid = :sessionid"),
      @NamedQuery(name = "SecSession.findByOrgid", query = "SELECT s FROM SecSession s WHERE s.orgid = :orgid"),
      @NamedQuery(name = "SecSession.findByConnecttime", query = "SELECT s FROM SecSession s WHERE s.connecttime = :connecttime"),
      @NamedQuery(name = "SecSession.findByConnectip", query = "SELECT s FROM SecSession s WHERE s.connectip = :connectip")})
  public class SecSession implements Serializable {
      private static final long serialVersionUID = 1L;
      @Id    
      @Column(name = "SESSIONID")
      private String sessionid;
      @Basic(optional = false)
      @Column(name = "ORGID")
      private Integer orgid;
      @Basic(optional = false)
      @Column(name = "CONNECTTIME")
      @Temporal(TemporalType.TIMESTAMP)
      private Date connecttime;
      @Basic(optional = false)
      @Column(name = "CONNECTIP")
      private String connectip;
  
      public SecSession() {
      }
  
      public SecSession(String sessionid) {
          this.sessionid = sessionid;
      }
  
      public SecSession(String sessionid, Integer orgid, Date connecttime, String connectip) {
          this.sessionid = sessionid;
          this.orgid = orgid;
          this.connecttime = connecttime;
          this.connectip = connectip;
      }
  
      public String getSessionid() {
          return sessionid;
      }
  
      public void setSessionid(String sessionid) {
          this.sessionid = sessionid;
      }
  
      public Integer getOrgid() {
          return orgid;
      }
  
      public void setOrgid(Integer orgid) {
          this.orgid = orgid;
      }
  
      public Date getConnecttime() {
          return connecttime;
      }
  
      public void setConnecttime(Date connecttime) {
          this.connecttime = connecttime;
      }
  
      public String getConnectip() {
          return connectip;
      }
  
      public void setConnectip(String connectip) {
          this.connectip = connectip;
      }
  
      @Override
      public int hashCode() {
          int hash = 0;
          hash += (sessionid != null ? sessionid.hashCode() : 0);
          return hash;
      }
  
      @Override
      public boolean equals(Object object) {
          if (!(object instanceof SecSession)) {
              return false;
          }
          SecSession other = (SecSession) object;
          if ((this.sessionid == null &amp;&amp; other.sessionid != null) || (this.sessionid != null &amp;&amp; !this.sessionid.equals(other.sessionid))) {
              return false;
          }
          return true;
      }
  
      @Override
      public String toString() {
          return "gov.faa.nase.security.persistence.SecSession[sessionid=" + sessionid + "]";
      }
      public SecSessionTO transfer(){
          SecSessionTO to = new SecSessionTO();
          to.setConnectIP(connectip);
          to.setConnectTime(connecttime);
          to.setOrgId(orgid);
          to.setSessionId(sessionid);
          return to;
      }
  }
  </code></pre>
  
  <p>Persistence xml<br /></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"&gt;
    &lt;persistence-unit name="iDMSPU" transaction-type="JTA"&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
      &lt;jta-data-source&gt;jdbc/dms&lt;/jta-data-source&gt;
      &lt;class&gt;amc.nase.idms.persistence.model.Org&lt;/class&gt;
      &lt;class&gt;amc.nase.idms.persistence.model.SecApp&lt;/class&gt;
      &lt;class&gt;amc.nase.idms.persistence.model.SecPermission&lt;/class&gt;
      &lt;class&gt;amc.nase.idms.persistence.model.SecRole&lt;/class&gt;
      &lt;class&gt;amc.nase.idms.persistence.model.SecSession&lt;/class&gt;
      &lt;class&gt;amc.nase.idms.persistence.model.SecUserRole&lt;/class&gt;
      &lt;class&gt;amc.nase.idms.persistence.model.TurAccessCodes&lt;/class&gt;
      &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
      &lt;properties/&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <h1>UPDATE</h1>
  
  <p>Web XML<br /></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;IOCInjector.PACKAGE&lt;/param-name&gt;
      &lt;param-value&gt;amc.nase.idms.services&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;amc.nase.idms.web.IOCInitializer&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;filter&gt;
      &lt;display-name&gt;Stripes Filter&lt;/display-name&gt;
      &lt;filter-name&gt;StripesFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;net.sourceforge.stripes.controller.StripesFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;ActionResolver.Packages&lt;/param-name&gt;
          &lt;param-value&gt;amc.nase.idms.web.actions&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;Extension.Packages&lt;/param-name&gt;
          &lt;param-value&gt;amc.nase.idms.web.extensions&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;Configuration.Class&lt;/param-name&gt;
          &lt;param-value&gt;amc.nase.idms.web.extensions.IOCRuntimeConfiguration&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;ActionBeanContextFactory.Class&lt;/param-name&gt;
          &lt;param-value&gt;amc.nase.idms.web.extensions.IDMSActionBeanContextFactory&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;ActionResolver.Class&lt;/param-name&gt;
          &lt;param-value&gt;amc.nase.idms.web.extensions.IDMSActionResolver&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  &lt;filter&gt;
      &lt;description&gt;Dynamically maps URLs to ActionBeans.&lt;/description&gt;
      &lt;display-name&gt;Stripes Dynamic Mapping Filter&lt;/display-name&gt;
      &lt;filter-name&gt;DynamicMappingFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;net.sourceforge.stripes.controller.DynamicMappingFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;StripesFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
  &lt;/filter-mapping&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;DynamicMappingFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
      &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
      &lt;dispatcher&gt;INCLUDE&lt;/dispatcher&gt;
  &lt;/filter-mapping&gt;
  &lt;session-config&gt;
      &lt;session-timeout&gt;
          30
      &lt;/session-timeout&gt;
  &lt;/session-config&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;resource-ref&gt;
      &lt;res-ref-name&gt;jdbc/dms&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
      &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;
  &lt;/resource-ref&gt;
  &lt;resource-ref&gt;
      &lt;res-ref-name&gt;jdbc/harv&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
      &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;
  &lt;/resource-ref&gt;
  &lt;/web-app&gt;
  </code></pre>