Toni,

Thanks for your very informative reply on Easter Day!

OK, I now understand better what pax-exam-link-mvn does. I was just a bit
curious if the maven integration had changed. E g one could imagine that
Pax-Exam would deploy all dependencies of the current project without having
to list them separately as Options. Not sure if that would work but maybe it
could be worth investigting. I saw in the mailing list somewhere that (you
Toni?) had mentioned supporting Karaf features which is really what I would
like. Ideally one would of course want to use the same provision mechanism
in test as in production and I use Karaf features. It would make things a
lot easier I think.

About the fragment stuff I guess it could be a bug. However, I saw in your
examples that you add the following to your pom.xml:

        <!-- For sane logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.6.1</version>
            <scope>test</scope>
        </dependency>

Is that a way to enable slf4j logging in the deployed test? I couldn't see
that you actually deployed the slf4j-simple bundle though.

You wrote:

*So you are using Felix with Security Manager enabled ?
> **Nothing wrong with that. Ok, lets see,  org.osgi.util.tracker.*

*
*
I hadn't even thought about the Security Manager and I don't do anything
deliberate to enable it. I did try to switch to pax-exam-container-paxrunner
like you suggested. The security exception then dissappeared. I still have a
missing dependency (I'm in the process of switching from Karaf 2.1.3 to
Karaf 2.2.0) so the test still failed but I think I can fix that part.

I don't understand why the Security Manager is enabled. How does one
ususally enable the security manager? I use the following Pax-Runner
options:

*  bootDelegation(),
>   mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
>   mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
>   mavenBundle("org.slf4j", "slf4j-api"),
>   mavenBundle("org.apache.aries", "org.apache.aries.util"),
>   mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.api"),
>   mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container"),
>   mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
>   mavenBundle("org.apache.aries.jpa",
> "org.apache.aries.jpa.container.context"),
>   mavenBundle("org.apache.aries.jpa",
> "org.apache.aries.jpa.blueprint.aries"),
>   mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.api"),
>   mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.core"),
>   mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url"),
>   mavenBundle("org.apache.aries.transaction",
> "org.apache.aries.transaction.manager"),
>   mavenBundle("org.apache.aries.transaction",
> "org.apache.aries.transaction.blueprint"),
>   mavenBundle("org.apache.aries.transaction",
> "org.apache.aries.transaction.wrappers"),
>   mavenBundle("org.apache.geronimo.specs", "geronimo-jpa_2.0_spec"),
>   mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"),
>   mavenBundle("org.apache.geronimo.specs",
> "geronimo-j2ee-connector_1.5_spec"),
>   mavenBundle("org.apache.geronimo.components", "geronimo-transaction"),
>   mavenBundle("org.apache.servicemix.bundles",
> "org.apache.servicemix.bundles.cglib"),
>   mavenBundle("org.apache.servicemix.bundles",
> "org.apache.servicemix.bundles.serp"),
>   mavenBundle("org.apache.openjpa", "openjpa"),
>   mavenBundle("commons-lang", "commons-lang"),
>   mavenBundle("commons-collections", "commons-collections"),
>   mavenBundle("commons-pool", "commons-pool"),
>   junitBundles()*


Plus a few bundles of my own that can hardly affect the security manager. Do
you need the versions as well? Aries is now version 0.3 and OpenJPA 2.01.
I'm not quite sure why I have the bootDelegation() option but I get the same
exception regardless. I added junitBundles() from your samples but I'm not
sure what it does either.

Thanks,

/Bengt

2011/4/24 Toni Menzel <[email protected]>

