Thanks again Justin,

I've been thrown head first into the middle of a half done project, being 
completely new to every aspect of OSGi/felix/fuse/karaf/Maven and having a 
tight timeline, so unfortunately I haven't had time for proper research. I'll 
make sure to make the module layer chapter my night read :)



- Morten

-----Oprindelig meddelelse-----
Fra: Justin Edelson [mailto:[email protected]] 
Sendt: 15. juli 2010 17:13
Til: [email protected]
Emne: Re: SV: Problems including external jar's with felix

I think you're misunderstanding the relationship between Maven and Felix.

Maven is a build tool. The dependencies you express there are used as
part of your build/test process. While Maven has a "runtime" scope, this
is intended for cases where Maven is producing a runnable artifact (e.g.
a WAR file).

Felix is a runtime OSGi framework. It uses metadata in the MANIFEST.MF
to construct the proper runtime environment for the bundles contained by
it. Felix doesn't know about Maven repositories or the POM file. The
handoff, if you will, between Maven and Felix is the MANIFEST.MF file.
There are a variety of mechanisms to make bundle installation easier.
These include OBR and Karaf's feature files. But with just the
framework, you need to install bundles individually.

Furthermore, Maven dependencies operates at the artifact level (i.e. the
JAR file) whereas OSGi "dependencies" should be expressed at the package
level (i.e. Import-Package).  As a result, there need not be a
connection between your Maven dependencies and the bundles you install
into your OSGi container - you could use the "plain" Axis JAR in your
Maven pom file and the SpringSource bundle in your OSGi container.

I would *highly* recommend you read the Module Layer chapter of the OSGi
core spec.

To be clear, I have no idea what a ".bar" file is. This sounds like
something FUSE-specific.

Justin

On 7/15/10 10:50 AM, Morten Engel wrote:
> Thank you for the answer, I'm not quite certain where to go from there though.
> 
> Is getting Axis from Springsource to prefer over the "plain" org.apache.axis 
> which the maven for eclipse plugin suggests me?
> 
> You say that SpringSource provides bundles for the dependencies, but I still 
> have to manually add all dependencies, right? And once I deploy it on my Fuse 
> Server, I manually have to place them there as well? (It was my impression 
> that maven dependencies could get their own dependencies, if the dependency 
> is also maven compatible), but that does not seem to happen for me at least, 
> seems to me that I need to either include everything in my own bundle, or 
> create dozens of small .bar's?
> 
> Am I somehow including my dependencies wrong, or does it sound like 
> somethings' not quite working with my FUSE server? Or am I just plain wrong?
> 
> I tried adding the axis bundle from SpringSource as a dependency (and 
> removing my old ones). Doing 'mvn clean install' resulted in an error due to 
> missing javax.xml.rpc, adding this from SpringSource as well, resulted in 
> successful build. - But once trying to start this in FUSE (after removing my 
> .bar's) again resulted in a "Missing Constraint: Import package: 
> javax.xml.rpc".
> 
> 
> Is the general idea, that I should make a .bar out of every external jar, and 
> place it on the server? Or shouldn't the dependency somehow be able to be 
> satisfied by FUSE/Servicemix downloading and installing it?
> 
> 
> - Morten
> 
> -----Oprindelig meddelelse-----
> Fra: Justin Edelson [mailto:[email protected]] 
> Sendt: 15. juli 2010 14:50
> Til: [email protected]
> Emne: Re: Problems including external jar's with felix
> 
> If you want to use Axis 1.4.0, you can use the bundles from the
> SpringSource repo. Starting with:
> http://www.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.axis&version=1.4.0&searchType=bundlesByName&searchQuery=axis
> 
> and also ensuring that all of the require imports are satisfied.
> SpringSource provides bundles for those dependencies (see the Required
> Dependencies section of the page above), but I imagine that FUSE already
> has some of these installed.
> 
> You shouldn't be trying to create self-sufficient bundles. Even if you
> are using a library for which no one has created an OSGi-friendly
> version, it would be better to bundelize the library rather than using
> Embed-Dependency.
> 
> Justin
> 
> On 7/15/10 5:26 AM, Morten Engel wrote:
>> Hi,
>>
>> I'm quite new to Maven as well as Felix, and I'm having some trouble 
>> creating a bundle which includes everything it needs.
>>
>> My problem is with using axis for calling an external webservice, I've 
>> included it as a compile jar in my maven dependencies, and compiling and 
>> 'mvn clean install' goes through without warnings. Once I put it up on the 
>> remote server, and attempt to start it in FUSE, I get the message "The 
>> bundle could not be resolved. Reason: Missing Constraint: Import-Package: 
>> javax.xml.rpc". I tried a long range of solutions, until I found that I 
>> could wrap jaxrpc.jar to a .bar, place it in FUSE's deploy folder, and then 
>> the missing constraint was resolved (after this, it was missing some axis 
>> classes, but by doing the same exercise with axis.jar into .bar, I resolved 
>> all missing dependencies, including the first one, which axis also includes).
>>
>> So basicly, I can make it work. However we'd very much like to have these 
>> packages selfsufficient, rather than having them depend on us creating 
>> bar's. I reckoned this could instead be solved by the felix plugin 
>> instructions, either by "Embed-Dependency" or "Private-Package", including 
>> org.apache.axis* here, also made the resulting bundle much larger, and I 
>> assumed all would be well, but trying to start it on FUSE, now demanded that 
>> I install com.sun.jimi.core too. This has me rather confused, as it worked 
>> without it when I made the .bar.
>> I'm guessing this missing dependency, is due to a reference somewhere inside 
>> axis (I never use it), and I'm guessing, even if I resolved this, and made 
>> my bundle even larger, I'd run into a near endless road of having to include 
>> every referenced package, and their packages etc. So I'm guessing I'm doing 
>> something wrong, however I can't figure out what.
>>
>> Does anyone have a piece of advice, or a good source where I could read 
>> further on this subject?
>>
>> Been reading 
>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html, 
>> along with much other material and forum post/old mailing lists, but without 
>> any luck.
>>
>> Any help would be much appreciated,
>>
>> Sincerely,
>> Morten Engel.
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to