title: How to prevent "Local transaction already has 1 non-XA Resource" exception?
body: <p>I'm using 2 PU in stateless EJB and each of them is invoked on one method:</p>
  
  <pre><code>@PersistenceContext(unitName="PU")
  private EntityManager em;
  @PersistenceContext(unitName="PU2")
  private EntityManager em2;
  
  @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW )
  public void getCandidates(final Integer eventId) throws ControllerException {
      ElectionEvent electionEvent = em.find(ElectionEvent.class, eventId);
      ...
      Person person = getPerson(candidate.getLogin());
      ...
  }
  
  @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW )
  private Person getPerson(String login) throws ControllerException {
      Person person = em2.find(Person.class, login);
      return person;
  }
  </code></pre>
  
  <p>Those methods are annotated with REQUIRES_NEW transcaction to avoid this exception. When I was calling these method from javaFX applet, all worked as expected. Now I'm trying to call them from JAX-RS webservice (I don't see any logical difference as in both cases ejb was looked up in initial context) and I keep getting this exception. When I set up XADatasource in glassfish 2.1 connection pools, I got nullpointer exception on em2.</p>
  
  <p>Any ideas what to try next?</p>
  
  <p>Regards</p>