felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan-Frank Henry" <Frank.He...@gmx.net>
Subject Re: Dumb question about iPojo service structure
Date Wed, 18 Jan 2012 12:21:10 GMT
Hi,

> On 18.01.2012, at 12:27, Bengt Rodehav wrote:
> I'm not an expert on either iPOJO or OSGi although I use them both. One of
> the mistakes I sometimes do is to forget to export my packages. Since you
> have renamed the packages from the example you need to make sure that
> those
> packages are exported. Might be worth to check?
> 
> /Bengt

Thanks for the answer, but like in the examples I used the maven project environment variable:
<Bundle-SymbolicName>
  ${project.artifactId}
</Bundle-SymbolicName>

Though it is like that in the examples, it could also be wrong or something is not picking
it up. Really hard to trace any problems.

br

Frank
 
> 2012/1/18 Stephan-Frank Henry
> 
> >
> > On 17.01.2012, at 17:45, Stephan-Frank Henry wrote:
> > >
> > > On 17.01.2012, at 16:51, Clement Escoffier wrote:
> > >
> > > > Hi,
> > > >
> > > > On 17.01.2012, at 15:48, Stephan-Frank Henry wrote:
> > > >
> > > > >
> > > > > On 17.01.2012, at 11:51, Clement Escoffier  wrote:
> > > > >>
> > > > >> On 17.01.2012, at 11:42, Stephan-Frank Henry wrote:
> > > > >>
> > > > >>> Hi,
> > > > >>>
> > > > >>> first off, thanks for the feedback.
> > > > >>>
> > > > >>> On 17.01.2012, at 11:25, Clement Escoffier wrote:
> > > > >>>
> > > > >>>> Hi,
> > > > >>>>
> > > > >>>> On 17.01.2012, at 10:44, Stephan-Frank Henry wrote:
> > > > >>>>
> > > > >>>>> Howdy,
> > > > >>>>>
> > > > >>>>> I have been following the tutorials on iPojo but
have run into
> a
> > > > snag.
> > > > >>>>> From most of the tutorials, you always have one service
> > definition
> > > > >>>> bundle, N service instances and then the consumers.
> > > > >>>>>
> > > > >>>>> Is it not possible to have one service definition
and on
> service
> > > > >>>> instance in one bundle?
> > > > >>>>> I'm just wondering.
> > > > >>>>
> > > > >>>> Of course :-)
> > > > >>>> The tutorial just use one of the good practice, but you
can
> have
> > > > >>>> everything in one bundle. However, to really benefit
from the
> > > > dynamism
> > > > >> when you
> > > > >>>> update service provider, it's recommended to package
your
> service
> > > > >> interfaces
> > > > >>>> into a separated bundle (evolving more slowly than the
provider
> /
> > > > >> consumer
> > > > >>>> bundles).
> > > > >>>
> > > > >>> I thought so, though that means my code does not work. :(
> > > > >>> I followed the tutorials, but just kept the one service
> definition
> > > and
> > > > >> on service instance in one bundle.
> > > > >>>
> > > > >>> Though when I start felix, it always shows the consumer as
> invalid.
> > > > >>> If I remove the @Requires, it starts the consumer, but that
is
> not
> > > > >> really the goal.
> > > > >>>
> > > > >>> ipojo:instances
> > > > >>> Instance ArchCommand -> valid
> > > > >>> Instance org.apache.felix.ipojo.arch.gogo.Arch-0 -> valid
> > > > >>> Instance HelloConsumer-0 -> invalid
> > > > >>>
> > > > >>> g! ipojo:factories
> > > > >>> Factory com.test.hello.HelloImpl (VALID)
> > > > >>> Factory HelloConsumer (VALID)
> > > > >>
> > > > >> It seems that the service provider is missing.
> > > > >> Could you check with ipojo:instance  HelloConsumer-0
> > > > >
> > > > > g! ipojo:instance  HelloConsumer-0
> > > > > instance name="HelloConsumer-0" component.type="HelloConsumer"
> > > > state="invalid" bundle="10"
> > > > >   handler name="org.apache.felix.ipojo:requires" state="invalid"
> > > > >           requires id="com.test.hello.Hello" aggregate="false"
> > proxy="true"
> > > > optional="false" state="unresolved"
> > specification="com.test.hello.Hello"
> > > > binding-policy="dynamic"
> > > > >   handler name="org.apache.felix.ipojo:callback" state="valid"
> > > > >   handler name="org.apache.felix.ipojo:architecture" state="valid"
> > > > >
> > > > > Is there any way to see the providers? i.e. anything providing
> > > > "com.test.hello.Hello"?
> > > > >
> > > >
> > > > It looks like you don't have any service provider providing
> > > > com.test.hello.Hello.
> > > > In the tutorial, you have 3 bundles: a plain bundle containing the
> > > service
> > > > interface, and 2 iPOJO bundle (one publishing the service and one
> > > > consuming it).
> > >
> > > Yes, as I mentioned I have both the service definition and the service
> > > provider in one bundle.
> > >
> > > I had used the iPojo some time before and know that it works if I have
> > the
> > > 3 independent bundles. Though perhaps I will test it again, just to be
> > > sure an update somewhere did not break the functionality.
> > >
> > > > >
> > > > > Also, since I am packaging both service and service provider into
> one
> > > > bundle, how does the pom.xml have to look like?
> > > > >
> > > > > <instructions>
> > > > > <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
> > > > > <Export-Package>com.test.hello</Export-Package>
> > > > > </instructions>
> > > > >
> > > > > My impl (HelloImpl) is in the same package (com.test.hello).
> > > >
> > > > Then, you need to use the maven-ipojo-plugin for this bundle to
> prepare
> > > > the bundle to be managed by iPOJO. If you're using annotations, just
> > add
> > > the
> > > > following XML snippet to your build section of your pom file:
> > > >
> > > > <plugin>
> > > >       <groupId>org.apache.felix</groupId>
> > > >       <artifactId>maven-ipojo-plugin</artifactId>
> > > >       <version>1.8.0</version>
> > > >       <executions>
> > > >        <execution>
> > > >            <goals>
> > > >                   <goal>ipojo-bundle</goal>
> > > >            </goals>
> > > >       </execution>
> > > >      </executions>
> > > > </plugin>
> > >
> > > I am exactly using that. I have built with package (usually enough)
> and
> > > install, with same results.
> > > So I am kinda confused what I really have to do to get it working.
> > >
> > > I have also tried out different combinations of what is in the
> examples
> > > and what is on the page, as well as Richard's book.
> > > Perhaps that is my problem. ;)
> > >
> > > I'll do the 3-bundle setup tomorrow and if that fixes everything, I'll
> > > stick with it for now.
> > >
> >
> > Update:
> > after moving to the 3-bundle setup and creating a near 1:1 copy of the
> > examples from svn, it (the injection) is still not working.
> > Only the project and package names and the name of the Consumer/Client
> is
> > different.
> > I even copied the maven settings and all (source 1.5, plugin versions,
> no
> > junit). no luck.
> > Though I do not have the same module-based structure as in the examples,
> I
> > did not see any module-parent level settings that are needed.
> >
> > some more info that might help:
> >    0|Active     |    0|System Bundle (4.0.2)
> >    1|Active     |    1|Apache Felix Gogo Command (0.12.0)
> >    2|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
> >    3|Active     |    1|Apache Felix Gogo Shell (0.10.0)
> >    4|Active     |    1|Apache Felix iPOJO (1.8.0)
> >    5|Active     |    1|Apache Felix iPOJO Arch Command (1.6.0)
> >    6|Active     |    1|Apache Felix iPOJO Gogo Command (1.0.1)
> >    7|Active     |    1|Apache Felix iPOJO Composite (1.8.0)
> >    8|Active     |    1|Apache Felix Shell Service (1.4.2)
> >
> >
> > <groupId>org.apache.felix</groupId>
> > <artifactId>maven-ipojo-plugin</artifactId>
> > <!--version>1.8.0</version-->
> > <version>1.6.0</version><!-- examples mention 1.5.0-SNAPSHOT -->
> > neither version 'worked'
> >
> > <groupId>org.apache.felix</groupId>
> > <artifactId>maven-bundle-plugin</artifactId>
> > <!--version>2.3.6</version-->
> > <version>1.4.3</version>
> > neither version 'worked'
> >
> > Apache Maven 3.0.3
> > java version "1.6.0_26"
> > Ubuntu 11.04 natty 2.6.38-13-generic x86_64
> >
> > Dev environment Netbeans, though built from command line.
> > I also used sym-links to link in the bundles from a local repository.
> >
> > my startFelix.sh:
> > ## begin ##
> > _HOME_=$( dirname $(readlink -f $0 ))
> >
> > _OPTS_="-Dfelix.config.properties=file:${_HOME_}/conf/config.properties"
> > _OPTS_="${_OPTS_}
> > -Dfelix.system.properties=file:${_HOME_}/conf/system.properties"
> > _OPTS_="${_OPTS_} -Dfelix.cm.dir=${_HOME_}/conf/"
> >
> > test -e ${_HOME_}/felix-cache/ && rm -rf ${_HOME_}/felix-cache/
> > mkdir -p ${_HOME_}/felix-cache/
> >
> > java -jar \
> >        ${_OPTS_} \
> >        ${_HOME_}/felix-framework-current/bin/felix.jar \
> >        ${_HOME_}/felix-cache/ \
> >        -b ${_HOME_}/auto-deploy/ \
> > ## end ##
> >
> > anything else needed?
> >
> > thanks
> >
> > Frank

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

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


Mime
View raw message