You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Steven E. Harris" <se...@panix.com> on 2007/03/01 19:42:00 UTC

Problem trying to use iPOJO Maven plugin

I'm attempting to follow the iPOJO tutorial¹ in creating an
iPOJO-managed bundle. Specifically, I'm trying to define a factory
component inside this bundle.

The POM declares a packaging-type of "ipojo-bundle". There's an iPOJO
metadata file called "metadata.xml" available at the root of the JAR's
resource directory.

The plugin configuration element is as follows, using version
0.7.0-incubator-SNAPSHOT of the plugin:

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>org.apache.felix.ipojo.plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <osgiManifest>
            <bundleName>${pom.name}</bundleName>
            <bundleDescription>${pom.description}</bundleDescription>
            <!--<exportPackage></exportPackage>-->
            <!--<ipojoMetadata>metadata.xml</ipojoMetadata>-->
          </osgiManifest>
        </configuration>
      </plugin>

I assumed that most of these values would have sensible defaults like
the maven-bundle-plugin. Uncommenting the ipojoMetadata element fails
during "mvn package" with this error:

,----
| org.codehaus.plexus.component.configurator.ComponentConfigurationException:
| Cannot find setter nor field in
| org.apache.felix.ipojo.plugin.OsgiManifest for 'ipojoMetadata'
`----

When I comment that element out and trust the default, I see the
following error:

,----
| org.apache.maven.plugin.MojoExecutionException:
| [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest
`----

In context:

[INFO] [org.apache.felix.ipojo.:ipojo-bundle]
[INFO] Generating JAR bundle <mybundle>.jar
[INFO] No manifest file specified. Default will be used.
[INFO] iPOJO Manipulation ...
[ERROR] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest, please
in the osgi-bundle packaging instead og ipojo-bundle
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error assembling JAR bundle

