title: Unknown entity bean class, please verify that this class has been marked with the @Entity annotation
body: <p>I am building an application for a research project at my University, developed in Java using Eclipse and eclipselink JPA for persistance. The application is composed of 3 Eclipse projects, call them for simplicity A, B and C. Projects A and C use JPA to access their databases, DB_A and DB_C. Project A uses the built-in Java derby database, and project C uses MySQL database.
  Both projects A and C define some entities and an entity manager. The operations work fine when tested in each project. Then, project C was added as reference to project B, and project B to project A. (A->B->C)
  Project A (main application) uses a local database DB_A and needs to access functionality of project B, that calls project C that connects to the second database DB_C. This is when the following exception occurs, thrown from project C (that worked fine before):</p>
  
  <p><strong>Exception in thread "Thread-0" java.lang.IllegalArgumentException: Unknown
  entity bean class: class database.model.VMModelSim, please verify that this
  class has been marked with the @Entity annotation.</strong></p>
  
  <pre><code>   at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:707)
  
     at org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:588)
  
     at database.dao.DAO.find(DAO.java:40)
  
     at database.facade.FacadeImpl.find(FacadeImpl.java:32)
  
     at simulationmanager.services.VMServiceImpl.getById(VMServiceImpl.java:89)
  
     at simulationmanager.services.VMServiceImpl.getById(VMServiceImpl.java:1)
  
     at monitoring.util.ResourceAdapter.updateResource(ResourceAdapter.java:29)
  
     at monitoring.QueueProcessor.writeMessageToDB(QueueProcessor.java:58)
  
     at monitoring.QueueProcessor.run(QueueProcessor.java:44)
  </code></pre>
  
  <p>Each project A and C have their own persistance.xml file, the difference being the persistence-unit name, the classes declared and the database driver.</p>
  
  <p>This is the persistance xml file of project A.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;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"
    version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"&gt;
    &lt;persistence-unit name="todos" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;class&gt;database.model.Server&lt;/class&gt;
      &lt;class&gt;database.model.VirtualMachine&lt;/class&gt;
      &lt;class&gt;database.model.CPU&lt;/class&gt;
      &lt;class&gt;database.model.CPUCore&lt;/class&gt;
      &lt;class&gt;database.model.HDD&lt;/class&gt;
      &lt;class&gt;database.model.RAM&lt;/class&gt;
      &lt;class&gt;database.model.DataCenter&lt;/class&gt;
      &lt;class&gt;database.model.Rack&lt;/class&gt;
      &lt;properties&gt;
        &lt;property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" /&gt;
        &lt;property name="javax.persistence.jdbc.url"
          value="jdbc:derby:/var/lib/one/workspace/databases/cloudDatabase;create=true" /&gt;
        &lt;property name="javax.persistence.jdbc.user" value="test" /&gt;
        &lt;property name="javax.persistence.jdbc.password" value="test" /&gt;
  
        &lt;!-- EclipseLink should create the database schema automatically --&gt;
        &lt; &lt;property name="eclipselink.ddl-generation" value="create-or-extend-tables" /&gt;  &gt;
        &lt;property name="eclipselink.ddl-generation.output-mode"
          value="database" /&gt;
      &lt;/properties&gt;
  
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt; 
  </code></pre>
  
  <p>What can I do to fix this? The entity is marked with @Entity. The operations work fine if only one database is accessed. I think that the problem appears because of the two databases that must be simultaneously accessed. Can we modify somehow the persistance.xml file?</p>