You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Christopher Armstrong <ca...@fastmail.com.au> on 2009/04/22 07:08:05 UTC

Deployment Admin and resource processors

I'm working with the Felix SVN implementations of the Deployment Admin  
service and the Autoconf resource processor. I'm generating a  
deployment package that contains one autoconf resource, which in turn  
contains a configuration for a ManagedServiceFactory that is already  
running in the framework. It contains no bundle resources

My problem is that when I call DeploymentAdmin.installBundle, I'm  
getting a DeploymentException of type  
DeploymentException.CODE_FOREIGN_CUSTOMIZER. I traced this back to the  
code that generates this exception (see the following stack trace. I  
noticed that inside  
org.apache.felix.deploymentadmin.spi.ProcessResourceCommand.execute(),  
it seems to be checking to see if the resource processor service came  
from a bundle inside the deployment package. I am running  
deploymentadmin, autoconf and dependencymanager as separate bundles,  
installed manually into the framework.

I've been reading the OSGi specification, and whilst I can find this  
error message, I can't seem to find any information which suggests  
that a resource processor must be in the deployment package that uses  
it. I would like to avoid this scenario if necessary (and I don't see  
how such a situation would work, especially if multiple deployment  
packages use the same resource processor.

Does anyone have any ideas about this?

Thanks
Chris

--------
Christopher Armstrong
carmstrong@fastmail.com.au

-----------------------------------------------------------

My stack trace is:
Problem installing deployment package:  
org.osgi.service.deploymentadmin.DeploymentException: Resource  
processor for resource 'META-INF/metatype/testserver1.xml' belongs to  
foreign deployment package
	org.osgi.service.deploymentadmin.DeploymentException: Resource  
processor for resource 'META-INF/metatype/testserver1.xml' belongs to  
foreign deployment package
	at  
org 
.apache 
.felix 
.deploymentadmin 
.spi.ProcessResourceCommand.execute(ProcessResourceCommand.java:108)
	at  
org 
.apache 
.felix 
.deploymentadmin 
.spi.DeploymentSessionImpl.call(DeploymentSessionImpl.java:71)
	at  
org 
.apache 
.felix 
.deploymentadmin 
.DeploymentAdminImpl.installDeploymentPackage(DeploymentAdminImpl.java: 
215)
	at  
org 
.forge 
.smartdata 
.configuration 
.da.internal.DAEclipseConsoleImpl._dainstall(DAEclipseConsoleImpl.java: 
46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal 
.core 
.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java: 
150)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal.core.FrameworkConsole.console(FrameworkConsole.java:287)
	at  
org 
.eclipse 
.osgi 
.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:223)
	at java.lang.Thread.run(Thread.java:613)

The documentation on this error code from the OSGi specification says  
(osgi4.cmpn pp376):
Matched resource processor service is a customizer from another deploy-
ment package.
DeploymentAdmin.installDeploymentPackage(InputStream) throws
exception with this error code.

And it seems to suggest that resource processors can come from  
anywhere (from osgi4.cmpn pp386, section 114.15.4) :
ResourceProcessor interface is implemented by processors handling
resource files in deployment packages. Resource Processors expose  
their ser-
vices as standard OSGi services. Bundles exporting the service may  
arrive in
the deployment package (customizers) or may be  preregistered (they are
installed prevoiusly). Resource processors has to define the   
service.pid stan-
dard OSGi service property which should be a unique string.

Deployment package MANIFEST.MF:

Manifest-Version: 1.0
DeploymentPackage-Version: 1.0.0.20090422141925256
DeploymentPackage-SymbolicName: org.forge.smartdata.objectConfiguratio
  n

Name: META-INF/metatype/testserver1.xml
Resource-Processor: org.osgi.deployment.rp.autoconf





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


Re: Deployment Admin and resource processors

Posted by Christopher Armstrong <ca...@fastmail.com.au>.
Hi Christian

I did a bit more reading and it appears that this is the case. But it  
still seems to be problematic that this restriction is in place. If I  
must include the autoconf bundle in every deployment package, it  
effectively means that every deployment package will have a copy of  
the same bundle. Won't this confuse the Deployment Admin service and  
framework because it is trying to install multiple copies of the same  
bundle?

Unless, this statement is intended to be interpreted narrowly such  
that: if a resource processor is installed in a customizer in a  
deployment package (as opposed to in a bundle on its own), it can only  
be used with that deployment package. OTOH, if it is installed as part  
of a bundle using installBundle(), it can be used with any deployment  
package? I'm tempted to believe that this is the correct  
interpretation because many the examples in the specification provide  
full manifests using resource processors without actually including a  
customizer bundle. Also, section 114.9 discusses procedures for  
handling the case when a resource processor is not available at the  
time of uninstall of a deployment package, which would imply that a  
resource processor is not tied to the lifecycle of a deployment  
package unless it appears inside a customizer bundle inside that  
deployment package.

Reading the specification, I get the impression that customizer  
bundles and resource processors are separate concepts. Section  
114.15.4 seems to reinforce that idea (suggesting that a resource  
processor can "pre-registered" (installed previously).

Cheers
Chris


On 22/04/2009, at 5:02 PM, Christian van Spaandonk wrote:

> Hi Chris,
>
> The behaviour you are seeing is correct as far as I can tell, the  
> compendium spec 114.8#9 confirms this:
>
> "9. Assert that the matched Resource Processor service is not from a  
> Cus-
> tomizer bundle in another Deployment Package. "
>
> friendly,
> Christian
>
> ________________________________________
> From: Christopher Armstrong [carmstrong@fastmail.com.au]
> Sent: Wednesday, April 22, 2009 7:08 AM
> To: users@felix.apache.org
> Subject: Deployment Admin and resource processors
>
> I'm working with the Felix SVN implementations of the Deployment Admin
> service and the Autoconf resource processor. I'm generating a
> deployment package that contains one autoconf resource, which in turn
> contains a configuration for a ManagedServiceFactory that is already
> running in the framework. It contains no bundle resources
>
> My problem is that when I call DeploymentAdmin.installBundle, I'm
> getting a DeploymentException of type
> DeploymentException.CODE_FOREIGN_CUSTOMIZER. I traced this back to the
> code that generates this exception (see the following stack trace. I
> noticed that inside
> org.apache.felix.deploymentadmin.spi.ProcessResourceCommand.execute(),
> it seems to be checking to see if the resource processor service came
> from a bundle inside the deployment package. I am running
> deploymentadmin, autoconf and dependencymanager as separate bundles,
> installed manually into the framework.
>
> I've been reading the OSGi specification, and whilst I can find this
> error message, I can't seem to find any information which suggests
> that a resource processor must be in the deployment package that uses
> it. I would like to avoid this scenario if necessary (and I don't see
> how such a situation would work, especially if multiple deployment
> packages use the same resource processor.
>
> Does anyone have any ideas about this?
>
> Thanks
> Chris
>
> --------
> Christopher Armstrong
> carmstrong@fastmail.com.au
>
> -----------------------------------------------------------
>
> My stack trace is:
> Problem installing deployment package:
> org.osgi.service.deploymentadmin.DeploymentException: Resource
> processor for resource 'META-INF/metatype/testserver1.xml' belongs to
> foreign deployment package
>        org.osgi.service.deploymentadmin.DeploymentException: Resource
> processor for resource 'META-INF/metatype/testserver1.xml' belongs to
> foreign deployment package
>        at
> org
> .apache
> .felix
> .deploymentadmin
> .spi.ProcessResourceCommand.execute(ProcessResourceCommand.java:108)
>        at
> org
> .apache
> .felix
> .deploymentadmin
> .spi.DeploymentSessionImpl.call(DeploymentSessionImpl.java:71)
>        at
> org
> .apache
> .felix
> .deploymentadmin
> .DeploymentAdminImpl 
> .installDeploymentPackage(DeploymentAdminImpl.java:
> 215)
>        at
> org
> .forge
> .smartdata
> .configuration
> .da 
> .internal.DAEclipseConsoleImpl._dainstall(DAEclipseConsoleImpl.java:
> 46)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>        at
> sun
> .reflect
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:
> 25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org
> .eclipse
> .osgi
> .framework
> .internal
> .core
> .FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:
> 150)
>        at
> org
> .eclipse
> .osgi
> .framework
> .internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302)
>        at
> org
> .eclipse
> .osgi
> .framework
> .internal.core.FrameworkConsole.console(FrameworkConsole.java:287)
>        at
> org
> .eclipse
> .osgi
> .framework.internal.core.FrameworkConsole.run(FrameworkConsole.java: 
> 223)
>        at java.lang.Thread.run(Thread.java:613)
>
> The documentation on this error code from the OSGi specification says
> (osgi4.cmpn pp376):
> Matched resource processor service is a customizer from another  
> deploy-
> ment package.
> DeploymentAdmin.installDeploymentPackage(InputStream) throws
> exception with this error code.
>
> And it seems to suggest that resource processors can come from
> anywhere (from osgi4.cmpn pp386, section 114.15.4) :
> ResourceProcessor interface is implemented by processors handling
> resource files in deployment packages. Resource Processors expose
> their ser-
> vices as standard OSGi services. Bundles exporting the service may
> arrive in
> the deployment package (customizers) or may be  preregistered (they  
> are
> installed prevoiusly). Resource processors has to define the
> service.pid stan-
> dard OSGi service property which should be a unique string.
>
> Deployment package MANIFEST.MF:
>
> Manifest-Version: 1.0
> DeploymentPackage-Version: 1.0.0.20090422141925256
> DeploymentPackage-SymbolicName: org.forge.smartdata.objectConfiguratio
>  n
>
> Name: META-INF/metatype/testserver1.xml
> Resource-Processor: org.osgi.deployment.rp.autoconf
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

--------
Christopher Armstrong
carmstrong@fastmail.com.au






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


RE: Deployment Admin and resource processors

Posted by Christian van Spaandonk <ch...@luminis.nl>.
Hi Chris,

The behaviour you are seeing is correct as far as I can tell, the compendium spec 114.8#9 confirms this:

"9. Assert that the matched Resource Processor service is not from a Cus- 
tomizer bundle in another Deployment Package. "

friendly,
 Christian

________________________________________
From: Christopher Armstrong [carmstrong@fastmail.com.au]
Sent: Wednesday, April 22, 2009 7:08 AM
To: users@felix.apache.org
Subject: Deployment Admin and resource processors

I'm working with the Felix SVN implementations of the Deployment Admin
service and the Autoconf resource processor. I'm generating a
deployment package that contains one autoconf resource, which in turn
contains a configuration for a ManagedServiceFactory that is already
running in the framework. It contains no bundle resources

My problem is that when I call DeploymentAdmin.installBundle, I'm
getting a DeploymentException of type
DeploymentException.CODE_FOREIGN_CUSTOMIZER. I traced this back to the
code that generates this exception (see the following stack trace. I
noticed that inside
org.apache.felix.deploymentadmin.spi.ProcessResourceCommand.execute(),
it seems to be checking to see if the resource processor service came
from a bundle inside the deployment package. I am running
deploymentadmin, autoconf and dependencymanager as separate bundles,
installed manually into the framework.

I've been reading the OSGi specification, and whilst I can find this
error message, I can't seem to find any information which suggests
that a resource processor must be in the deployment package that uses
it. I would like to avoid this scenario if necessary (and I don't see
how such a situation would work, especially if multiple deployment
packages use the same resource processor.

Does anyone have any ideas about this?

Thanks
Chris

--------
Christopher Armstrong
carmstrong@fastmail.com.au

-----------------------------------------------------------

My stack trace is:
Problem installing deployment package:
org.osgi.service.deploymentadmin.DeploymentException: Resource
processor for resource 'META-INF/metatype/testserver1.xml' belongs to
foreign deployment package
        org.osgi.service.deploymentadmin.DeploymentException: Resource
processor for resource 'META-INF/metatype/testserver1.xml' belongs to
foreign deployment package
        at
org
.apache
.felix
.deploymentadmin
.spi.ProcessResourceCommand.execute(ProcessResourceCommand.java:108)
        at
org
.apache
.felix
.deploymentadmin
.spi.DeploymentSessionImpl.call(DeploymentSessionImpl.java:71)
        at
org
.apache
.felix
.deploymentadmin
.DeploymentAdminImpl.installDeploymentPackage(DeploymentAdminImpl.java:
215)
        at
org
.forge
.smartdata
.configuration
.da.internal.DAEclipseConsoleImpl._dainstall(DAEclipseConsoleImpl.java:
46)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
        at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org
.eclipse
.osgi
.framework
.internal
.core
.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:
150)
        at
org
.eclipse
.osgi
.framework
.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:302)
        at
org
.eclipse
.osgi
.framework
.internal.core.FrameworkConsole.console(FrameworkConsole.java:287)
        at
org
.eclipse
.osgi
.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:223)
        at java.lang.Thread.run(Thread.java:613)

The documentation on this error code from the OSGi specification says
(osgi4.cmpn pp376):
Matched resource processor service is a customizer from another deploy-
ment package.
DeploymentAdmin.installDeploymentPackage(InputStream) throws
exception with this error code.

And it seems to suggest that resource processors can come from
anywhere (from osgi4.cmpn pp386, section 114.15.4) :
ResourceProcessor interface is implemented by processors handling
resource files in deployment packages. Resource Processors expose
their ser-
vices as standard OSGi services. Bundles exporting the service may
arrive in
the deployment package (customizers) or may be  preregistered (they are
installed prevoiusly). Resource processors has to define the
service.pid stan-
dard OSGi service property which should be a unique string.

Deployment package MANIFEST.MF:

Manifest-Version: 1.0
DeploymentPackage-Version: 1.0.0.20090422141925256
DeploymentPackage-SymbolicName: org.forge.smartdata.objectConfiguratio
  n

Name: META-INF/metatype/testserver1.xml
Resource-Processor: org.osgi.deployment.rp.autoconf





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


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