Permalink
Browse files

fix: OSGi require-capability manifest entry

closes #497
  • Loading branch information...
vlsi committed Feb 8, 2016
1 parent ee6118e commit a3e204580220ca0b243f9562b2cbf44e0e60d51c
Showing with 15 additions and 3 deletions.
  1. +14 −2 pgjdbc/src/main/java/org/postgresql/osgi/PGBundleActivator.java
  2. +1 −1 pom.xml
@@ -29,8 +29,20 @@ public void start(BundleContext context) throws Exception {
properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_CLASS, Driver.class.getName());
properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_NAME, "PostgreSQL JDBC Driver");
properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_VERSION, Driver.getVersion());
_registration = context.registerService(DataSourceFactory.class.getName(),
new PGDataSourceFactory(), properties);
try {
_registration = context.registerService(DataSourceFactory.class.getName(),
new PGDataSourceFactory(), properties);
} catch (NoClassDefFoundError e) {
String msg = e.getMessage();
if (msg != null && msg.contains("org/osgi/service/jdbc/DataSourceFactory")) {
new IllegalArgumentException("Unable to load DataSourceFactory. "
+ "Will ignore DataSourceFactory registration. If you need one, "
+ "ensure org.osgi.enterprise is on the classpath", e).printStackTrace();
// just ignore. Assume OSGi-enterprise is not loaded
return;
}
throw e;
}
}

public void stop(BundleContext context) throws Exception {
@@ -5,7 +5,7 @@
<parent>
<groupId>org.postgresql</groupId>
<artifactId>pgjdbc-versions</artifactId>
<version>1.0.4</version>
<version>1.0.5</version>
</parent>

<artifactId>pgjdbc-aggregate</artifactId>

0 comments on commit a3e2045

Please sign in to comment.