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