title: OpenJPA:This configuration disallows runtime optimization,but the listed types were not enhanced at build time or at class load time with a javaagent
body: <p>So, after a lot of searching (in vain) I've decided to post this. So, I'm developing this web application using Open JPA (2.2.0). Executing the application throws the following error:</p>
  
  <p>Console printout :</p>
  
  <pre><code>&lt;openjpa-2.3.0-r422266:1540826 nonfatal user error&gt; org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "
  Entities.User".
      org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:115)
      org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:312)
      org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:236)
      org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:212)
      org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
      org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
      org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
      org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
      Servlet.Registration.doPost(Registration.java:78)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  </code></pre>
  
  <p>Config :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.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_2_0.xsd"&gt;
    &lt;persistence-unit name="persistenceUnit"&gt;
      &lt;class&gt;Entities.User&lt;/class&gt;
      &lt;properties&gt;
        &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/alda" /&gt;
        &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt;
        &lt;property name="javax.persistence.jdbc.user" value="root" /&gt;
        &lt;property name="javax.persistence.jdbc.password" value="" /&gt;
        &lt;property name="openjpa.jdbc.DBDictionary" value="mysql" /&gt;
        &lt;!-- Cette propriété active la log des requêtes SQL réalisées par OpenJPA --&gt;
        &lt;property name="openjpa.Log" value="SQL=Trace" /&gt;
        &lt;property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Registration class :</p>
  
  <pre><code>public class Registration extends HttpServlet {
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
      }
  
  
      @Override
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          String name = request.getParameter("name");
          String firstName = request.getParameter("firstName");
          String email = request.getParameter("email");
          String password = request.getParameter("password");
          String confirmation = request.getParameter("confirmation");
          String phone = request.getParameter("phone");
          String address = request.getParameter("address");
  
          System.out.println("Ajout d'un utilisateur:"+name+","+firstName+","+email+","+password+","+confirmation);
  
  
          EntityManagerFactory emf = Persistence.createEntityManagerFactory("persistenceUnit");
          EntityManager em = emf.createEntityManager();
          em.getTransaction().begin();
  
          User u = new User();
  
          u.setName(name);
          u.setFirstName(firstName);
          u.setPassword(password);
          u.setEmail(email);
          u.setAddress(address);
          u.setPhone(phone);
          em.persist(u);
          em.getTransaction().commit();
  
  
  
          this.getServletContext().getRequestDispatcher("/Home.jsp").forward(request, response);
  
      }
  }
  </code></pre>