> Hi Bengt,
>
> glad you are looking into Exam2.
> NativeContainer should support all OSGiCore 4.2 compatible frameworks,
> which includes Felix 3.0.8.
> You ask what "pax-exam-link-mvn" does?
> It contains so called link-Files which tell Pax Exam where to load its own
> bundles (the ones that are added to the target framework in order to let
> exam operate like loading tests) from.
> So, using pax-exam-link-mvn includes link files that point to urls using
> the mvn protocol (mvn:org.ops4j.pax.exam:pax-exam-rbc:2.0.0-RC4).
> By exchanging or providing your own link module (just extract the jar, or
> look into the sources at exam to get a clear view) you can tweak that for
> environments where you don't want to use maven infrastructure.
>
> Quintessence: You need to have at least one pax-exam-link-* module in your
> pom when using exam. Remove it, and you will immediately see what breaks and
> what i just told about.
>
> You question about how to load bundles:
> No, the starting point for all configuration is the Option[].
> There are couple of things you can use this Option Array (Bundles to load
> and all other options), but it all is driven from this form.
> You can construct this programmatically at runtime, so there are endless
> ways of how the final user specifies the real list.
> But as a framework, the programmatic way is the universal way we ship. - If
> you think of other ways, lets here.
> Because of the programmatic nature, you can always extend it. (Keyword:
> User driven extensions).
> In Exam2 i focused on enabling those extensions to developers. Not
> providing a kitchen sink for every usecase.
>
> Your Fragment question:
> yes, could be. The native container uses the StartLevel Service to start
> bundles upon startup in proper order. Could be it wrongly tries to start a
> fragment.
> Thats a bug that needs be resolved, however i believe that it should cause
> harm to the further processing. Does it?
> I will add an issue for RC5 .. :(
>
> About the *SecurityException:*
> So you are using Felix with Security Manager enabled ?
> Nothing wrong with that. Ok, lets see,  *
> org.osgi.util.tracker.BundleTrackerCustomizer* comes from a Core API
> bundle (org.osgi.core 4.2.0 for example) or the Felix framework.
> Can it be that you load a bundle exporting the aforementioned package, too
> ?
> You not really get a mismatched classloader error, it more looks like wrong
> packaging, not really related to Exam. However, i don't know you list of
> bundles.
> For sanity check, you could just switch to the paxrunner container by
> exchanging
>  <dependency>
>       <groupId>org.ops4j.pax.exam</groupId>
>       <artifactId>pax-exam-container-native</artifactId>
>       <version>2.0.0-RC4</version>
>     </dependency>
> with
>  <dependency>
>       <groupId>org.ops4j.pax.exam</groupId>
>       <artifactId>pax-exam-container-paxrunner</artifactId>
>       <version>2.0.0-RC4</version>
>     </dependency>
> (and optionally remove the felix framework, but it does not cause harm).
> This gives you the full isolation (different VM) and we can see if there is
> something wrong in the NativeContainer implementation. (like classloader
> isolation between host and framework system).
>
> Documentation:
> Now that 2.0 has its shape, documentation is growing on
> https://github.com/tonit/Learn-PaxExam.
> Its nowhere complete, but getting better and should stay up-to-date.
> I will add the questions related to the link-artifacts for example, too.
> Thanks for asking!
>
> Hope this gets your further to the point of using Exam2.
>
> Thanks & Happy Easter Holidays,
> Toni
> *
> *
> On Sun, Apr 24, 2011 at 10:46 AM, Bengt Rodehav <[email protected]> wrote:
>
>> Hi,
>>
>> I've been using pax-exam 1.x and now start to migrate to 2.0. I've tried
>> out the 2.0 rc4 version of Pax-Exam but have run into a couple of problems.
>> I use the native container support with Felix 3.0.8 (is that supported?). I
>> use the following dependencies:
>>
>>     <dependency>
>>       <groupId>org.ops4j.pax.exam</groupId>
>>       <artifactId>pax-exam-junit4</artifactId>
>>       <version>2.0.0-RC4</version>
>>     </dependency>
>>
>>     <dependency>
>>       <groupId>org.ops4j.pax.exam</groupId>
>>       <artifactId>pax-exam-container-native</artifactId>
>>       <version>2.0.0-RC4</version>
>>     </dependency>
>>
>>     <dependency>
>>       <groupId>org.ops4j.pax.exam</groupId>
>>       <artifactId>pax-exam-link-mvn</artifactId>
>>       <version>2.0.0-RC4</version>
>>     </dependency>
>>
>>     <dependency>
>>       <groupId>org.apache.felix</groupId>
>>       <artifactId>org.apache.felix.framework</artifactId>
>>       <version>3.0.8</version>
>>     </dependency>
>>
>> I've been wondering what the artifact "pax-exam-link-mvn" does? I
>> currently list my dependencies in the pom.xml and use the Pax-Runner options
>> to specifiy what bundles to load - just like I did with Pax-Exam 1.x. Is
>> there a better way to do this in Pax-Exam 2.0? Is there a way to use Karaf
>> features (I use Karaf 2.2.0)?
>>
>> I have problems using slf4j. I used to install the bundle "slf4j-log4j12"
>> (version 1.5.6) but whenever I do that I get an error message saying "Cannot
>> start fragment". I assume that slf4j-log4j12 is a fragment and that Pax-Exam
>> is trying to start it (which of course is not possible). Is this a known bug
>> or is there a way for me to specify that this bundle is a fragment and
>> cannot be started?
>>
>> Also, I get the following exception:
>>
>> *ERROR: Bundle org.apache.aries.jpa.container [8]: Error starting
>>> mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/0.3
>>> (org.osgi.framework.BundleException: Activator start error in bundle
>>> org.apache.aries.jpa.container [8].)
>>> java.lang.SecurityException: class
>>> "org.osgi.util.tracker.BundleTrackerCustomizer"'s signer information does
>>> not match signer information of other classes in the same package
>>> at java.lang.ClassLoader.checkCerts(ClassLoader.java:807)
>>>  at java.lang.ClassLoader.preDefineClass(ClassLoader.java:488)
>>> at java.lang.ClassLoader.defineClassCond(ClassLoader.java:626)
>>>  at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
>>> at
>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>>  at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>> at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>>  at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>>  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>>  at
>>> org.apache.felix.framework.ExtensionManager$ExtensionManagerModule.getClassByDelegation(ExtensionManager.java:697)
>>> at
>>> org.apache.felix.framework.resolver.WireImpl.getClass(WireImpl.java:99)
>>>  at
>>> org.apache.felix.framework.ModuleImpl.searchImports(ModuleImpl.java:1390)
>>> at
>>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:722)
>>>  at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>>> at
>>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>> at java.lang.ClassLoader.defineClass1(Native Method)
>>>  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
>>> at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
>>>  at
>>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1907)
>>> at
>>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:727)
>>>  at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
>>> at
>>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
>>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>> at
>>> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)
>>>  at
>>> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3687)
>>> at org.apache.felix.framework.Felix.activateBundle(Felix.java:1830)
>>>  at org.apache.felix.framework.Felix.startBundle(Felix.java:1752)
>>> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1156)
>>>  at
>>> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
>>> at java.lang.Thread.run(Thread.java:619)*
>>
>>
>> Does anyone know what this means?
>>
>> I'm very interested in moving on to Pax-Exam 2.0. Convenient testing
>> within an OSGi container is something that I really need and this seems like
>> a good way of achieving it. However, I do feel that there is a lack of
>> documentation as to how Pax-Exam works. I'm sure that will improve once 2.0
>> is released.
>>
>> Thanks,
>>
>> /Bengt
>>
>>
>> _______________________________________________
>> general mailing list
>> [email protected]
>> http://lists.ops4j.org/mailman/listinfo/general
>>
>>
>
>
> --
> *Toni Menzel - http://www.okidokiteam.com*
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to