You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by Wouter Bancken <wo...@aca-it.be> on 2016/02/22 13:03:09 UTC

Updating bundles at runtime

Dear,

We are trying to get to a point where bundles installed through Aries
subsystems can be updated at runtime. The new artifacts for the bundles are
supposed to be retrieved from our maven repositories.

Our current setup is capable of two things:
- Installing bundle jars present as content in ESA archives
- Installing bundles retrieved from our maven repositories based on the
subsystem content of an ESA not containing bundle jars.

When trying to update a bundle (regardless whether it was a packaged jar or
an artifact retrieved from our maven repositories), we run into issues when
resolving the URI.

Specifically we get the following exception:
java.net.MalformedURLException: Unknown protocol: subsystem
at java.net.URL.<init>(URL.java:620)
at
org.apache.felix.framework.util.SecureAction.createURL(SecureAction.java:255)
...
at org.apache.felix.gogo.command.Basic.update(Basic.java:849)
...
Caused by: java.lang.IllegalStateException: Unknown protocol: subsystem
at
org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)
at java.net.URL.<init>(URL.java:615)
... 40 more

When debugging this execution, we looked at the bundle (BundleImpl) used by
Felix and we saw that originalLocation of the BundleArchive is referencing
the subsystem:
"subsystem://?Subsystem-SymbolicName=com.myGroupId.my-subsystem-subsystem&Subsystem-Version=1.0.0.SNAPSHOT!/com.myGroupId.myArtifactId@2.0.0.SNAPSHOT
"

This location explains the unknown protocol when parsing the URI.

Is it possible to influence this originalLocation in Aries? Can you give us
a pointer to where this originalLocation of the installed bundle is set?

Thanks!

Wouter

Re: Updating bundles at runtime

Posted by John Ross <jw...@gmail.com>.
In a typical framework implementation, the supported protocols will be
whatever java.net.URL provides by default (e.g., http, https, ftp, file,
and jar).

That URL is being provided by the subsystems implementation as part of
installing the bundle. The (unofficial) format is "<location of the
subsystem to which the bundle is being provisioned> '!/' <location of the
resource>". When the resource is a bundle that has yet to be installed,
<location of the resource> becomes "<bundle symbolic name> '@' <bundle
version>". This is all done in the BundleResourceInstaller. You have
control over the location of the provisioned to subsystem via the install
parameter. You have no control over the '!/' followed by the computed
bundle location other than through the Bundle-SymbolicName and
Bundle-Version manifest headers.

You may wish to consider using the update method that takes an InputStream
as an argument instead. An alternative would be to add a URL handler for
the subsystem protocol.

On Mon, Feb 22, 2016 at 6:03 AM, Wouter Bancken <wo...@aca-it.be>
wrote:

> Dear,
>
> We are trying to get to a point where bundles installed through Aries
> subsystems can be updated at runtime. The new artifacts for the bundles are
> supposed to be retrieved from our maven repositories.
>
> Our current setup is capable of two things:
> - Installing bundle jars present as content in ESA archives
> - Installing bundles retrieved from our maven repositories based on the
> subsystem content of an ESA not containing bundle jars.
>
> When trying to update a bundle (regardless whether it was a packaged jar
> or an artifact retrieved from our maven repositories), we run into issues
> when resolving the URI.
>
> Specifically we get the following exception:
> java.net.MalformedURLException: Unknown protocol: subsystem
> at java.net.URL.<init>(URL.java:620)
> at
> org.apache.felix.framework.util.SecureAction.createURL(SecureAction.java:255)
> ...
> at org.apache.felix.gogo.command.Basic.update(Basic.java:849)
> ...
> Caused by: java.lang.IllegalStateException: Unknown protocol: subsystem
> at
> org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)
> at java.net.URL.<init>(URL.java:615)
> ... 40 more
>
> When debugging this execution, we looked at the bundle (BundleImpl) used
> by Felix and we saw that originalLocation of the BundleArchive is
> referencing the subsystem:
>
> "subsystem://?Subsystem-SymbolicName=com.myGroupId.my-subsystem-subsystem&Subsystem-Version=1.0.0.SNAPSHOT!/com.myGroupId.myArtifactId@2.0.0.SNAPSHOT
> "
>
> This location explains the unknown protocol when parsing the URI.
>
> Is it possible to influence this originalLocation in Aries? Can you give
> us a pointer to where this originalLocation of the installed bundle is set?
>
> Thanks!
>
> Wouter
>