Re: Invalid BundleContext

2008-11-03 Thread jaredmac
OK, I've almost got it figured out. The issue is that stopBundle() is indeed being called on a bundle, and this causes its BundleContext to be invalid. The reason stopBundle() is being called is that I'm using start levels, and doing the following: (1) Installing (and starting) bundles (with d

Re: Invalid BundleContext

2008-10-29 Thread jaredmac
Hello group, Sorry this issue won't go away, but I've accumulated some more information that might be helpful. First, I learned that the "Invalid BundleContext" error is often (but not always) immediately followed by a "component is already registered" error: ERROR: org.apache.felix.scr (2):

Felix should handle URL encoding

2008-09-29 Thread jaredmac
Shouldn't it? For example, I got bit by this: java.lang.RuntimeException: org.osgi.framework.BundleException: Unable to cache bundle: reference:file:/C:/Temp/osgi%20dir/test.jar when using File.toURI() to translate a filename into a URL for installing a bundle. The problem is easily worked aro

Re: Invalid BundleContext

2008-09-17 Thread jaredmac
Felix Meschberger-2 wrote: > > There are two configuration settings with respect to start levels: > > felix.startlevel.framework - the initial start level of the > framework, defaulting to 1 (in Apache Sling we set this to 30) > felix.startlevel.bundle - the default start level assign

Re: SCR component already registered

2008-09-17 Thread jaredmac
Felix Meschberger-2 wrote: > > Hi Jared, > > The component names must be unique amongst all components (not just > services) registered in the framework. That is, no two components in a > single framework may have the same name. So chances are, that there is > already such a component registe

SCR component already registered

2008-09-16 Thread jaredmac
Hello, In addition to my "Invalid BundleContext" sporadic issue during unit tests, I'm also getting this even stranger one: ERROR: com.company.product.desktop (2): [editor.lint] Cannot register Component org.osgi.service.component.ComponentException: The component name 'editor.lint' has already

Re: Invalid BundleContext

2008-09-16 Thread jaredmac
jaredmac wrote: > > Sure! Basically, I'm doing the following: > > (1) Start Felix. > (2) Scan the classpath for .jar files that appear to be bundles. > (3) Iterate over the list of bundle names: > (3.a) Install the bundle. > (3.b) Look for an optionally s

Re: Invalid BundleContext

2008-08-27 Thread jaredmac
Karl Pauls wrote: > > Hm, I don't think so. A bundle that started should stay active if it > is not stopped,updated,or uninstalled. In order to be active it's > dependencies must be already satisfied and wired and they will not go > away if nothing is updated/uninstalled and refresh is called, e

Re: Invalid BundleContext

2008-08-24 Thread jaredmac
Hi Felix and Karl, Thanks for the information. A race condition obviously is consistent with the fact that it happens sporadically. Is your diagnosis consistent with the fact that I'm not actually shutting down Felix or stopping any bundles? I'm only starting all my bundles at this point. Tha

Re: Wait for services to be fully registered?

2008-08-22 Thread jaredmac
Marcel Offermans wrote: > > On Aug 22, 2008, at 17:05 , jaredmac wrote: > >> Just to close the loop on this thread, start levels work great to >> accomplish >> what I need. [...] I realize this might not be in Felix's "design >> center,"

Re: Wait for services to be fully registered?

2008-08-22 Thread jaredmac
Richard S. Hall wrote: > > Could you send your entire configuration? > > -> richard > > jaredmac wrote: >> Richard S. Hall wrote: >> >>> No, this is not possible. However, in the config.properties file (or if >>> you are embedding a

Invalid BundleContext

2008-08-22 Thread jaredmac
Hello group, Any idea how I could receive the following error? This is happening after I've started Felix, and I'm starting other bundles (in this case, the error appears to happen when starting the SCR bundle). It does not happen consistently. ERROR: org.apache.felix.scr (2): Error while loadin

Re: Wait for services to be fully registered?

2008-07-17 Thread jaredmac
Richard S. Hall wrote: > > No, this is not possible. However, in the config.properties file (or if > you are embedding a Felix instance, then you pass in the configuration > properties), you can specify which start level bundles will be installed > with. Check this document for the configurat

Re: Wait for services to be fully registered?

2008-07-16 Thread jaredmac
Richard S. Hall wrote: > > However, if you really want to make sure everything starts before your > GUI, you can put all of your service bundles in a lower start level than > your GUI bundle; thus, by the time the GUI bundle starts, then all your > services will be available. > Just followi

Re: Wait for services to be fully registered?

2008-06-11 Thread jaredmac
Felix Meschberger-2 wrote: > > Clients always get a deterministic answer: The services registered at > the time of the call. The non-determinism comes from the fact, that the > services are registered asynchronously, which is by design and good. > Thanks for the explanation. You mentioned a fe

Wait for services to be fully registered?

2008-06-09 Thread jaredmac
Hello, I'm using Felix/SCR for a GUI application. GUI clients want to know what services have registered with a certain interface. However, I get non-deterministic behavior when GUI clients make this query (which occurs right after bundles have been started): i.e., sometimes, there will be 2 serv

Re: ServiceTracker and already registered services

2008-06-09 Thread jaredmac
Elvy wrote: > > Hi there, > > Assume some services are already registered and, at a certain moment, a > new ServiceTracker in installed. > > One could expect that: > - either the services already available are notified so we get > synchronized with the current system state > - or only new re

Re: Are service implementors inherently singletons?

2008-05-06 Thread jaredmac
Felix Meschberger-2 wrote: > > Not as per the OSGi framework specification. You might of course - as I > said above - create a FooFactory and register that factory as a service. > Your application would then get the FooFactory service and ask that > FooFactory for Foo instances. > > Hope this h

Are service implementors inherently singletons?

2008-05-06 Thread jaredmac
Is it true that each component in declarative services is inherently a singleton? That is to say, if I have something like this: then there will only ever be one instance of FooImpl? My use case is that I want the application client to be able to say to Felix: give me a

Re: Arbitrary XML (e.g., like plugin.xml) in Felix bundle

2008-04-24 Thread jaredmac
Stuart McCulloch-3 wrote: > > you mean does Declarative Services have the same > functionality as the Eclipse Extension Point Registry? > > Neil Bartlett has a good review of extension points vs > plain OSGi services which may answer your question: > > http://www.eclipsezone.com/articles/ext

Arbitrary XML (e.g., like plugin.xml) in Felix bundle

2008-04-11 Thread jaredmac
Is there a way to achieve the functionality of Eclipse-like plugin.xml files just using Felix and Declarative Services? Or to include additional data with a plugin, am I limited to name-value pairs in the manifest? Thanks, Jared -- View this message in context: http://www.nabble.com/Arbitrary-

Re: Any way to disable caching in embedded mode?

2008-03-26 Thread jaredmac
Richard S. Hall wrote: > > Felix doesn't automatically delete the cache. If you want to do that, > just modify your application launcher to delete the directory when it > completes, as Karl mention belows. Another option, for debugging > purposes is to install your bundle JAR file by referenc

Any way to disable caching in embedded mode?

2008-03-19 Thread jaredmac
Hello, As I develop with Felix embedded in my host application, I find I have to set a new value for this line of code configProps.setProperty(BundleCache.CACHE_PROFILE_PROP, "testdir53"); every time I make a change to my bundle, which is pretty much every change-compile-test iteration.

Re: Best practice for non-bundle code to access bundles?

2008-03-13 Thread jaredmac
Richard S. Hall wrote: > > Here is the link: > > > http://cwiki.apache.org/FELIX/launching-and-embedding-apache-felix.html > > -> richard > Thanks. That is, of course, exactly what I was looking for (and I already had it bookmarked in my browser, no less!). I've now moved on to bigger an

Best practice for non-bundle code to access bundles?

2008-03-12 Thread jaredmac
I have an application in which non-bundle code would like to access registered services/bundles loaded by Felix. For example, I have Bundle X whose activate() method gets a reference to all the currently registered implementers of Interface Y. Can other non-bundle parts of the application code get

Re: non-jar as bundle unit

2008-03-12 Thread jaredmac
Just to close the loop on this, I've made good progress prototyping bundles in our current system. Basically, I can achieve modularity by having a single manifest file for each existing jar, but having that manifest point to any number of independent XML files in its Service-Component attribute (I

Re: non-jar as bundle unit

2008-03-04 Thread jaredmac
Rodrigo Madera wrote: > > Just to complement McCulloch's input: > > I would not recommend you to use the BND tool directly. Integrate it into > the build manager instead. Depending on your current build tool it can be > easy to integrate it into the build process or not. The fact that your > bu

non-jar as bundle unit

2008-03-03 Thread jaredmac
Hello, Is there any way to have something other than a jar file be a bundle/plugin? That is, is there any way to express that this list of classes, or this particular package, is the bundle? I looked over the OSGi spec and it seems that a bundle is strictly a jar, but I figured I'd ask here. I

Suggestions for tutorials

2008-02-29 Thread jaredmac
After an initial hiccup, I've found these tutorials immensely helpful, and thought I'd offer a few suggestions to make better still. Tutorial Example 1 * Is missing the note about the trailing carriage return (which is rightfully in every other tutorial). Tutorial Example 3 * The tutorial states

Re: "BundleException: unresolved package" while following tutorial

2008-02-29 Thread jaredmac
Oh boy, my mistake. In my various attempts I had left an error in my JAR command, resulting in the paths within the jar as classes/tutorial/example1 rather than tutorial/example1. Naturally the tutorial.example.Activator class couldn't be resolved. The bundle starts up just fine now. Sorry abou

Re: "BundleException: unresolved package" while following tutorial

2008-02-29 Thread jaredmac
To clarify, the manifest that I jar up now looks like this: Bundle-Name: Service listener example Bundle-Description: A bundle that displays messages at startup and when service events occur Bundle-Vendor: Apache Felix Bundle-Version: 1.0.0 Bundle-Activator: tutorial.example1.Activator Import-Pac

Re: "BundleException: unresolved package" while following tutorial

2008-02-29 Thread jaredmac
Richard S. Hall wrote: > > Well, you shouldn't be importing that package, because no one exports > it...it is a private package of the example1 bundle. > > The only import should be org.osgi.framework, just like is shown in the > web page. > Indeed, that's why I wrote that I wasn't sure it

"BundleException: unresolved package" while following tutorial

2008-02-29 Thread jaredmac
Hello! I'm new to Apache Felix, as you can guess from the subject. I did try searching the forums for this problem and didn't find an exact match (and did try related suggestions). I'm following this first tutorial: http://cwiki.apache.org/FELIX/apache-felix-tutorial-example-1.html I've compiled