Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B88612493 for ; Thu, 5 May 2011 09:41:09 +0000 (UTC) Received: (qmail 45422 invoked by uid 500); 5 May 2011 09:41:09 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 45378 invoked by uid 500); 5 May 2011 09:41:09 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 45371 invoked by uid 99); 5 May 2011 09:41:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2011 09:41:09 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of loic.petit@gmail.com designates 74.125.83.44 as permitted sender) Received: from [74.125.83.44] (HELO mail-gw0-f44.google.com) (74.125.83.44) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2011 09:41:02 +0000 Received: by gwb20 with SMTP id 20so837566gwb.31 for ; Thu, 05 May 2011 02:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=sdnCxSZOpHLp/wwwkkYUKcnP0/Iq1t/MB9ggDwreOJU=; b=L2wOV/syZ6nd7BMMC5NckbJG42n/40KPdYm4f6BRxBAfD80Jqje9b63D9vy7s4+9AO AhDkCx3vob/MijHYMpZcJ7TvH0LM/oMEzyqBmJJs8/guHykSHXgOI/vkOc/oqtC4hd6j NcUTh4nrLFqWOFUFrD5S3vQhbmhUf6xAEgG68= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=wMnVM/SooQWB6WNbUoYzMwLvoz8EaVa1wi9heXIpzUAfvtxkEfw6+CIcDwWuBdxhHz /w/yeXikSAJDgPUI32lspyaHz2y3Kg2yo//k7LM3sZTXiBuJw7b9gMoy61zII4PNOPqg TGo4Eck1XJAJiOQzZ5TDue4/pOd8uIvdcp9rA= MIME-Version: 1.0 Received: by 10.100.225.13 with SMTP id x13mr1426149ang.27.1304588441198; Thu, 05 May 2011 02:40:41 -0700 (PDT) Received: by 10.100.254.10 with HTTP; Thu, 5 May 2011 02:40:41 -0700 (PDT) In-Reply-To: <4DC26C8E.5090105@die-schneider.net> References: <4DC267F9.60205@die-schneider.net> <4DC26C8E.5090105@die-schneider.net> Date: Thu, 5 May 2011 11:40:41 +0200 Message-ID: Subject: Re: Derby networked server in OSGi From: Loic Petit To: Derby Discussion Content-Type: multipart/alternative; boundary=0016369204b39d9ef704a2842aca X-Virus-Checked: Checked by ClamAV on apache.org --0016369204b39d9ef704a2842aca Content-Type: text/plain; charset=ISO-8859-1 Hi again, Yes I embed all the content of both jars inside the bundle (you can notice I did not put provided on dependancies). I tried to do other stuff with separate (bundlelized) jars. But it is impossible with this split package, because your application bundle will try to bind to derby and derbynet. But in OSGi, a package cannot be bound from two bundles. What I did is a bit dirty (I don't like writting my own import instructions, I prefer let bnd do its magic) but I think it is the best solution so far. Btw, I wrote the same activator :) LP On Thu, May 5, 2011 at 11:23 AM, Christian Schneider < chris@die-schneider.net> wrote: > 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 > > > org.apache.derby > derby > ${derby.version} > > > org.apache.derby > derbynet > ${derby.version} > > > And in the building process I put : > > > org.apache.felix > maven-bundle-plugin > 2.1.0 > true > > > ${pom.name} > > ${pom.groupId}.${pom.artifactId} > > com.francetelecom.minelia.derby.Activator > > 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 > org.apache.derby.jdbc, > org.apache.derby.drda > > org.apache.derby.*;-split-package:=merge-first, > YOUR_PACKAGES > > > > > 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> 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 >> -------------------- >> >> >> mvn:org.apache.derby/derby/10.8.1.2 >> wrap:mvn:org.apache.derby/derbynet/10.8.1.2 >> mvn:org.talend.esb/derby-starter/4.1-SNAPSHOT >> >> >> >> >> ------------------------------- >> 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 >> 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 Schneiderhttp://www.liquid-reality.de > > CXF and Camel Architect > > --0016369204b39d9ef704a2842aca Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi again,

