title: Exception when trying to persist and EJB
body: <p>I am newbee with EJB3.</p>
  
  <p>I have create a dao User.</p>
  
  <pre><code>@Entity
  @Table(name = "t_user")
  public class User implements Serializable {
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "id")
      private Long id;
      @Column(name = "name")
      private String name;
  
      private String street;
      private int houseNumber;
  
      @Column(name = "email") 
      private String email;
  //... getters and setters
  
  }
  </code></pre>
  
  <p>A stateless EJB:</p>
  
  <pre><code>@Stateless
  public class ItemFacade implements Serializable {
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;
      @PersistenceContext(unitName = "databaseName", type = PersistenceContextType.EXTENDED)
      private EntityManager em;
      @PersistenceUnit
      private EntityManagerFactory emf;
  
      public void create(User user) {
          emf = Persistence.createEntityManagerFactory("databaseName");
          em = emf.createEntityManager();
          em.persist(user);
      }
  }
  </code></pre>
  
  <p>The managed bean:</p>
  
  <pre><code>@ManagedBean
  @RequestScoped
  public class UserBean implements Serializable {
      private static final long serialVersionUID = 1L;
      private User user = new User();
      @EJB
      private ItemFacade itemFacade;
      public void save(){   
          itemFacade = new ItemFacade();
          itemFacade.create(this.user);
      }
      //....
  }
  </code></pre>
  
  <p>The persistence.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.1"
      xmlns="http://xmlns.jcp.org/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
          &lt;persistence-unit name="databaseName" &gt;
            &lt;jta-data-source&gt;TestDS&lt;/jta-data-source&gt;
          &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>And the tomee.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;tomee&gt;
    &lt;!-- see http://tomee.apache.org/containers-and-resources.html --&gt;
  
    &lt;!-- activate next line to be able to deploy applications in apps --&gt;
    &lt;!-- &lt;Deployments dir="apps" /&gt; --&gt;
      &lt;Resource id="TestDS" type="DataSource"&gt;
        JdbcDriver com.mysql.jdbc.Driver
        JdbcUrl jdbc:mysql://localhost:3306/databaseName
        UserName username
        Password password
        JtaManaged true
      &lt;/Resource&gt;
  &lt;/tomee&gt;
  </code></pre>
  
  <p>But I get the following exception when I try to persist a User:</p>
  
  <pre><code>Starting OpenJPA 2.4.0-nonfinal-1598334
  may 23, 2015 2:33:39 PM com.sun.faces.lifecycle.ApplyRequestValuesPhase execute
  ADVERTENCIA: &lt;openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal user error&gt; org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@fdaf18ee". 
  javax.el.ELException: &lt;openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal user error&gt; org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@fdaf18ee". 
      at org.apache.el.parser.AstValue.invoke(AstValue.java:291)
      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
      at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:149)
      at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
      at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:813)
      at javax.faces.component.UICommand.broadcast(UICommand.java:300)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
      at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
      at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:105)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: &lt;openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal user error&gt; org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@fdaf18ee". 
      at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:72)
      at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:849)
      at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:602)
      at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1518)
      at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:535)
      at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:460)
      at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:121)
      at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
      at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
      at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:967)
      at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:958)
      at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:642)
      at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:202)
      at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:155)
      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:226)
      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:153)
      at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:59)
      at manager.ItemFacade.create(ItemFacade.java:35)
      at views.UserBean.save(UserWizard.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
      ... 34 more
  </code></pre>
  
  <p>How can I resolve it?</p>