How are you adding these jars to your runtime classpath?

On 15/11/2008, at 1:58 AM, Ulrich Wolf wrote:

This is the jar that contains all of the javax.persistence classes.
You may need the other dependencies listed in the OpenJPA POM too.

I've now included the following artifacts, as you suggested. I thought, that these will be resolved by the pom-file itself. Problem is, that the failure
is still the same.

<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>

<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>

<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>

<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_3.0_spec</artifactId>

<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>

<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>

<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>

<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>

<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>

<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>

<groupId>net.sourceforge.serp</groupId>
<artifactId>serp</artifactId>

<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-xmlstore</artifactId>

<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-persistence-jdbc</artifactId>

<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-persistence</artifactId>

<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-jdbc</artifactId>

<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-kernel</artifactId>

<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-lib</artifactId>

My Code goes like this:

        EntityManagerFactory emf =
Persistence.createEntityManagerFactory("appname");
        EntityManager em = emf.createEntityManager();

And the error
        [INFO] Exception in thread "main" java.lang.NoClassDefFoundError:
javax/persistence/Persistence

Which comes up in the first line, of this code. Imports are correct, eclipse
did them.

When I use the Injection like this:
        @PersistenceContext(unitName = "grademaster")
        private static EntityManager em;

it works, but the main-problem is a really strange Error...

The injection solved it (at least for me, we'll see, what my database-coder
says) for me ;)

Uli


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to