Re: Issue of felix on android 4.1

2012-08-10 Thread Angelo van der Sijpt
Hi Orga,

I have noticed that Android 4 needs the framework property
  felix.service.urlhandlers=false
whereas older versions don't. Try setting that property, and see if that fixes 
your situation.

Angelo


On Aug 10, 2012, at 9:38 AM, Orga wrote:

 Hi,
 
 I am trying to put apache felix to android 4.1, but all default bundles
 can't be installed.
 At first, I follow the tutorial 
 http://felix.apache.org/site/apache-felix-framework-and-google-android.html
 .
 Using the felix-framework-4.0.3 for android 4.1 emulator. because I want
 to port it to Nexus 7.
 then I get the error as below:
 
 Problem creating boot delegation class loader:
 java.lang.reflect.InvocationTargetException
 Auto-deploy install: org.osgi.framework.BundleException: Unable to cache
 bundle: file:/data/felix/bundle/org.apache.felix.bundlerepository-1.6.6.jar
 - java.net.MalformedURLException: java.lang.IllegalStateException: Unknown
 protocol: file
 Auto-deploy install: org.osgi.framework.BundleException: Unable to cache
 bundle: file:/data/felix/bundle/org.apache.felix.gogo.command-0.12.0.jar -
 java.net.MalformedURLException: java.lang.IllegalStateException: Unknown
 protocol: file
 Auto-deploy install: org.osgi.framework.BundleException: Unable to cache
 bundle: file:/data/felix/bundle/org.apache.felix.gogo.runtime-0.10.0.jar -
 java.net.MalformedURLException: java.lang.IllegalStateException: Unknown
 protocol: file
 Auto-deploy install: org.osgi.framework.BundleException: Unable to cache
 bundle: file:/data/felix/bundle/org.apache.felix.gogo.shell-0.10.0.jar -
 java.net.MalformedURLException: java.lang.IllegalStateException: Unknown
 protocol: file
 
 It looks like all bundles can't be installed. Are there any suggestion
 about this?
 
 
 
 Detail step:
 1.download felix-framework-4.0.3 and osgi-android - felix 1.4, android SDK
 1.0.zip and extract them.
 2.do dx and aapt for jar files in felix-framework-4.0.3.
 3.copy felix.sh from osgi-android - felix 1.4, android SDK 1.0
 to felix-framework-4.0.3
 4.start emulator of android 4.1
 5.push felix-framework-4.0.3 to android(/data/felix)
 6.adb shell and cd to /data/felix
 7.sh felix.sh
 
 More info:
 I have tried different versions of android and felix.
 1.osgi-android - felix 1.4, android SDK 1.0.zip  works normally on
 android 4.1 with it bundles.
 2. felix-framework-4.0.3 is work on android 4.03 and 2.3.3
 
 thank you and I appreciate your time in reading this.
 
 -- 
 Regards,
 Orga




-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org



Re: Problem when exporting system packages from Android to bundles

2012-04-03 Thread Angelo van der Sijpt
Yay, another BNDtools convert! :)

I'm not sure what you mean by get a Nullpointer when trying to draw something 
on the screen; perhaps you're missing an Acitivity or something. Remember 
that, at least in my experience, the Android lifecycle prevails, and OSGi has 
to be fit into that.

Angelo


