I haven't tried JPA in the Tomcat plugin yet. I'll try to add an example today.

-dain

On Sep 24, 2007, at 7:44 AM, Dario Laverde wrote:

Was this guy's issue resolved? I'm also having the problem getting JPA to work
(@PersistanceContext) under Tomcat including basing code on the test:

openejb-itests-beans/.../AnnotatedFieldInjectionStatelessBean.java

Speaking of which, do these tests need to be adopted to run from servlets to test
the latest annotations support under Tomcat?

-Dario


David,

I am using Maven 2.  If the example could include a Maven 2 based
pom without inheriting a parent pom, that would be great.


Definitely.  Looks like another user has some examples with JPA we
can use here.

Doing some experimenting with an intentionally bad reference to a non-
existent persistence unit and am not seeing the output a user would
need to correct things.  Something fishy is definitely going on.
Going to dig into this more first thing tomorrow.  Likely won't take
too much longer to steam things out.

-David

Paul Spencer


David Blevins wrote:
That looks exactly right.  Let me see if I can whip up a quick
example with similar settings and see if we can't figure out what
might be going.  We need the example anyway.
-David
On Aug 27, 2007, at 9:00 PM, Paul Spencer wrote:
David,
See below.

David Blevins wrote:

On Aug 26, 2007, at 6:44 PM, Paul Spencer wrote:
If you're persistence unit was not found when we attempted to
resolve  the reference (created via the annotation) during the
time the bean  as loading, we'd throw one of these which should
be  logged and would  fail your app:
  throw new IllegalArgumentException("Persistence unit " +
contextInfo.persistenceUnitName + " for persistence-context- ref " + contextInfo.referenceName + " not found");

I am getting this error, but I believe the datasource is defined.

Below is my configuration.  Is their something missing?

***
* conf/openejb.xml
***
...
<Connector id="Default JDBC Database" >
    JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
    JdbcUrl jdbc:derby:openjpa-database;create=true;
    UserName
    Password
</Connector>
...

***
* ArtifactManagerImpl.java
***
...
@Stateless
public class ArtifactManagerImpl implements ArtifactManager {
    @PersistenceContext(unitName = "myDataSource")
    private EntityManager entityManager;

    public ArtifactManagerImpl() {
    }
...

***
* META-INF/persistence.xml
***
<persistence>
  <persistence-unit name="myDataSource" transaction-type="JTA">
    <provider>
       org.apache.openjpa.persistence.PersistenceProviderImpl
    </provider>
    <jta-data-source>
      java:openejb/Connector/Default JDBC Database
    </jta-data-source>
  </persistence-unit>
</persistence>

-David


Paul Spencer




Reply via email to