On 2/20/10 5:33 PM, Mahammad Nasir wrote:
Hi richard

I have tried the same thing.


                Properties props = new Properties();
                props.setProperty(FRAMEWORK_SYSTEMPACKAGES_EXTRA, "Dummy");
                framework = factory.newFramework(props);
                try {
                        framework.init();
                        framework.start();

                }

After this if I debug and check what config present in framework,
It is showing this:
[null, null, null, null, null, null, null, null,
org.osgi.framework.system.packages.extra=Dummy, null, null]

Rest of the things are set to null.

But I was intended to modify only org.osgi.framework.system.packages.extra.

Just set that value and nothing more. The examples on the web page show how to do exactly this.

-> richard


There is no api getProperties exposed so that I can get entire key-valuee
pair and modify only this key.

How can I set only this key??


Thanks a lot. I am makinng you answer silly quests..


Nasir

-----Original Message-----
From: Richard S. Hall [mailto:[email protected]]
Sent: Saturday, February 20, 2010 2:43 PM
To: [email protected]
Subject: Re: unresolved package org.osgi.framework...

On 2/20/10 4:25 PM, Mahammad Nasir wrote:
Thanks a lot.

Now that I need to set org.osgi.framework.system.packages.extra and
pass it to framework. Is it enough if I pass only this property?

Or I need to copy the peoperties laoded by default and append
org.osgi.framework.system.packages.extra key? If so how to get the
default kev-value pair?

The framework sets reasonable defaults for all properties as required by the
spec. You only need to set properties for which the default is undefined or
you don't like the default value.

For this specific property, though, you need to make sure whichever packages
you are adding to it are also accessible (i.e., on the class
path) of the class loader loading the framework classes.

Sorry..this may be silly..but I am very new to programming. I strugled
2 days to do this thing. I really missed c++ .h and .cpp file. All
this setting up packages wouldn't be there in c++...!

I doubt you'd have much success doing dynamic code loading in C++ as a
newbie as well... :-)

->  richard

Regards
Nasir



-----Original Message-----
From: Richard S. Hall [mailto:[email protected]]
Sent: Saturday, February 20, 2010 1:05 PM
To: [email protected]
Subject: Re: unresolved package org.osgi.framework...

On 2/20/10 2:46 PM, Mahammad Nasir wrote:

Thank you for reply.

1) I am using felix 1.0.3. I had read the link. But I dint find
org.osgi.framework.system.packages.extra in the config property
file..Where can I configure this?


If you are embedding a framework instance, it should be in the map you
pass into the framework when you construct the instance, as documented
on the mentioned page.


In my case if interfaces present in the service.jar is considered as
system package?


Any package that you want to make available from the class path (via
the system bundle) is considered a system package. This is shown with
the Lookup service in the mentioned page.


I have few some other doubts. When we launch felix like

Java -jar bin/felix. It takes the config files from conf dir. But if
we embed the felix.jar in some application. Where does it read the
config files


It doesn't. You must configure it yourself by putting the values in a
map, which you pass into the framework instance.

->   richard


Address: Huawei Industrial Base
www.huawei.com
---------------------------------------------------------------------
-
------
---------------------------------------------------------
This e-mail and its attachments contain confidential information from
HUAWEI, which is intended only for the person or entity whose address
is listed above. Any use of the information contained herein in any
way (including, but not limited to, total or partial disclosure,
reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error,
please notify the sender by phone or email immediately and delete it!


-----Original Message-----
From: Richard S. Hall [mailto:[email protected]]
Sent: Saturday, February 20, 2010 11:51 AM
To: [email protected]
Subject: Re: unresolved package org.osgi.framework...

On 2/19/10 5:22 PM, Mahammad Nasir wrote:


Hi All

I have a setup some thing like this.

I have an exe which loads a jar file say Service.jar (Which has a
class CService). This jar file instantiates (Embed new Felix(,,)) Felix.

Now using Felix instance i will register a service and pass object
if CService to it.

Now I have a felix bundle which  finds the service and uses it.

Service.jar is loaded by some exe. (That is exe loads the
Service.jar, jar instantiates Felix.)

Interace which Service implements for registering the service i have
made as another jar. (Is this correct?? Or interface should be
inside the OSGI bundle itself?)


Now my problem is loaded bundle is not able to find the package
exported by service.jar.

I would like to know, Is this type of setup is possible? Is this valid?



If I understand correctly, you have some application that loads
service.jar, which itself contains felix.jar (or at least expects
felix.jar to be on its class path. You load and instantiate some
class out of service.jar which instantiates and registers a service
inside of it. Some bundle inside of the framework instance is not
able to see the

service package. Correct?

You need to make sure you configure your framework instance to export
your service package using the
org.osgi.framework.system.packages.extra
property. This also means that you have to ensure that whatever class
loader is loading felix.jar also has access to your service package. See:




http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.

html

->    richard



I have attached the consol trace of what happned and the manifest
file of the bundle.


Welcome to Felix.
=================

Enter profile name: 1

DEBUG: WIRE: 1.0 ->     org.ungoverned.osgi.service.shell ->     1.0
DEBUG: WIRE: 1.0 ->     org.osgi.service.startlevel ->     0
DEBUG: WIRE: 1.0 ->     org.apache.felix.shell ->     1.0
DEBUG: WIRE: 1.0 ->     org.osgi.framework ->     0
DEBUG: WIRE: 1.0 ->     org.osgi.service.packageadmin ->     0
DEBUG: WIRE: 2.0 ->     org.apache.felix.shell ->     1.0
DEBUG: WIRE: 2.0 ->     org.osgi.framework ->     0
DEBUG: WIRE: 3.0 ->     org.osgi.framework ->     0
DEBUG: WIRE: 3.0 ->     org.osgi.service.obr ->     3.0
->     DEBUG: WIRE: 3.0 ->     org.apache.felix.shell ->     1.0
Intalled....
org.osgi.framework.BundleException: Unresolved package in bundle 13:
package; (&(package=demoOsgiService)(version>=0.0.0))
            at


org.apache.felix.framework.Felix._resolveBundle(Felix.java:1699)


            at

org.apache.felix.framework.Felix._startBundle(Felix.java:1566)

            at

org.apache.felix.framework.Felix.startBundle(Felix.java:1519)

            at


org.apache.felix.framework.BundleImpl.start(BundleImpl.java:354)


            at demoOsgiService.NonMain.notmain(NonMain.java:232)
            at
demoOsgiService.COSGIService.runProc(COSGIService.java:152)
            at
com.sdt.sne.eoa.passive.PassiveService.mainProc(PassiveService.java:98)
            at




com.sdt.sne.eoa.passive.PassiveService.onBasicActivated(PassiveService.java:


70)
            at
demoOsgiService.COSGIService.onBasicActivated(COSGIService.java:86)
            at com.sdt.sne.Service.onActivated0(Service.java:163)

->     ps

=========================Manifest
File===================================
Bundle-Name: Dictionary client
Bundle-Description: A bundle that uses the dictionary service if it
finds it at startup
Bundle-Vendor: Apache Felix
Bundle-Version: 1.0.0
Bundle-Activator: demoOsgiServiceCleint.Activator
Import-Package: org.osgi.framework,demoOsgiService







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


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



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


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


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


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


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

Reply via email to