On Apr 3, 2012, at 11:23 AM, M. van Ree wrote:

 Hey Angelo,
 
 For the moment I've only just used BNDTools to generate the manifest which
 seems to work well now, the class mismatch error is gone now.
 However, I do get a Nullpointer when trying to draw something on the screen
 using the imported packages. But I guess that occurs because the bundle
 probably can't use the application context just like that by passing it
 along.
 
 Thanks for your answers, certainly helped me fix a rather annoying thing,
 wish I had used BNDTools earlier on...
 
 Maurice
 
 
 On Mon, Apr 2, 2012 at 12:04 PM, Angelo van der Sijpt 
 angelo.vandersi...@luminis.eu wrote:
 
 Hi Maurice,
 
 See inline.
 
 On Apr 2, 2012, at 11:51 AM, M. van Ree wrote:
 
 I was considering the use of BNDTools indeed, and will look into that for
 sure now.
 I didn't know about the Bundle-ManifestVersion, will look into that too!
 The comma is indeed a copy-paste error, as you can see in the bottom
 import
 statement, I closed the last one without a comma. But, sharp to notice!
 
 Well, it's important to have a good view of what actually is going on in
 your code (it could be a simple typo).
 
 
 As far as tools go, I'm just using Eclipse Indigo and the latest Android
 SDK, dexing and packaging jars with the tools (dx and aapt) from the SDK.
 When opening the bundle jarfile, the API isn't in there, I don't know
 what
 happens after installing and starting the bundle on Felix though...I can
 actually install a bundle and print something to the console or use Log.d
 to show a message in Logcat, so the bundle (without using Android
 libraries) does seem to be packaged in the right way I guess?
 
 You can use dexdump to inspect the (dalvik-)contents of a bundle.
 
 
 I'll report back here how things work out after trying BNDTools.
 
 Good luck!
 
 
 Maurice
 
 Angelo
 
 
 On Mon, Apr 2, 2012 at 11:18 AM, Angelo van der Sijpt 
 angelo.vandersi...@luminis.eu wrote:
 
 Right.
 
 I'm not entirely sure what's up, but some things come to mind,
 - in stead of building the manifest by hand, you should consider using
 something like BND (perhaps with BNDTools, if you're an Eclipse user) to
 handle that for you. If you don't need to use DynamicImport, stick with
 'regular' imports: that way, the framework can inform you better about
 what's wrong.
 - your bundle should have a Bundle-ManifestVersion: 2 to state that it
 is an R4 bundle (again, BND will do that for you).
 - your Import-Package statement seems to have a comma after
 org.osgi.framework . I'm not sure whether that is a copy-paste error, or
 whether it is actually relevant. (insert-bnd-notice/)
 - what tools do you use for building your project? Is it possible that
 the
 Android API ends up _inside_ your bundle?
 
 Angelo
 
 On Apr 2, 2012, at 10:59 AM, M. van Ree wrote:
 
 Hello Angelo,
 
 Thank you for your fast response!
 Here is some more info:
 
 a:
 public FelixManager(String rootPath)
 {
 this.rootPath = rootPath;
 felixProperties = new FelixProperties(this.rootPath);
 
  bundlesDir = new File(rootPath+/felix/bundle);
  if (!bundlesDir.exists()) {
   if (!bundlesDir.mkdirs()) {
   throw new IllegalStateException(Unable to create bundles dir);
   }
  }
  cacheDir = new File(rootPath+/felix/cache);
  if (!cacheDir.exists()) {
   if (!cacheDir.mkdirs()) {
   throw new IllegalStateException(Unable to create felixcache
 dir);
   }
  }
 
  try
  {
  felix = new Felix(felixProperties);
  felix.start();
  }
  catch (Exception ex)
  {
  ex.printStackTrace();
  }
 }
 
 The felix properties are defined as following:
 
 private String m_felixAbsolutePath;
 public FelixProperties(String rootpath)
 {
 m_felixAbsolutePath = rootpath;
 put(org.osgi.framework.storage, m_felixAbsolutePath+/felix/cache);
 put(felix.cache.rootdir,m_felixAbsolutePath+/felix);
 put(felix.log.level, 4);
 put(felix.startlevel.bundle, 1);
 put(org.osgi.framework.system.packages.extra,
 ANDROID_PACKAGES_FOR_EXPORT);
 }
 private final String ANDROID_PACKAGES_FOR_EXPORT=
 android;  +
  android.app; +
  android.content; +
  android.database; + etc. etc.
 
 and b:
 
 Manifest-Version: 1.0
 Bundle-Name: drawbundle
 Bundle-Activator: com.osgi.integration.drawbundle.Activator
 Bundle-SymbolicName: com.osgi.integration.drawbundle
 Bundle-Version: 0.0.1
 Import-Package: org.osgi.framework,
 DynamicImport-Package: android.*
 
 I first, to no avail, tried including the Android packages manually in
 the
 Import-Package statement, like so:
 
 Import-Package: org.osgi.framework,
 android.view.LayoutInflater,
 android.view.View

Re: Problem when exporting system packages from Android to bundles

2012-04-02 Thread Angelo van der Sijpt
This could have something to do with the way you instantiate your framework, 
_or_ with the way your bundle is packaged.
Could you post (a) your framework instantiation code, and (b) the manifest of 
your bundle?

Angelo


On Apr 2, 2012, at 10:18 AM, M. van Ree wrote:

 Hello all,
 
 I have a problem when trying to make the Android lib available to my OSGi
 bundles.
 The error I'm getting is:
 
 04-02 08:03:00.351: W/dalvikvm(18531): Method mismatch: onDraw in
 Lcom/osgi/integration/drawbundle/DrawView; (cl=0x4067bb40) and super
 Landroid/view/View; (cl=0x0)
 04-02 08:03:00.391: W/System.err(18531): Caused by: java.lang.LinkageError:
 Classes resolve differently in superclass
 
 Off course I can see the cl=0x0, so that must be the culprit, but I have no
 idea on how to get it fixed...
 I'm exporting the packages as following in a properties class:
 
 private static final String ANDROID_PACKAGES_FOR_EXPORT =
 (android;  +
 android.app; +
 android.content; +
 android.database; +
 etc. etc. );
 
 I'm really drawing a blank here on what could be wrong, I would expect to
 receive an error on exporting/importing something empty that would point me
 in the right direction, but it doesn't seem to be the case.
 Who can tell me what I'm doing wrong here?
 
 
 Regards,
 Maurice



-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org



Re: Problem when exporting system packages from Android to bundles

2012-04-02 Thread Angelo van der Sijpt
Right.

I'm not entirely sure what's up, but some things come to mind,
- in stead of building the manifest by hand, you should consider using 
something like BND (perhaps with BNDTools, if you're an Eclipse user) to handle 
that for you. If you don't need to use DynamicImport, stick with 'regular' 
imports: that way, the framework can inform you better about what's wrong.
- your bundle should have a Bundle-ManifestVersion: 2 to state that it is an 
R4 bundle (again, BND will do that for you).
- your Import-Package statement seems to have a comma after org.osgi.framework 
. I'm not sure whether that is a copy-paste error, or whether it is actually 
relevant. (insert-bnd-notice/)
- what tools do you use for building your project? Is it possible that the 
Android API ends up _inside_ your bundle?

Angelo

On Apr 2, 2012, at 10:59 AM, M. van Ree wrote:

 Hello Angelo,
 
 Thank you for your fast response!
 Here is some more info:
 
 a:
 public FelixManager(String rootPath)
 {
 this.rootPath = rootPath;
 felixProperties = new FelixProperties(this.rootPath);
 
bundlesDir = new File(rootPath+/felix/bundle);
if (!bundlesDir.exists()) {
 if (!bundlesDir.mkdirs()) {
 throw new IllegalStateException(Unable to create bundles dir);
 }
}
cacheDir = new File(rootPath+/felix/cache);
if (!cacheDir.exists()) {
 if (!cacheDir.mkdirs()) {
 throw new IllegalStateException(Unable to create felixcache dir);
 }
}
 
try
{
felix = new Felix(felixProperties);
felix.start();
}
catch (Exception ex)
{
ex.printStackTrace();
}
 }
 
 The felix properties are defined as following:
 
 private String m_felixAbsolutePath;
 public FelixProperties(String rootpath)
 {
 m_felixAbsolutePath = rootpath;
 put(org.osgi.framework.storage, m_felixAbsolutePath+/felix/cache);
 put(felix.cache.rootdir,m_felixAbsolutePath+/felix);
 put(felix.log.level, 4);
 put(felix.startlevel.bundle, 1);
 put(org.osgi.framework.system.packages.extra,
 ANDROID_PACKAGES_FOR_EXPORT);
 }
 private final String ANDROID_PACKAGES_FOR_EXPORT=
 android;  +
android.app; +
android.content; +
android.database; + etc. etc.
 
 and b:
 
 Manifest-Version: 1.0
 Bundle-Name: drawbundle
 Bundle-Activator: com.osgi.integration.drawbundle.Activator
 Bundle-SymbolicName: com.osgi.integration.drawbundle
 Bundle-Version: 0.0.1
 Import-Package: org.osgi.framework,
 DynamicImport-Package: android.*
 
 I first, to no avail, tried including the Android packages manually in the
 Import-Package statement, like so:
 
 Import-Package: org.osgi.framework,
 android.view.LayoutInflater,
 android.view.View,
 android.widget.LinearLayout,
 android.app.Activity,
 android.app.TextView
 
 I've also tried including the Android jarfile in another bundle, and
 exporting the packages from there, and then importing that bundle in the
 above manifest.
 
 Maurice
 
 On Mon, Apr 2, 2012 at 10:39 AM, Angelo van der Sijpt 
 angelo.vandersi...@luminis.eu wrote:
 
 This could have something to do with the way you instantiate your
 framework, _or_ with the way your bundle is packaged.
 Could you post (a) your framework instantiation code, and (b) the manifest
 of your bundle?
 
 Angelo
 
 
 On Apr 2, 2012, at 10:18 AM, M. van Ree wrote:
 
 Hello all,
 
 I have a problem when trying to make the Android lib available to my OSGi
 bundles.
 The error I'm getting is:
 
 04-02 08:03:00.351: W/dalvikvm(18531): Method mismatch: onDraw in
 Lcom/osgi/integration/drawbundle/DrawView; (cl=0x4067bb40) and super
 Landroid/view/View; (cl=0x0)
 04-02 08:03:00.391: W/System.err(18531): Caused by:
 java.lang.LinkageError:
 Classes resolve differently in superclass
 
 Off course I can see the cl=0x0, so that must be the culprit, but I have
 no
 idea on how to get it fixed...
 I'm exporting the packages as following in a properties class:
 
 private static final String ANDROID_PACKAGES_FOR_EXPORT =
 (android;  +
 android.app; +
 android.content; +
 android.database; +
etc. etc. );
 
 I'm really drawing a blank here on what could be wrong, I would expect to
 receive an error on exporting/importing something empty that would point
 me
 in the right direction, but it doesn't seem to be the case.
 Who can tell me what I'm doing wrong here?
 
 
 Regards,
 Maurice
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
 For additional commands, e-mail: users-h...@felix.apache.org
 
 
 
 
 -- 
 Met vriendelijke groet,
 
 Maurice van Ree



-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org



Re: Problem when exporting system packages from Android to bundles

2012-04-02 Thread Angelo van der Sijpt
Hi Maurice,

See inline.

On Apr 2, 2012, at 11:51 AM, M. van Ree wrote:

 I was considering the use of BNDTools indeed, and will look into that for
 sure now.
 I didn't know about the Bundle-ManifestVersion, will look into that too!
 The comma is indeed a copy-paste error, as you can see in the bottom import
 statement, I closed the last one without a comma. But, sharp to notice!

Well, it's important to have a good view of what actually is going on in your 
code (it could be a simple typo).

 
 As far as tools go, I'm just using Eclipse Indigo and the latest Android
 SDK, dexing and packaging jars with the tools (dx and aapt) from the SDK.
 When opening the bundle jarfile, the API isn't in there, I don't know what
 happens after installing and starting the bundle on Felix though...I can
 actually install a bundle and print something to the console or use Log.d
 to show a message in Logcat, so the bundle (without using Android
 libraries) does seem to be packaged in the right way I guess?

You can use dexdump to inspect the (dalvik-)contents of a bundle.

 
 I'll report back here how things work out after trying BNDTools.

Good luck!

 
 Maurice

Angelo

 
 On Mon, Apr 2, 2012 at 11:18 AM, Angelo van der Sijpt 
 angelo.vandersi...@luminis.eu wrote:
 
 Right.
 
 I'm not entirely sure what's up, but some things come to mind,
 - in stead of building the manifest by hand, you should consider using
 something like BND (perhaps with BNDTools, if you're an Eclipse user) to
 handle that for you. If you don't need to use DynamicImport, stick with
 'regular' imports: that way, the framework can inform you better about
 what's wrong.
 - your bundle should have a Bundle-ManifestVersion: 2 to state that it
 is an R4 bundle (again, BND will do that for you).
 - your Import-Package statement seems to have a comma after
 org.osgi.framework . I'm not sure whether that is a copy-paste error, or
 whether it is actually relevant. (insert-bnd-notice/)
 - what tools do you use for building your project? Is it possible that the
 Android API ends up _inside_ your bundle?
 
 Angelo
 
 On Apr 2, 2012, at 10:59 AM, M. van Ree wrote:
 
 Hello Angelo,
 
 Thank you for your fast response!
 Here is some more info:
 
 a:
 public FelixManager(String rootPath)
 {
 this.rootPath = rootPath;
 felixProperties = new FelixProperties(this.rootPath);
 
   bundlesDir = new File(rootPath+/felix/bundle);
   if (!bundlesDir.exists()) {
if (!bundlesDir.mkdirs()) {
throw new IllegalStateException(Unable to create bundles dir);
}
   }
   cacheDir = new File(rootPath+/felix/cache);
   if (!cacheDir.exists()) {
if (!cacheDir.mkdirs()) {
throw new IllegalStateException(Unable to create felixcache
 dir);
}
   }
 
   try
   {
   felix = new Felix(felixProperties);
   felix.start();
   }
   catch (Exception ex)
   {
   ex.printStackTrace();
   }
 }
 
 The felix properties are defined as following:
 
 private String m_felixAbsolutePath;
 public FelixProperties(String rootpath)
 {
 m_felixAbsolutePath = rootpath;
 put(org.osgi.framework.storage, m_felixAbsolutePath+/felix/cache);
 put(felix.cache.rootdir,m_felixAbsolutePath+/felix);
 put(felix.log.level, 4);
 put(felix.startlevel.bundle, 1);
 put(org.osgi.framework.system.packages.extra,
 ANDROID_PACKAGES_FOR_EXPORT);
 }
 private final String ANDROID_PACKAGES_FOR_EXPORT=
 android;  +
   android.app; +
   android.content; +
   android.database; + etc. etc.
 
 and b:
 
 Manifest-Version: 1.0
 Bundle-Name: drawbundle
 Bundle-Activator: com.osgi.integration.drawbundle.Activator
 Bundle-SymbolicName: com.osgi.integration.drawbundle
 Bundle-Version: 0.0.1
 Import-Package: org.osgi.framework,
 DynamicImport-Package: android.*
 
 I first, to no avail, tried including the Android packages manually in
 the
 Import-Package statement, like so:
 
 Import-Package: org.osgi.framework,
 android.view.LayoutInflater,
 android.view.View,
 android.widget.LinearLayout,
 android.app.Activity,
 android.app.TextView
 
 I've also tried including the Android jarfile in another bundle, and
 exporting the packages from there, and then importing that bundle in the
 above manifest.
 
 Maurice
 
 On Mon, Apr 2, 2012 at 10:39 AM, Angelo van der Sijpt 
 angelo.vandersi...@luminis.eu wrote:
 
 This could have something to do with the way you instantiate your
 framework, _or_ with the way your bundle is packaged.
 Could you post (a) your framework instantiation code, and (b) the
 manifest
 of your bundle?
 
 Angelo
 
 
 On Apr 2, 2012, at 10:18 AM, M. van Ree wrote:
 
 Hello all,
 
 I have a problem when trying to make the Android lib available to my
 OSGi
 bundles.
 The error I'm getting is:
 
 04-02 08:03:00.351: W/dalvikvm(18531): Method mismatch: onDraw in
 Lcom/osgi/integration/drawbundle/DrawView; (cl=0x4067bb40) and super
 Landroid/view/View; (cl=0x0)
 04-02 08:03:00.391: W/System.err(18531

Re: Anybody using ExtHttpService?

2012-01-31 Thread Angelo van der Sijpt
There's no need to get a reference to the ExtHttpService if you just want
to register a Filter using the whiteboard pattern, see
http://felix.apache.org/site/apache-felix-http-service.html#ApacheFelixHTTPService-UsingtheWhiteboard.

Remember that you will need to have either the HttpService whiteboard
handler bundle (org.apache.felix.http.whiteboard) or the all-in-one bundle
(org.apache.felix.http.bundle) in your framework for this to work.

Angelo

On Mon, Jan 30, 2012 at 6:16 PM, Ivanhoe Abrahams ivanhoeabrah...@gmail.com
 wrote:

 Hi All

 I would really like to use org.apache.felix.http.api.ExtHttpService so that
 I can programmatically register a filter (whiteboard pattern, dont want to
 use web.xml).
 I have read through the Apache Felix HTTP Service page and in there it says
 to use ExtHttpService is  exported by both jetty and the bridged
 implementation

 Now I have both jetty 7.4.5.v20111024 installed AND Apache Felix Http
 Bridge version 2.2.0 installed but still my servicetracker
 tracking ExtHttpService never gets called. I dont' see any errors and when
 I look in the webconsole all bundles have started successfully.

 I am not sure why I cant get a hold of ExtHttpService.
 Any advice appreciated.

 BTW. I am running Felix 4.0.2 on a windows machine

 Regards
 Ivanhoe



Re: BundleException: Unresolved constraint in bundle (package=org.apache.commons.lang)

2011-05-07 Thread Angelo van der Sijpt
Your bundle correctly imports org.apache.commons.lang, hoping that someone else 
exports it. You can basically do two things now,
- make sure someone exports it, by packaging commons-lang in a bundle, and 
exporting the packages from it (there might be one out there), or
- embed the classes you need in your bundle by adding 
Embed-Dependency*;scope=compile/Embed-Dependency to your bundle plugin 
instructions.

In your case, the latter is probably the easiest thing to do, even if this 
means you have multiple bundles using classes from commons-lang.

Angelo


On May 7, 2011, at 5:02 PM, Bahadir Konu wrote:

 Hi everybody,
 
 I am new to Felix. I tried to read mail archive messages and documentation
 but still I couldnt solve the problem and I m losing time.
 
 I have a bundle created by maven bundle plugin. I put that jar to
 FELIX_HOME/bundle
 When I run felix, I get his error:
 
 ERROR: Bundle DynamicCalculator [5] Error starting
 file:/C:/tools/felix-framework-3.2.1/bundle/service-1.0.jar
 (org.osgi.framework.BundleException: Unresolved constraint in bundle
 DynamicCalculator [5]: Unable to resolve 5.0: missing requirement [5.0]
 package;
 ((package=org.apache.commons.lang)(version=2.5.0)(!(version=3.0.0
 
 My POM is:
 
modelVersion4.0.0/modelVersion
groupIdcom.bkonu.calculator/groupId
artifactIdservice/artifactId
version1.0/version
packagingbundle/packaging
 
dependencies
dependency
groupIdcommons-lang/groupId
artifactIdcommons-lang/artifactId
version2.5/version
/dependency
dependency
groupIdorg.apache.felix/groupId
artifactIdorg.apache.felix.framework/artifactId
version2.0.0/version
/dependency
 
/dependencies
 
build
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
version2.0.2/version
configuration
source1.6/source
target1.6/target
/configuration
/plugin
 
plugin
groupIdorg.apache.felix/groupId
artifactIdmaven-bundle-plugin/artifactId
extensionstrue/extensions
configuration
instructions
 
 Bundle-SymbolicNameDynamicCalculatorService/Bundle-SymbolicName
Import-Package*/Import-Package
 
 Export-Packagecom.bkonu.calculator.service/Export-Package
 
 Bundle-Activatorcom.bkonu.calculator.ExpressionEvaluatorActivator/Bundle-Activator
 
/instructions
/configuration
/plugin
/plugins
/build
 
 In the error message we see: (version=2.5.0)(!(version=3.0.0)   What s the
 meaning of this?
 
 The manifest file in the jar is:
 
 Manifest-Version: 1.0
 Export-Package: com.bkonu.calculator.service;uses:=org.apache.commons
 .lang
 Tool: Bnd-1.15.0
 Bundle-Name: Unnamed - com.bkonu.calculator:service:bundle:1.0
 Created-By: Apache Maven Bundle Plugin
 Build-Jdk: 1.6.0_22
 Bundle-Version: 1.0.0
 Bnd-LastModified: 1304778448213
 Bundle-ManifestVersion: 2
 Bundle-Activator: com.bkonu.calculator.ExpressionEvaluatorActivator
 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0
 Bundle-SymbolicName: DynamicCalculatorService
 Import-Package: com.bkonu.calculator.service,org.apache.commons.lang;v
 ersion=[2.5,3),org.osgi.framework;version=[1.5,2)
 
 Should I change felix's config.properties? (Doesn't sound very logical for a
 maven dependency like apache.commons.lang)
 
 Can anybody help please?
 
 Thanks,
 Bahadır Konu


-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org



Re: how to list all classes from exported packages of a bundle?

2011-05-06 Thread Angelo van der Sijpt
You could take a look at this Stackoverflow question: 
http://stackoverflow.com/questions/5856096/osgi-get-list-of-classes-in-package

The question assumes you know what package you're talking about, and you can 
find the exported packages by using 
BundleWiring.getProvidedWires(BundleRevision.PACKAGE_NAMESPACE).

Angelo

On May 6, 2011, at 3:05 PM, Cristiano Gavião wrote:

 Hi,
 
 I have a no-osgi api that I'm trying to port to osgi. In this api I have a 
 method that searchs for all classes in classpath that contain one 
 determinated annotation. So I want to do the same on OSGi.
 
 I've started this challenge by creating one service bundle and I've create 
 fragments where is the searchable classes. I can find the properties 
 resources from the fragment nicely... but I can't find a solution for classes 
 investigation. :-s
 
 I've found one service (org.osgi.service.packageadmin.PackageAdmin) that 
 gives me the exported packages and fragments (despite the fact it is 
 deprecated and is not part of OSGi 4.3 anymore) of a bundle. But the problem 
 is that the ExportedPackages don't gives me any option to list the classes 
 contained by it.
 
 How could I do that ?
 
 thanks for any help.
 
 regards,
 
 Cristiano
 
 -
 To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
 For additional commands, e-mail: users-h...@felix.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org



Re: Bundle-NativeCode question.

2011-04-28 Thread Angelo van der Sijpt
Hi Duncan,

Bundle-NativeCode will probably be your best bet: it allows you to leave the 
selection of the library up to the framework, and you can quite easily reload 
your library by updating the bundle.
You will have to load your libraries with System.loadLibrary, OSGi only takes 
care of selecting the right library for you. Note that different os's can have 
different ways of naming their libraries: for instance, you can use 
loadLibrary(library) to load 'library.dll' on windows, but on Linux it will 
be 'liblibrary.so' (iirc). This naming convention might be the cause of your 
problem.
If loading the libraries using loadLibrary form outside OSGi, there is no 
reason this shouldn't work in OSGi.

Angelo

On Apr 28, 2011, at 8:08 PM, duncan wrote:

 We are accessing native libraries from Java. This works outside of
 OSGi and in OSGi on Windows but not on Linux probably because the dll
 and so linking behave differently.
 
 I have tried the following experiments:
 
 1) add libraries to LD_LIBRARY_PATH and System.loadLibrary() only the
 top level JNI library. The dependent libraries are all linked
 implicitly and the unit tests run.
 
 2) add libraries to LD_LIBRARY_PATH and explicitly load them all in
 reverse dependency order. The libraries link but the tests fail at run
 time with inscrutable errors from the C code.
 
 3) add all libraries to Bundle-NativeCode entry . Explicitly load only
 the JNI library. Fails to link with the other libraries.  [This would
 have been my preferred approach]
 
 4) add all libraries to Bundle-NativeCode entry and explicitly load
 them all in reverse dependency order. The libraries link but the tests
 fail at run time with inscrutable errors from the C code.
 
 5) tried all of the above with Felix and Equinox.
 
 So it appears that OSGi requires that I explicitly use
 System.loadLibrary for all the libraries. However, the C libraries
 that I am trying to use are not able to withstand this on Linux (but
 they do on Windows). These are native libraries from a major vendor
 and there is little chance of them patching them for me.
 
 If the libraries can be loaded from LD_LIBRARY_PATH then you would
 think that OSGi should also work. But OSGi appears to require that I
 explicitly load all libraries myself which resolves the dependencies
 in a subtly different way to how the LD_LIBRARY_PATH approach behaves.
 
 So possible outcomes are:
 
 1) if the libraries can be loaded from LD_LIBRARY_PATH then OSGi
 should reasonably be expected to load them as well.
 2) OSGi works like this for a reason and native libraries need to be
 redesigned so they can withstand being loaded explicitly.
 
 I am considering writing a bundle that iterates through all the
 resolved bundles (at start up) and copy their .so files into a common
 location that I will put on the java.library.path. I believe this
 would work but feels like a hack.
 
 Any comments or suggestions would be most appreciated.
 
 Cheers,
 
 Duncan
 
 -
 To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
 For additional commands, e-mail: users-h...@felix.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org



Re: NoClassDefFoundError when embedding felix

2011-04-04 Thread Angelo van der Sijpt
Hi Adrian,

Hm, I'm not entirely sure what the problem is, but it it seems very likely that 
the Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA=com.bt.test; version=1.0.0 you 
set has something to do with it, especially because the problem goes away when 
your bundle has its own package set to something else. Does your fixed version 
still have this, and if so, why?

However, even with this fix, I'm at a loss why this all of a sudden works. Do 
you mean the activator exception goes away, or does your test code (where you 
get the service) actually work? If so, something else is going on: your service 
interface is inside your dictionary bundle, and cannot be seen by the Main 
class, not even when you put it on the classpath (again, something with 
importing and exporting). In this situation, I would expect a 
classcastexception.

As a general tip, I would try stripping out as much code as possible to find 
your problem. To do your testing, you can probably get away with about five 
lines of code, something like
FrameworkFactory factory = (FrameworkFactory) 
Class.forName(org.apache.felix.framework.FrameworkFactory).newInstance();
Bundle framework = factory.newFramework(null);
framework.start();
Bundle bundle = framework.getBundleContext().installBundle(new 
File(/tmp/bundles/dictionaryBundle.jar).toURL().toString());
bundle.start();

This allows you to study the embedding behavior quite well.

By the way, you are right about the do-not-import-when-on-bundle-classpath: 
there is no need to import anything you have in your own bundle (unless you 
also export it).

Angelo


On Apr 4, 2011, at 4:00 PM, adrian.p.sm...@bt.com adrian.p.sm...@bt.com 
wrote:

 OK, so my colleague seems to have a resolution;
 
 1. We have separated the packages of the bundle and the host application and 
 amended the manifest accordingly:
 
 Bundle-Name: English dictionary
 Bundle-Description: A bundle that registers an English dictionary service
 Bundle-Vendor: Apache Felix
 Bundle-ClassPath: commons-lang-2.3.jar, .
 Bundle-Version: 1.0.0
 Bundle-Activator: com.bt.test.dictionary.DictionaryActivator
 Export-Package: com.bt.test.dictionary
 Import-Package: org.osgi.framework, com.bt.test
 
 
 package com.bt.test;
 
 public interface Service {
   public boolean checkWord(String word);
 }
 
 
 package com.bt.test.dictionary;
 
 import com.bt.test.Service;
 
 public interface DictionaryService extends Service
 {
   
 }
 
 Why this works, I don't fully understand and why the original worked inside 
 the command line Felix is also a mystery!
 
 
 -Original Message-
 From: adrian.p.sm...@bt.com [mailto:adrian.p.sm...@bt.com] 
 Sent: 04 April 2011 14:29
 To: users@felix.apache.org
 Subject: RE: NoClassDefFoundError when embedding felix
 
 Absolutely
 
 The bundle manifest:
 
 Bundle-Name: English dictionary
 Bundle-Description: A bundle that registers an English dictionary service
 Bundle-Vendor: Apache Felix
 Bundle-ClassPath: commons-lang-2.3.jar, .
 Bundle-Version: 1.0.0
 Bundle-Activator: com.bt.test.DictionaryActivator
 Export-Package: com.bt.test
 Import-Package: org.osgi.framework
 
 adrian@adrian-small-laptop:/tmp/bundles$ jar tvf dictionaryBundle.jar 
 0 Mon Apr 04 12:57:10 BST 2011 META-INF/
   424 Mon Apr 04 12:57:08 BST 2011 META-INF/MANIFEST.MF
 0 Mon Apr 04 12:57:08 BST 2011 com/
 0 Mon Apr 04 12:57:08 BST 2011 com/bt/
 0 Mon Apr 04 12:57:08 BST 2011 com/bt/test/
  1744 Mon Apr 04 12:57:08 BST 2011 com/bt/test/DictionaryActivator.class
   882 Mon Apr 04 12:57:08 BST 2011 com/bt/test/DictionaryImpl.class
   171 Mon Apr 04 12:57:08 BST 2011 com/bt/test/DictionaryService.class
 245274 Tue Feb 13 18:32:02 GMT 2007 commons-lang-2.3.jar
 
 
 
 The Main code:
 
 package com.bt.test;
 
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.Util;
 import org.apache.felix.main.AutoProcessor;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.launch.Framework;
 import org.osgi.framework.launch.FrameworkFactory;
 
 public class Main {
   public static final String BUNDLE_DIR_SWITCH = -b;
   public static final String SHUTDOWN_HOOK_PROP = felix.shutdown.hook;
   public static final String SYSTEM_PROPERTIES_PROP = 
 felix.system.properties;
   public static final String SYSTEM_PROPERTIES_FILE_VALUE = 
 system.properties;
   public static final String CONFIG_PROPERTIES_PROP = 
 felix.config.properties;
   public static final String 

Re: Exporting same package multiple from bundles

2009-04-22 Thread Angelo van der Sijpt
I agree with Neil that this is probably not the way you want to customize 
Xstream, by replacing classes.

However, Xstream allows you to write your own convertors, which, when you 
register them with the registerConverter(...) method, will take precedence over 
the Xstream's own convertors.

Depending on the measure of flexibiliy you need, you could either
- instruct the user of the Xstream bundle to register this convertor, or
- give the user some XstreamFactory service, which allows him to create an 
Xstream instance that you have already customized, or even
- create a mechanism in which you register custom convertors as OSGi services, 
which then get picked up by the XstreamFactory.

Hope this helps,

Angelo


On 22/04/2009 00:50, Brendan Haverlock brend...@webreachinc.com wrote:

Yes, you are correct.  I want to replace the PropertiesConverter.class in the 
com.thoughtworks.xstream.converters.collections with the 
PropertiesConverter.class in the same package in another bundle.  There is a 
minor tweak I need that I patched in my copy.

Right now, I currently have these bnd files for my two bundles:

Bundle-Name: Misc
Require-Bundle: xstream-1.2.2;visibility:=reexport

Bundle-SymbolicName: xstream-1.2.2
Export-Package: 
com.thoughtworks.xstream.converters.collections;xstream-1.2.2=split;mandatory:=xstream-1.2.2,*

Misc contains my class that I wrote, and xstream-1.2.2 is just the standard 
xstream jar.

Thank you,

Brendan Haverlock
WebReach, Inc.
Software Engineer
Work: 949-255-5054
AIM: wr brendanh

-Original Message-
From: Neil Bartlett [mailto:njbartl...@gmail.com]
Sent: Tuesday, April 21, 2009 3:26 PM
To: users@felix.apache.org
Subject: Re: Exporting same package multiple from bundles

What you're doing wrong first of all is focussing on this as a build
problem, which presupposes what you think you want to have at runtime.

Please could you clarify what you need to happen. You said that you
wrote a custom properties converter... is this a replacement for a
class in the xstream base APIs? And you want to patch your single
class into the xstream package without losing the existing classes in
that package?

Neil


On Tue, Apr 21, 2009 at 11:19 PM, Brendan Haverlock
brend...@webreachinc.com wrote:
 Oops, I meant to say that I am using the bndwrap ant task.



 Anywho, I stopped trying to use Require-Bundle because it didn't do anything
 with the classpath.  It only required that xstream was there in order for my
 local bundle to start, which makes sense.



 I searched some more and it said to deal with split packages you need to use
 the split package directive with bnd.  So, what I tried was this in my bnd
 file:



 Bundle-Name: Misc

 Export-Package:
 com.thoughtworks.xstream.converters.collections;-split-package:=merge-last,o
 rg.*



 What I want it to do is merge this package with xstream's, so that my
 converter will override the other.  However, this one is taking precedence
 and I am still getting the warning that it can't find any of the other
 xstream converters from the xstream bundle.



 Any idea what I am doing wrong?



 Thanks,



 Brendan Haverlock



 From: Brendan Haverlock [mailto:brend...@webreachinc.com]
 Sent: Tuesday, April 21, 2009 1:33 PM
 To: users@felix.apache.org
 Subject: Exporting same package multiple from bundles



 Hi guys,



 I have two bundles that both export the same package because I want one of
 the bundles to override the classes in the other.  Basically, I wrote a
 custom properties converter for xstream, and I have to override the one in
 the xstream bundle with the one I wrote in one of my bundles.



 I hear that the only way to get around this issue is to use the
 Require-Bundle feature when creating the bundles.  However, I am using bnd
 within ant to generate my bundles.  I tried putting Require-Bundle: xstream
 in my bnd file but it is not making a difference when it bundles my jar.
 Can anyone give me pointers on how to get this working?



 Thanks!!



 Brendan Haverlock





-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org




Re: org.osgi.service.cm package.

2008-06-03 Thread Angelo van der Sijpt
Alternatively, if you don't actually need a configadmin, you can use  
the org.osgi.compendium bundle from the same download location. If you  
use any other compendium services, you will need that anyway.


Angelo

On 3 Jun 2008, at 06:50, Martin Thelian wrote:


It's in the Configadmin-bundle. You can download it here [1]

Regards,
Martin

[1] http://felix.apache.org/site/downloads.cgi

Mathieu Plourde schrieb:

Hello all,
  Where is the org.osgi.service.cm package? I need to export it  
somehow
because dependencymanager imports it. I'm having a bundle exception  
on

runtime because it can't find that package.

Thank you!





-
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]



Re: NoClassDefFoundError: org/osgi/framework/BundleActivator

2008-01-22 Thread Angelo van der Sijpt

Hello Han,

You should make sure there is a line break after the last line of the  
manifest, otherwise it will not be processed (and, indeed, the NCDFE  
you get is caused by a class coming from org.osgi.framework).


Angelo

On 22 Jan 2008, at 10:05, Han Liu wrote:


The NoClassDefFoundError: org/osgi/framework/BundleActivator

I got the exception below

org.osgi.framework.BundleException: Activator start error.
at org.apache.felix.framework.Felix._startBundle(Felix.java:1580)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1470)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:354)
	at  
