2017-12-14 15:02:24,707 | ERROR | rint Extender: 2 | BlueprintContainerImpl | 18 - org.apache.aries.blueprint.core - 1.4.2 | Unable to start blueprint container for bundle x due to unresolved dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(
osgi.unit.name=x_cassandra_pu))(objectClass=javax.persistence.EntityManagerFactory))]
karaf@root> list -t 0|grep -i jpa
[ 190] [Active ] [ ] [ ] [ 20] hibernate-jpa-2.1-api (1.0.0.Final)
[ 191] [Active ] [ ] [ ] [ 30] Aries JPA Container (1.0.2)
[ 192] [Active ] [ ] [ ] [ 30] Aries JPA Container API (1.0.2)
[ 193] [Active ] [ ] [ ] [ 30] Aries JPA Container Managed Contexts (1.0.4)
[ 194] [Active ] [Created ] [ ] [ 30] Aries JPA Container blueprint integration for Aries blueprint (1.0.4)
karaf@root> ls
Kundera (291) provides:
------------------------------------------
[javax.persistence.spi.PersistenceProvider]
Bundle Kundera code:
package persistence.osgi;
import java.util.Hashtable;
import com.impetus.kundera.KunderaPersistence;
import org.osgi.framework.*;
import javax.persistence.spi.PersistenceProvider;
public class PersistenceActivator implements BundleActivator, BundleListener {
public static final String PERSISTENCE_PROVIDER_ARIES = "javax.persistence.provider";
public static final String PERSISTENCE_PROVIDER = PersistenceProvider.class.getName();
public static final String OSGI_PERSISTENCE_PROVIDER = KunderaPersistence.class.getName();
private static BundleContext ctx = null;
private static ServiceRegistration svcReg = null;
public void start(BundleContext ctx) throws Exception {
this.ctx = ctx;
final Hashtable<String, String> props = new Hashtable();
props.put(PERSISTENCE_PROVIDER_ARIES, OSGI_PERSISTENCE_PROVIDER);
props.put(PERSISTENCE_PROVIDER, OSGI_PERSISTENCE_PROVIDER);
//props.put("javax.persistence.PersistenceProvider", OSGI_PERSISTENCE_PROVIDER);
PersistenceProvider provider = new KunderaPersistence();
svcReg = ctx.registerService(PERSISTENCE_PROVIDER, provider, props);
ctx.addBundleListener(this);
}
public void stop(BundleContext ctx) throws Exception {
if (svcReg != null) {
svcReg.unregister();
svcReg = null;
}
ctx.removeBundleListener(this);
}
public void bundleChanged(BundleEvent event) {
String symbolicName = event.getBundle().getSymbolicName();
String type = typeAsString(event);
System.out.println("BundleChanged: " + symbolicName + ", event.type: " + type);
}
private static String typeAsString(BundleEvent event) {
if (event == null) {
return "null";
}
int type = event.getType();
switch (type) {
case BundleEvent.INSTALLED:
return "INSTALLED";
case BundleEvent.LAZY_ACTIVATION:
return "LAZY_ACTIVATION";
case BundleEvent.RESOLVED:
return "RESOLVED";
case BundleEvent.STARTED:
return "STARTED";
case BundleEvent.STARTING:
return "Starting";
case BundleEvent.STOPPED:
return "STOPPED";
case BundleEvent.UNINSTALLED:
return "UNINSTALLED";
case BundleEvent.UNRESOLVED:
return "UNRESOLVED";
case BundleEvent.UPDATED:
return "UPDATED";
default:
return "unknown event type: " + type;
}
}
}