Embedded error: [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error assembling JAR bundle
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
        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:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR bundle
        at org.apache.felix.ipojo.plugin.OsgiJarMojo.execute(OsgiJarMojo.java:167)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        ... 16 more
Caused by: org.apache.maven.plugin.MojoExecutionException: [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest
        at org.apache.felix.ipojo.plugin.OsgiJarMojo.iPojoManipulation(OsgiJarMojo.java:932)
        at org.apache.felix.ipojo.plugin.OsgiJarMojo.performPackaging(OsgiJarMojo.java:207)
        at org.apache.felix.ipojo.plugin.OsgiJarMojo.execute(OsgiJarMojo.java:164)
        ... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Thu Mar 01 10:33:14 PST 2007
[INFO] Final Memory: 4M/8M
[INFO] ------------------------------------------------------------------------


Are there some other steps I need to follow to get this to work?


Footnotes: 
¹ http://cwiki.apache.org/FELIX/ipojo-tutorial-07.html

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by Clement Escoffier <cl...@gmail.com>.
Richard S. Hall a écrit :
> Steven E. Harris wrote:
>> Clement Escoffier <cl...@gmail.com> writes:
>>
>>  
>>> If you want to create on POJO object, add immediate="true" in the
>>> component tag. By default, the POJO instantiation are delayed
>>> (lazzy). If you do not have "immediate="true" or a invalid->invalid
>>> callback, your POJO is not instantiated until it is really needed
>>> (to serve a service for example).
>>>     
>>
>> That's not what I'm seeing here. I took another bundle of mine that
>> exposes one service. Here's the iPOJO metadata file with the names
>> changed:
>>
>> ,----
>> | <?xml version="1.0" encoding="UTF-8"?>
>> | <iPOJO>
>> |    <component className="mycorp.Service"
>> |               factory="no">
>> |       <provides/>
>> |    </component>
>> |    <instance component="mycorp.Service"
>> |              name="myservice"/>
>> | </iPOJO>
>> `----
>>
>> Note that by specifying the "factory" attribute as "no", my intention
>> was to not expose a service factory for this component.
>>
>> When this bundle starts, I see that it's registered a service with
>> "mycorp.Service" as the service class, a "factory.pid" property of
>> "mycorp.Service", and a "service.pid" property of "myservice". No
>> other bundles are using the service or have every requested it, so I'm
>> surprised to see the service registered.
>>
>> I'm trying to emulate the lazy loading and exposure of services
>> (non-immediate, delayed activation) provided by DS. Does iPOJO offer
>> the same capability? It looks like the "mycorp.Service" component
>> described above is being treated as an "immediate" component, at least
>> by default.
>
> Your above metadata is creating an instance of your component with the 
> <instance> element, thus you are seeing a service being registered 
> immediately. However, an actual component instance should not be 
> created until someone actually tries to use the service. At least that 
> is my understanding of how iPOJO works by default.
You understand correctly ;-)

The component attribute disable the exposition of factory services (both 
ManagedServiceFactory and iPOJO Factory). As you declare an instance, it 
create the container of the instance. But, the content is empty. The 
service provided by the instance is published (it's one of the task 
managed by the container). The instance content is only created when 
needed (i.e. when the service is used).

Clement

-- 
Clement Escoffier
Grenoble University
LSR - Bat. C
220, Rue de la Chimie
BP 53
38041 GRENOBLE CEDEX 9
04.76.51.40.24
http://clement.plop-plop.net



Re: Problem trying to use iPOJO Maven plugin

Posted by "Steven E. Harris" <se...@panix.com>.
"Richard S. Hall" <he...@ungoverned.org> writes:

> However, an actual component instance should not be created until
> someone actually tries to use the service. At least that is my
> understanding of how iPOJO works by default.

Oh, you're right. I instrumented the constructor and now I see it
doesn't get run until another bundle requests the service.

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Steven E. Harris wrote:
> Clement Escoffier <cl...@gmail.com> writes:
>
>   
>> If you want to create on POJO object, add immediate="true" in the
>> component tag. By default, the POJO instantiation are delayed
>> (lazzy). If you do not have "immediate="true" or a invalid->invalid
>> callback, your POJO is not instantiated until it is really needed
>> (to serve a service for example).
>>     
>
> That's not what I'm seeing here. I took another bundle of mine that
> exposes one service. Here's the iPOJO metadata file with the names
> changed:
>
> ,----
> | <?xml version="1.0" encoding="UTF-8"?>
> | <iPOJO>
> |    <component className="mycorp.Service"
> |               factory="no">
> |       <provides/>
> |    </component>
> |    <instance component="mycorp.Service"
> |              name="myservice"/>
> | </iPOJO>
> `----
>
> Note that by specifying the "factory" attribute as "no", my intention
> was to not expose a service factory for this component.
>
> When this bundle starts, I see that it's registered a service with
> "mycorp.Service" as the service class, a "factory.pid" property of
> "mycorp.Service", and a "service.pid" property of "myservice". No
> other bundles are using the service or have every requested it, so I'm
> surprised to see the service registered.
>
> I'm trying to emulate the lazy loading and exposure of services
> (non-immediate, delayed activation) provided by DS. Does iPOJO offer
> the same capability? It looks like the "mycorp.Service" component
> described above is being treated as an "immediate" component, at least
> by default.

Your above metadata is creating an instance of your component with the 
<instance> element, thus you are seeing a service being registered 
immediately. However, an actual component instance should not be created 
until someone actually tries to use the service. At least that is my 
understanding of how iPOJO works by default.

-> richard

Re: Problem trying to use iPOJO Maven plugin

Posted by "Steven E. Harris" <se...@panix.com>.
Clement Escoffier <cl...@gmail.com> writes:

> If you want to create on POJO object, add immediate="true" in the
> component tag. By default, the POJO instantiation are delayed
> (lazzy). If you do not have "immediate="true" or a invalid->invalid
> callback, your POJO is not instantiated until it is really needed
> (to serve a service for example).

That's not what I'm seeing here. I took another bundle of mine that
exposes one service. Here's the iPOJO metadata file with the names
changed:

,----
| <?xml version="1.0" encoding="UTF-8"?>
| <iPOJO>
|    <component className="mycorp.Service"
|               factory="no">
|       <provides/>
|    </component>
|    <instance component="mycorp.Service"
|              name="myservice"/>
| </iPOJO>
`----

Note that by specifying the "factory" attribute as "no", my intention
was to not expose a service factory for this component.

When this bundle starts, I see that it's registered a service with
"mycorp.Service" as the service class, a "factory.pid" property of
"mycorp.Service", and a "service.pid" property of "myservice". No
other bundles are using the service or have every requested it, so I'm
surprised to see the service registered.

I'm trying to emulate the lazy loading and exposure of services
(non-immediate, delayed activation) provided by DS. Does iPOJO offer
the same capability? It looks like the "mycorp.Service" component
described above is being treated as an "immediate" component, at least
by default.

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by Clement Escoffier <cl...@gmail.com>.
Steven E. Harris a écrit :
> Clement Escoffier <cl...@gmail.com> writes:
>
>   
>> Yes, it is but it does nothing. iPOJO will publish an
>> ManagedServiceFacotry service with foo.factory as service.pid. You
>> can create component instances via this service.
>>     
>
> When you say "it does nothing", do you just mean that no instances
> actually get created? If so, all is well, as it's just the provision
> of the ManagedServiceFactory that I was after here.
>   
Yes, it does not create any instance. Moreover, once you create an 
instance with the factory, this instance will do nothing with the 
following metadata :
<iPOJO>
    <component className="Foo" factory="foo.factory"/>
</iPOJO>

If you want to create on POJO object, add immediate="true" in the 
component tag. By default, the POJO instantiation are delayed (lazzy). 
If you do not have "immediate="true" or a invalid->invalid callback, 
your POJO is not instantiated until it is really needed (to serve a 
service for example).
> Looking at my bundle running, I see the ManagedServiceFactory is
> registered.
>
>   
>> Else, you can create instances dynamically with another service :
>> org.apache.felix.ipojo.Factory. This service does not have exactly
>> the same semantic as ManagedServiceFactory.
>>     
>
> Can you summarize briefly why one would choose to use iPOJO's Factory
> interface rather than ManagedServiceFactory?
>   
It is the same difference than between ManagedServiceFactory and DS 
ComponentFactory. However, the iPOJO Factory allows to get the 
component-type description, check if a configuration is acceptable or not ..

To create instances, with the ManagedServiceFactory, you push a new 
configuration. With iPOJO Factory, you will call createInstance, then 
you received a reference on the instance. You have a stronger control on it.
The instance modification is not supported by iPOJO Factory. However, 
for the Managed ServiceFactory, when an instance is modified, the 
instance is killed and re-created with the new configuration (I am not 
sure that's consitent with the DS specification).
To delete an instance with the ManagedServiceFactory, you called the 
delete method. With the iPOJO Factory, you stop the instance. (stop is 
similar to the DS dispose method).

>
> [...]
>
> Thanks for the prompt explanation.
>   
You're welcome.

Clement


-- 
Clement Escoffier
Grenoble University
LSR - Bat. C
220, Rue de la Chimie
BP 53
38041 GRENOBLE CEDEX 9
04.76.51.40.24
http://clement.plop-plop.net


Re: Problem trying to use iPOJO Maven plugin

Posted by "Steven E. Harris" <se...@panix.com>.
Clement Escoffier <cl...@gmail.com> writes:

> Yes, it is but it does nothing. iPOJO will publish an
> ManagedServiceFacotry service with foo.factory as service.pid. You
> can create component instances via this service.

When you say "it does nothing", do you just mean that no instances
actually get created? If so, all is well, as it's just the provision
of the ManagedServiceFactory that I was after here.

Looking at my bundle running, I see the ManagedServiceFactory is
registered.

> Else, you can create instances dynamically with another service :
> org.apache.felix.ipojo.Factory. This service does not have exactly
> the same semantic as ManagedServiceFactory.

Can you summarize briefly why one would choose to use iPOJO's Factory
interface rather than ManagedServiceFactory?

> No, this behavior cannot be disable, it is the base of iPOJO.

[...]

Thanks for the prompt explanation.

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by Clement Escoffier <cl...@gmail.com>.
>
> Now, I'm trying to understand how to arrange for iPOJO to provide a
> ManagedServiceFactory on my behalf. The "How to use iPOJO factories"
> document¹ says:
>
>   How to use the ManagedServiceFactory to create instances
>
>   The principle of the ManagedServiceFactory is the same as the iPOJO
>   Factory Service. To have further information on it, read the OSGi R4
>   Compendium - Configuration Admin chapter.
>   
I know, it is a little short ;-)
> There's earlier discussion of the "factory" attribute on the iPOJO
> "component" element. If I have a class "Foo" that I want to be exposed
> as the component type for a factory to create, is the following
> sufficient?
>
>   <?xml version="1.0" encoding="UTF-8"?>
>   <iPOJO>
>     <component className="Foo" factory="foo.factory"/>
>   </iPOJO>
>   
Yes, it is but it does nothing. iPOJO will publish an 
ManagedServiceFacotry service with foo.factory as service.pid. You can 
create component instances via this service. Else, you can create 
instances dynamically with another service  : 
org.apache.felix.ipojo.Factory. This service does not have exactly the 
same semantic as ManagedServiceFactory.

> Also, I noticed that the iPOJO plugin creates directives by inspecting
> class "Foo" above, and mentioning its various member variables and
> their types. If I don't want these fields to be manipulated by iPOJO,
> can I do anything to disable this behavior. Actually, I'm not really
> sure what iPOJO is going to do with that member-related information;
> I'm just fearing the worst.
>   
No, this behavior cannot be disable, it is the base of iPOJO.
All your fields will be manipulated to allow iPOJO management. However, 
if the container does not use these fields, it does nothing.
iPOJO write manipulation data in the manifest in order to check 
component type metadata against your class (for example, it checks that 
a dependency field exists in your class ...). Moreover, it allows 
decreasing the number of information to write in your metadata. For 
example, if you have an aggregate dependency, you don't have to write 
something like "multiple="true"" because the manipulation metadata allow 
to know that it is an array. I don't use reflection for performance purpose.


Clement


-- 
Clement Escoffier
Grenoble University
LSR - Bat. C
220, Rue de la Chimie
BP 53
38041 GRENOBLE CEDEX 9
04.76.51.40.24
http://clement.plop-plop.net



Re: Problem trying to use iPOJO Maven plugin

Posted by "Steven E. Harris" <se...@panix.com>.
"Steven E. Harris" <se...@panix.com> writes:

>             <!--<ipojoMetadata>metadata.xml</ipojoMetadata>-->

Ah, that has to be

  <iPOJOMetadata>metadata.xml</iPOJOMetadata>
    ^^^^                        ^^^^

Now, I'm trying to understand how to arrange for iPOJO to provide a
ManagedServiceFactory on my behalf. The "How to use iPOJO factories"
document¹ says:

  How to use the ManagedServiceFactory to create instances

  The principle of the ManagedServiceFactory is the same as the iPOJO
  Factory Service. To have further information on it, read the OSGi R4
  Compendium - Configuration Admin chapter.

There's earlier discussion of the "factory" attribute on the iPOJO
"component" element. If I have a class "Foo" that I want to be exposed
as the component type for a factory to create, is the following
sufficient?

  <?xml version="1.0" encoding="UTF-8"?>
  <iPOJO>
    <component className="Foo" factory="foo.factory"/>
  </iPOJO>

Also, I noticed that the iPOJO plugin creates directives by inspecting
class "Foo" above, and mentioning its various member variables and
their types. If I don't want these fields to be manipulated by iPOJO,
can I do anything to disable this behavior. Actually, I'm not really
sure what iPOJO is going to do with that member-related information;
I'm just fearing the worst.


Footnotes: 
¹ http://cwiki.apache.org/FELIX/how-to-use-ipojo-factories.html

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by "Steven E. Harris" <se...@panix.com>.
Clement Escoffier <cl...@gmail.com> writes:

> The actual (distributed) iPOJO Plugin is based on the old OSGi Maven
> Plugin. There is no default value.

One suggestion for the tutorial: advise specifying a
Bundle-SymbolicName header with a <bundleSymbolicName> element, as the
plugin does not create one by default. I like to use the default
provided by the maven-bundle-plugin, ${pom.artifactId}.

I noticed that Equinox exhibits a few display-level quirks when this
header is absent (though it still behaves properly otherwise).

> A version based on BND exists but still under test.

I will await that one eagerly.

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by Clement Escoffier <cl...@gmail.com>.
Steven E. Harris a écrit :
> Clement Escoffier <cl...@gmail.com> writes:
>
>   
>> Maven is case sensitive. You need to write :
>> <iPOJOMetadata>metadata.xml</iPOJOMetadata>
>> instead of
>> <ipojoMetadata>metadata.xml</ipojoMetadata>
>>     
>
> Got it. On the subject of the iPOJO plugin, what do you think about
> the Bundle-Name and Bundle-Description directives (among others)
> taking on defaults like the maven-bundle-plugin, as described here
> under "Default Behavior"?
>
>   http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html
>
>   
The actual (distributed) iPOJO Plugin is based on the old OSGi Maven 
Plugin. There is no default value. A version based on BND exists but 
still under test.

Clement

-- 
Clement Escoffier
Grenoble University
LSR - Bat. C
220, Rue de la Chimie
BP 53
38041 GRENOBLE CEDEX 9
04.76.51.40.24
http://clement.plop-plop.net


Re: Problem trying to use iPOJO Maven plugin

Posted by "Steven E. Harris" <se...@panix.com>.
Clement Escoffier <cl...@gmail.com> writes:

> Maven is case sensitive. You need to write :
> <iPOJOMetadata>metadata.xml</iPOJOMetadata>
> instead of
> <ipojoMetadata>metadata.xml</ipojoMetadata>

Got it. On the subject of the iPOJO plugin, what do you think about
the Bundle-Name and Bundle-Description directives (among others)
taking on defaults like the maven-bundle-plugin, as described here
under "Default Behavior"?

  http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Steven E. Harris wrote:
> "Richard S. Hall" <he...@ungoverned.org> writes:
>
>   
>> The tutorial should be updated then...is this actually being generated
>> correctly by the archetype?
>>     
>
> It was only by backing up and inspecting the archetype's output that I
> realized I should try a different case than what the tutorial had
> showed, so yes, the archetype is correct.

Ok, thanks. I updated the tutorial.

-> richard

Re: Problem trying to use iPOJO Maven plugin

Posted by "Steven E. Harris" <se...@panix.com>.
"Richard S. Hall" <he...@ungoverned.org> writes:

> The tutorial should be updated then...is this actually being generated
> correctly by the archetype?

It was only by backing up and inspecting the archetype's output that I
realized I should try a different case than what the tutorial had
showed, so yes, the archetype is correct.

-- 
Steven E. Harris

Re: Problem trying to use iPOJO Maven plugin

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Clement Escoffier wrote:
> Hello,
>
> Maven is case sensitive. You need to write :
> <iPOJOMetadata>metadata.xml</iPOJOMetadata>
> instead of
> <ipojoMetadata>metadata.xml</ipojoMetadata>

The tutorial should be updated then...is this actually being generated 
correctly by the archetype?

-> richard

>
> This file contains your component type description, and created 
> instances. It is a mandatory file to use iPOJO.
>
> Regards,
>
> Clement
>
> Steven E. Harris a écrit :
>> I'm attempting to follow the iPOJO tutorial¹ in creating an
>> iPOJO-managed bundle. Specifically, I'm trying to define a factory
>> component inside this bundle.
>>
>> The POM declares a packaging-type of "ipojo-bundle". There's an iPOJO
>> metadata file called "metadata.xml" available at the root of the JAR's
>> resource directory.
>>
>> The plugin configuration element is as follows, using version
>> 0.7.0-incubator-SNAPSHOT of the plugin:
>>
>>       <plugin>
>>         <groupId>org.apache.felix</groupId>
>>         <artifactId>org.apache.felix.ipojo.plugin</artifactId>
>>         <extensions>true</extensions>
>>         <configuration>
>>           <osgiManifest>
>>             <bundleName>${pom.name}</bundleName>
>>             <bundleDescription>${pom.description}</bundleDescription>
>>             <!--<exportPackage></exportPackage>-->
>>             <!--<ipojoMetadata>metadata.xml</ipojoMetadata>-->
>>           </osgiManifest>
>>         </configuration>
>>       </plugin>
>>
>> I assumed that most of these values would have sensible defaults like
>> the maven-bundle-plugin. Uncommenting the ipojoMetadata element fails
>> during "mvn package" with this error:
>>
>> ,----
>> | 
>> org.codehaus.plexus.component.configurator.ComponentConfigurationException: 
>>
>> | Cannot find setter nor field in
>> | org.apache.felix.ipojo.plugin.OsgiManifest for 'ipojoMetadata'
>> `----
>>
>> When I comment that element out and trust the default, I see the
>> following error:
>>
>> ,----
>> | org.apache.maven.plugin.MojoExecutionException:
>> | [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the 
>> manifest
>> `----
>>
>> In context:
>>
>> [INFO] [org.apache.felix.ipojo.:ipojo-bundle]
>> [INFO] Generating JAR bundle <mybundle>.jar
>> [INFO] No manifest file specified. Default will be used.
>> [INFO] iPOJO Manipulation ...
>> [ERROR] Neither iPOJO-Metadata nor iPOJO-Components are in the 
>> manifest, please
>> in the osgi-bundle packaging instead og ipojo-bundle
>> [INFO] 
>> ------------------------------------------------------------------------
>> [ERROR] BUILD ERROR
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] Error assembling JAR bundle
>>
>> Embedded error: [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components 
>> are in the manifest
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] Trace
>> org.apache.maven.lifecycle.LifecycleExecutionException: Error 
>> assembling JAR bundle
>>         at 
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564) 
>>
>>         at 
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480) 
>>
>>         at 
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459) 
>>
>>         at 
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) 
>>
>>         at 
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) 
>>
>>         at 
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) 
>>
>>         at 
>> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
>>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
>>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>>         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:597)
>>         at 
>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>         at 
>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>> Caused by: org.apache.maven.plugin.MojoExecutionException: Error 
>> assembling JAR bundle
>>         at 
>> org.apache.felix.ipojo.plugin.OsgiJarMojo.execute(OsgiJarMojo.java:167)
>>         at 
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420) 
>>
>>         at 
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) 
>>
>>         ... 16 more
>> Caused by: org.apache.maven.plugin.MojoExecutionException: [iPOJO] 
>> Neither iPOJO-Metadata nor iPOJO-Components are in the manifest
>>         at 
>> org.apache.felix.ipojo.plugin.OsgiJarMojo.iPojoManipulation(OsgiJarMojo.java:932) 
>>
>>         at 
>> org.apache.felix.ipojo.plugin.OsgiJarMojo.performPackaging(OsgiJarMojo.java:207) 
>>
>>         at 
>> org.apache.felix.ipojo.plugin.OsgiJarMojo.execute(OsgiJarMojo.java:164)
>>         ... 18 more
>> [INFO] 
>> ------------------------------------------------------------------------
>> [INFO] Total time: 3 seconds
>> [INFO] Finished at: Thu Mar 01 10:33:14 PST 2007
>> [INFO] Final Memory: 4M/8M
>> [INFO] 
>> ------------------------------------------------------------------------
>>
>>
>> Are there some other steps I need to follow to get this to work?
>>
>>
>> Footnotes: ¹ http://cwiki.apache.org/FELIX/ipojo-tutorial-07.html
>>
>>   
>
>

Re: Problem trying to use iPOJO Maven plugin

Posted by Clement Escoffier <cl...@gmail.com>.
Hello,

Maven is case sensitive. You need to write :
<iPOJOMetadata>metadata.xml</iPOJOMetadata>
instead of
<ipojoMetadata>metadata.xml</ipojoMetadata>

This file contains your component type description, and created 
instances. It is a mandatory file to use iPOJO.

Regards,

Clement

Steven E. Harris a écrit :
> I'm attempting to follow the iPOJO tutorial¹ in creating an
> iPOJO-managed bundle. Specifically, I'm trying to define a factory
> component inside this bundle.
>
> The POM declares a packaging-type of "ipojo-bundle". There's an iPOJO
> metadata file called "metadata.xml" available at the root of the JAR's
> resource directory.
>
> The plugin configuration element is as follows, using version
> 0.7.0-incubator-SNAPSHOT of the plugin:
>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>org.apache.felix.ipojo.plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>           <osgiManifest>
>             <bundleName>${pom.name}</bundleName>
>             <bundleDescription>${pom.description}</bundleDescription>
>             <!--<exportPackage></exportPackage>-->
>             <!--<ipojoMetadata>metadata.xml</ipojoMetadata>-->
>           </osgiManifest>
>         </configuration>
>       </plugin>
>
> I assumed that most of these values would have sensible defaults like
> the maven-bundle-plugin. Uncommenting the ipojoMetadata element fails
> during "mvn package" with this error:
>
> ,----
> | org.codehaus.plexus.component.configurator.ComponentConfigurationException:
> | Cannot find setter nor field in
> | org.apache.felix.ipojo.plugin.OsgiManifest for 'ipojoMetadata'
> `----
>
> When I comment that element out and trust the default, I see the
> following error:
>
> ,----
> | org.apache.maven.plugin.MojoExecutionException:
> | [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest
> `----
>
> In context:
>
> [INFO] [org.apache.felix.ipojo.:ipojo-bundle]
> [INFO] Generating JAR bundle <mybundle>.jar
> [INFO] No manifest file specified. Default will be used.
> [INFO] iPOJO Manipulation ...
> [ERROR] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest, please
> in the osgi-bundle packaging instead og ipojo-bundle
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] Error assembling JAR bundle
>
> Embedded error: [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest
> [INFO] ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error assembling JAR bundle
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>         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:597)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR bundle
>         at org.apache.felix.ipojo.plugin.OsgiJarMojo.execute(OsgiJarMojo.java:167)
>         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
>         ... 16 more
> Caused by: org.apache.maven.plugin.MojoExecutionException: [iPOJO] Neither iPOJO-Metadata nor iPOJO-Components are in the manifest
>         at org.apache.felix.ipojo.plugin.OsgiJarMojo.iPojoManipulation(OsgiJarMojo.java:932)
>         at org.apache.felix.ipojo.plugin.OsgiJarMojo.performPackaging(OsgiJarMojo.java:207)
>         at org.apache.felix.ipojo.plugin.OsgiJarMojo.execute(OsgiJarMojo.java:164)
>         ... 18 more
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 3 seconds
> [INFO] Finished at: Thu Mar 01 10:33:14 PST 2007
> [INFO] Final Memory: 4M/8M
> [INFO] ------------------------------------------------------------------------
>
>
> Are there some other steps I need to follow to get this to work?
>
>
> Footnotes: 
> ¹ http://cwiki.apache.org/FELIX/ipojo-tutorial-07.html
>
>   


-- 
Clement Escoffier
Grenoble University
LSR - Bat. C
220, Rue de la Chimie
BP 53
38041 GRENOBLE CEDEX 9
04.76.51.40.24
http://clement.plop-plop.net