org 
.apache 
.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:82)
	at org.apache.felix.shell.impl.Activator 
$ShellServiceImpl.executeCommand(Activator.java:265)
	at org.apache.felix.shell.tui.Activator 
$ShellTuiRunnable.run(Activator.java:167)

at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: org/osgi/framework/ 
BundleActivator

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
	at  
org 
.apache 
.felix 
.framework 
.searchpolicy.ContentClassLoader.findClass(ContentClassLoader.java: 
162)
	at  
org 
.apache 
.felix 
.framework 
.searchpolicy 
.ContentClassLoader.loadClassFromModule(ContentClassLoader.java:51)
	at  
org 
.apache 
.felix 
.framework 
.searchpolicy.ContentLoaderImpl.getClass(ContentLoaderImpl.java:121)
	at  
org 
.apache 
.felix 
.framework 
.searchpolicy 
.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:397)
	at  
org 
.apache 
.felix 
.framework 
.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java: 
175)
	at  
org 
.apache 
.felix 
.framework.searchpolicy.R4SearchPolicy.findClass(R4SearchPolicy.java: 
45)
	at  
org.apache.felix.moduleloader.ModuleImpl.getClass(ModuleImpl.java:152)
	at  
org.apache.felix.framework.Felix.createBundleActivator(Felix.java: 
3426)