Yes I embed all the content of both jars inside the bundle= (you can notice I did not put <scope>provided</scope> on depen= dancies). I tried to do other stuff with separate (bundlelized) jars. But i= t is impossible with this split package, because your application bundle wi= ll try to bind to derby and derbynet. But in OSGi, a package cannot be boun= d from two bundles.

What I did is a bit dirty (I don't like writting my own import inst= ructions, I prefer let bnd do its magic) but I think it is the best solutio= n so far. Btw, I wrote the same activator :)

LP


On Thu, May 5, 2011 at 11:23 AM, Christi= an Schneider <chris@die-schneider.net> wrote:
=20 =20 =20
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 Christia= n,

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

=A0=A0=A0=A0=A0=A0=A0 <dependency>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <groupId>org.apache.derby<= /groupId>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <artifactId>derby</artifac= tId>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <version>${derby.version}<= /version>
=A0=A0=A0=A0=A0=A0=A0 </dependency>
=A0=A0=A0=A0=A0=A0=A0 <dependency>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <groupId>org.apache.derby<= /groupId>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <artifactId>derbynet</arti= factId>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <version>${derby.version}<= /version>
=A0=A0=A0=A0=A0=A0=A0 </dependency>

And in the building process I put :

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <plugin>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <groupId>org.apac= he.felix</groupId>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <artifactId>maven-bundle-plugin</artifactId>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <version>2.1.0<= ;/version>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <extensions>true&= lt;/extensions>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <configuration> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <instruc= tions>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= <Bundle-Name>${pom.nam= e}</Bundle-Name>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-Symb= olicName>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <Bundle-Activator>com.francetelecom.minelia.derby.Activator</Bundl= e-Activator>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <Import-Package>org.apache.xalan.serialize;resolution:=3Doption= al,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 org.apache.xalan.templates;resolution:=3Doptional,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 org.apache.xml.utils;resolution:=3Doptional,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 org.apache.xpath;resolution:=3Doptional,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 org.apache.xpath.objects;resolution:=3Doptional,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 org.w3c.dom, org.xml.sax,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 javax.*;resolution:=3Doptional,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 org.osgi.framework,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 org.osgi.util.tracker</Import-Package>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <Export-Package>org.apache.derby.jdbc, org.apache.derby.drda</Export-Package>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <Private-Package>org.apache.derby.*;-split-package:=3Dmerge-fir= st, YOUR_PACKAGES</Private-Package>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 </instru= ctions>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 </configuration><= br> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 </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> 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 resol= ved. Reason: Missing Constraint: Import-Package: org.apache.derby.iapi.tools.i18n; version=3D"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=3D'tesb-derby-starter' version=3D'4.1-SNAPSHOT'>
<bundle>mvn:org.apache.derby/derby/10.8.1.2</bundle>
<bundle>wrap:mvn:org.apache.derby/derbynet/10.8.1.2</bundle>
<bundle>mvn:org.talend.esb/derby-starter/4.1-SNAPSHOT</bundle><= br> </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 {
=A0 =A0 NetworkServerControl server;

=A0 =A0 public void start(BundleContext context) throws Exception {
=A0 =A0 =A0 =A0 server =3D new NetworkServerControl(InetAddress.getByName("localhost")= ,1527);
=A0 =A0 =A0 =A0 server.start(null);
=A0 =A0 }

=A0 =A0 public void stop(BundleContext context) throws Exception = {
=A0 =A0 =A0 =A0 server.shutdown();
=A0 =A0 }

}

---
Manifest of starter bundle
----
Manifest-Version: 1.0
Export-Package: org.talend.esb.derby.starter;uses:=3D"org.apache.derby.d
=A0rda,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<= /a>
Bundle-DocURL:
www.talend.com
Bundle-SymbolicName: derby-starter
Import-Package: org.apache.derby.drda,org.apache.derby.iapi.tools.i18n
=A0,org.osgi.framework;version=3D"[1.5,2)"



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

CXF and Camel Architect


--=20
Christian Schneider
http://www.liqui=
d-reality.de

CXF and Camel Architect

--0016369204b39d9ef704a2842aca--