I'm by no means confident of this answer, but it does seem suspect to me to use 
have version 2.0.0.Beta1 running against Spring ORM 2.5.6. In Spring ORM 
2.5.6's manifest, the version range on javax.persistence is [1.0.0,2.0.0), but 
since the import is optional, there's no error.
 
Try using Spring 3.0.0.RC1, which has a version range of [1.0.0,3.0.0).
 
Again, not confident, but if you're been trying to fix this for a few days, 
this has to be at least worth a shot.
 
Justin

________________________________

From: sgargan [mailto:[email protected]]
Sent: Thu 10/1/2009 9:33 PM
To: [email protected]
Subject: [Karaf] ClassNotFound javax.persistence.PersistenceContext




I've been trying to get a simple JPA bundle working with Karaf but keep
running into this infuriating issue. I've been banging my head off this for
a few days, using both eclipselink and hibernate. I'm really hoping someone
can tell me what I'm doing wrong.

My spring context defines this bean (the suspect!)

<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
/>

I have javax.persistence as an import in the bundle's manifest.

ka...@root> headers 123

simple persistence (123)
------------------------
Bnd-LastModified = 1254446727902
Build-Jdk = 1.6.0_16
Built-By = sgargan
Bundle-ManifestVersion = 2
Bundle-Name = simple persistence
Bundle-SymbolicName = org.simple.persistence
Bundle-Version = 1.0.0.SNAPSHOT
Created-By = Apache Maven Bundle Plugin
Import-Package =
com.mysql.jdbc,javassist,javassist.util,javassist.util.proxy,javax.persistence;version="2.0.0.Beta1",net.sf.oval.constraint,org.apache.commons.dbcp,org.apache.commons.lang.builder;version="2.4",org.hibernate,org.hibernate.cfg,org.slf4j;version="1.5",org.springframework.beans.factory;version="2.5.6.SEC01",org.springframework.context;version="2.5.6.SEC01",org.springframework.context.weaving;version="2.5.6.SEC01",org.springframework.jdbc.support;version="2.5.6.SEC01",org.springframework.jdbc.support.lob;version="2.5.6.SEC01",org.springframework.orm.hibernate3;version="2.5.6.SEC01",org.springframework.orm.jpa;version="2.5.6.SEC01",org.springframework.orm.jpa.support;version="2.5.6.SEC01",org.springframework.orm.jpa.vendor;version="2.5.6.SEC01",org.springframework.transaction.annotation;version="2.5.6.SEC01",org.springframework.transaction.interceptor;version="2.5.6.SEC01"
Manifest-Version = 1.0
Private-Package = org.simple.dao.impl,org.simple.dao,org.simple.model
Tool = Bnd-0.0.311

And this is resolved correctly

ka...@root> imports 123
OPS4J Pax Logging - API (25): org.slf4j; version=1.5.6
Spring Beans (44): org.springframework.beans.factory; version=2.5.6.SEC01
Spring Context (46): org.springframework.context; version=2.5.6.SEC01
Spring Context (46): org.springframework.context.weaving;
version=2.5.6.SEC01
spring-osgi-core (50): org.springframework.osgi.compendium.cm; version=1.2.0
Apache Commons Database Connection Pool (55): org.apache.commons.dbcp;
version=1.2.2.osgi
OVal - the Object Validation Framework for Java 5 or later (59):
net.sf.oval.constraint; version=0.0.0
Apache Commons Lang (61): org.apache.commons.lang.builder; version=2.4.0
Spring ORM (63): org.springframework.orm.hibernate3; version=2.5.6.SEC01
Spring ORM (63): org.springframework.orm.jpa; version=2.5.6.SEC01
Spring ORM (63): org.springframework.orm.jpa.support; version=2.5.6.SEC01
Spring ORM (63): org.springframework.orm.jpa.vendor; version=2.5.6.SEC01
Spring JDBC (65): org.springframework.jdbc.support; version=2.5.6.SEC01
Spring JDBC (65): org.springframework.jdbc.support.lob; version=2.5.6.SEC01
Spring Transaction (67): org.springframework.transaction.annotation;
version=2.5.6.SEC01
Spring Transaction (67): org.springframework.transaction.interceptor;
version=2.5.6.SEC01
Java Persistence API (68): javax.persistence; version=2.0.0.Beta1
mysql-connector-java 5.1.6 [osgi] (96): com.mysql.jdbc; version=0.0.0
JBoss Hibernate Object-Relational Mapper (101): org.hibernate;
version=3.3.2.GA
JBoss Hibernate Object-Relational Mapper (101): org.hibernate.cfg;
version=3.3.2.GA
Javassist Java Programming Assistant (104): javassist; version=3.9.0.GA
Javassist Java Programming Assistant (104): javassist.util; version=3.9.0.GA
Javassist Java Programming Assistant (104): javassist.util.proxy;
version=3.9.0.GA

Yet I get the following error every time I try to start it.

ka...@root> Exception in thread "SpringOsgiExtenderThread-8"
java.lang.NoClassDefFoundError: javax/persistence/PersistenceContext
        at
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$1.doWith(PersistenceAnnotationBeanPostProcessor.java:353)
        at
org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:523)
        at
org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:500)

I'm fast running out of ideas here. Is there something  (obvious or
otherwise) that I'm overlooking here? I'll take any suggestions, weird,
wacky or out-there to get moving again so any avenue that you can suggest
would be greatly appreciated!

thanks kindly,

Steve
--
View this message in context: 
http://www.nabble.com/-Karaf--ClassNotFound-javax.persistence.PersistenceContext-tp25709253p25709253.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



Reply via email to