at org.apache.felix.framework.Felix._startBundle(Felix.java:1531)
... 6 more
java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator



the manifest file is

Bundle-Name: English dictionary
Bundle-Description: A bundle that registers an English dictionary  
service

Bundle-Vendor: Apache Felix
Bundle-Version: 1.0.0
Bundle-Activator: example.dictionary.Activator
Import-Package: org.osgi.framework

and there is nothing special  in example.dictionary.Activator (It is a
copy of the example)


I'm a starter,  and I'm so upset to meet the problem. I am using JDK6



2 Is that the contexts in each bundle activator's start method are  
different?


3 How to install a bundle in program without typing command in the  
shell.


-
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]



Re: Bundle in RESOLVED state even after a class has been loaded by that bundle

2008-01-10 Thread Angelo van der Sijpt

Hello Sahoo,

The thing you're seeing is exactly what it should do. The RESOLVED  
state means that, on the module layer, all the bundle's imports are  
available (the manifest's ImportPackage: statements), and its exports  
are done too. Now, any bundle that imports packages which are  
exported by your test-bundle, can load classes from those packages.


In short, the RESOLVED state handles the package wiring, only in the  
ACTIVE state all services are registered, but that has nothing to do  
with the ability to load classes.


Hope that helps,

Angelo

On Jan 11, 2008, at 7:52 , Sahoo wrote:


Hi,

I am observing a strange thing. I see a bundle in RESOLVED state  
even after a class has been successfully loaded from that bundle.  
How is this possible? I am explicitly starting the bundle from  
another bundle and loading a class using Bundle.loadClass. Based on  
the following output (with annotations), I have concluded that the  
class has indeed been loaded by the bundle in question.


- Jan 11, 2008 11:32:26 AM BundleListenerImpl bundleChanged
INFO: event source= sahoo.hk2-test2 [29], type= 32 *#RESOLVED state*

Jan 11, 2008 11:32:26 AM ModuleImpl loadClass
INFO: aClass.getClassLoader() = 29.0  *#29 corresponds to my hk2- 
test2 bundle which is in RESOLVED state*


- ps
START LEVEL 1
  ID   State Level  Name
[   0] [Active ] [0] System Bundle (1.1.0.SNAPSHOT)
[   1] [Active ] [1] Apache Felix Shell Service  
(1.1.0.SNAPSHOT)

[   2] [Active ] [1] Apache Felix Shell TUI (1.1.0.SNAPSHOT)
[   3] [Active ] [1] Apache Felix Bundle Repository  
(1.1.0.SNAPSHOT)

[   4] [Installed  ] [1] osgi-test1 (1.0.0.SNAPSHOT)
[  28] [Active ] [1] osgi-hk2 (1.0.0.SNAPSHOT)
[  29] [Resolved   ] [1] hk2-test2 (1.0.0.SNAPSHOT) *# RESOLVED  
state*



Thanks,
Sahoo

-
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]