db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: Derby networked server in OSGi
Date Thu, 05 May 2011 09:23:26 GMT
Hi Loic,

Thanks for the fast reply. I have also seen that there are split 
packages and think this is a problem.
I hope the derby team can fix that in one of the next releases.

Do you package the derby jars inside your own jar? I would like to have 
a solution that works with the derby jars as bundles but in case that is 
not possible I can also put the derby jars inside my own jar.

Christian


Am 05.05.2011 11:15, schrieb Loic Petit:
> Hi Christian,
>
> I did succeed on deploying a network server bundle on OSGi.
> To build it I did the following things,
>
> In the maven I just include
>
> <dependency>
> <groupId>org.apache.derby</groupId>
> <artifactId>derby</artifactId>
> <version>${derby.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.derby</groupId>
> <artifactId>derbynet</artifactId>
> <version>${derby.version}</version>
> </dependency>
>
> And in the building process I put :
>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>2.1.0</version>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Bundle-Name>${pom.name <http://pom.name>}</Bundle-Name>
> <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
> <Bundle-Activator>com.francetelecom.minelia.derby.Activator</Bundle-Activator>
> <Import-Package>org.apache.xalan.serialize;resolution:=optional,
>                             
> org.apache.xalan.templates;resolution:=optional,
>                             org.apache.xml.utils;resolution:=optional,
>                             org.apache.xpath;resolution:=optional,
>                             org.apache.xpath.objects;resolution:=optional,
>                             org.w3c.dom, org.xml.sax,
>                             javax.*;resolution:=optional,
>                             org.osgi.framework,
>                             org.osgi.util.tracker</Import-Package>
> <Export-Package>org.apache.derby.jdbc, 
> org.apache.derby.drda</Export-Package>
> <Private-Package>org.apache.derby.*;-split-package:=merge-first, 
> YOUR_PACKAGES</Private-Package>
> </instructions>
> </configuration>
> </plugin>
>
> The trick is two fold. Firstly, some imports are optional like the 
> xalan serializing process etc... But the main problem is that some 
> packages are split in the jar derby and derby net. No you have to do 
> merge-first strategies.
> By the way, it is a bit weird to have split packages in the derby 
> distribution.
>
> Hope this helps :)
>
> LP
>
> On Thu, May 5, 2011 at 11:03 AM, Christian Schneider 
> <chris@die-schneider.net <mailto:chris@die-schneider.net>> wrote:
>
>     Hi All,
>
>     I have problems running derby with network connector in an OSGi
>     environment.
>
>     I created my own bundle for the starter and use an Activator to
>     start derby (see below).
>     I have also attached to Manifest of my bundle. Probably there are
>     more imports missing but this is as far as I got.
>
>     To install all this I use Karaf and a feature file (see below).
>
>     The derby jar seems to bea bundle already so I simply install it
>     from maven. The derbynet jar is no bundle so I use the wrap syntax
>     of Karaf so a Manifest is created for it on the fly.
>
>     So the problem is that when I install a bundle I get a non
>     resolvable import
>     Error executing command: The bundle "derby-starter_4.1.0.SNAPSHOT
>     [159]" could not be resolved. Reason: Missing Constraint:
>     Import-Package: org.apache.derby.iapi.tools.i18n; version="0.0.0"
>
>     The package is in the bundle derby but it is not exported.
>
>     So I think either that export and perhaps some more is missing or
>     I am doing something wrong.
>
>     Can anyone help me with this?
>
>     If you want to test this yourself I can provide a complete maven
>     project and some instructions.
>
>     Christian
>
>
>     -------------------
>     Feature file for Karaf
>     --------------------
>
>     <feature name='tesb-derby-starter' version='4.1-SNAPSHOT'>
>     <bundle>mvn:org.apache.derby/derby/10.8.1.2 <http://10.8.1.2></bundle>
>     <bundle>wrap:mvn:org.apache.derby/derbynet/10.8.1.2
>     <http://10.8.1.2></bundle>
>     <bundle>mvn:org.talend.esb/derby-starter/4.1-SNAPSHOT</bundle>
>     </feature>
>
>
>
>     -------------------------------
>     Starter class
>     -------------------------------
>     package org.talend.esb.derby.starter;
>
>     import java.net.InetAddress;
>
>     import org.apache.derby.drda.NetworkServerControl;
>     import org.osgi.framework.BundleActivator;
>     import org.osgi.framework.BundleContext;
>
>     public class NetworkActivator implements BundleActivator {
>         NetworkServerControl server;
>
>         public void start(BundleContext context) throws Exception {
>             server = new
>     NetworkServerControl(InetAddress.getByName("localhost"),1527);
>             server.start(null);
>         }
>
>         public void stop(BundleContext context) throws Exception {
>             server.shutdown();
>         }
>
>     }
>
>     ---
>     Manifest of starter bundle
>     ----
>     Manifest-Version: 1.0
>     Export-Package: org.talend.esb.derby.starter;uses:="org.apache.derby.d
>      rda,org.osgi.framework"
>     Built-By: chris
>     Tool: Bnd-1.15.0
>     Bundle-Name: Service Activity Monitoring :: Derby Starter
>     Created-By: Apache Maven Bundle Plugin
>     Bundle-Vendor: Talend Inc.
>     Build-Jdk: 1.6.0_20
>     Bundle-Version: 4.1.0.SNAPSHOT
>     Bnd-LastModified: 1304585222883
>     Bundle-Activator: org.talend.esb.derby.starter.NetworkActivator
>     Bundle-ManifestVersion: 2
>     Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
>     Bundle-DocURL: www.talend.com <http://www.talend.com>
>     Bundle-SymbolicName: derby-starter
>     Import-Package: org.apache.derby.drda,org.apache.derby.iapi.tools.i18n
>      ,org.osgi.framework;version="[1.5,2)"
>
>
>
>     -- 
>     Christian Schneider
>     http://www.liquid-reality.de
>
>     CXF and Camel Architect
>
>

-- 
Christian Schneider
http://www.liquid-reality.de

CXF and Camel Architect


Mime
View raw message