Native Container is bare bones. For additional URL handlers like for mvn you
need to add pax-url-aether to the classpath.
We could add it implicitly,but I like to give users the choice (which URL
handlers,which versions etc)
On Jul 21, 2011 5:24 PM, "Rodolfo Barbeiro" <[email protected]>
wrote:
>
> Hi Toni, Thank you for your attention! I believe that use container-native
makes more sense. Please help me with a little problem. Using
native-container can I use "mavenBundle()" in the setup? Or I have to
installbundles otherwise? Because the following error is occurring:
org.ops4j.pax.exam.TestContainerException: Problem starting test container.
> at
org.ops4j.pax.exam.nat.internal.NativeTestContainer.start(NativeTestContainer.java:199)
> at
org.ops4j.pax.exam.lesson1.LessonTest.testLesson1Unit1(LessonTest.java:102)
> 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
> at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
> at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
> 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.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
> at $Proxy0.invoke(Unknown Source)
> at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
> at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
> at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
> Caused by: org.osgi.framework.BundleException: Unable to cache bundle:
mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4
> at org.apache.felix.framework.Felix.installBundle(Felix.java:2326)
> at org.apache.felix.framework.Felix.installBundle(Felix.java:2282)
> at
org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:130)
> at
org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:108)
> at
org.ops4j.pax.exam.nat.internal.NativeTestContainer.installAndStartBundles(NativeTestContainer.java:273)
> at
org.ops4j.pax.exam.nat.internal.NativeTestContainer.start(NativeTestContainer.java:196)
> ... 29 more
> Caused by: java.net.MalformedURLException: Unknown protocol: mvn
> at java.net.URL.<init>(URL.java:601)
> at java.net.URL.<init>(URL.java:464)
> at java.net.URL.<init>(URL.java:413)
> at
org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:150)
> at
org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:79)
> at
org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:57)
> at
org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:1004)
> at
org.apache.felix.framework.cache.BundleArchive.revise(BundleArchive.java:629)
> at
org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:147)
> at
org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:158)
> at org.apache.felix.framework.Felix.installBundle(Felix.java:2322)
Regards, Rodolfo Barbeiro Date: Wed, 20 Jul 2011 23:58:34 +0200
> Subject: Re: Pax Exam - Bundles are not activated
> From: [email protected]
> To: [email protected]
>
> Hi Rodolfo,
>
> This has nothing to do with serverMode or similar.
> The error you are getting is a conflict in your classpath between pax
runner (introduced by pax-exam-container-paxrunner dependency) and possibly
another felix library (org.apache.felix.framework for example).
>
> Problem is that pax runner already brings some felix classes for
historical reasons. You actually overwrite them with the felix library and
pax runner is now incompatible (methodNotFound).
>
> You can fix this easily by bringing the classpath in order:
>
> 1. You want to use pax-exam-container-paxrunner (see
https://github.com/tonit/Learn-PaxExam/blob/master/README.md for comparism)
?
> Then remove any osgi container from classpath. You wont need it. Its pax
runner taking care of this. You just can introduce problems if you do.
>
>
> 2. Use pax-exam-container-native. Then of cause you need osgi container
implementation like felix and/or equinox.
>
> Does this make sense ?
> If you have the mood, give pax exam 2.1.1-SNAPSHOT a shot (from trunk or
from maven repo: https://oss.sonatype.org/content/groups/ops4j/).
>
> This contains some bugfixes and also will become 2.2 quite soon.
>
> thanks again,
> Toni
>
>
> On Wed, Jul 20, 2011 at 11:41 PM, Rodolfo Barbeiro <
[email protected]> wrote:
>
>
>
>
>
>
> Toni,
>
> In server mode works with felix 3.0.6?
>
>
>
> It only works with version 1.8.1? or less ...
>
>
>
> I tried and it does the following error:
>
>
>
>
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] :
Starting up the test container (Pax Runner ${dependency.runner.version} )
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : Pax
Runner Arguments: ( 17)
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--keepOriginalUrls
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--platform=felix
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--version=3.0.6
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--bootDelegation=sun.*
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
scan-bundle:mvn:org.junit/com.springsource.org.junit/4.4.0@2
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-api/1.6.1
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
scan-bundle:mvn:org.osgi/org.osgi.compendium/4.2.0
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
scan-bundle:mvn:org.apache.felix/org.apache.felix.gogo.runtime/0.8.0
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
scan-bundle:mvn:org.apache.felix/org.apache.felix.gogo.shell/0.8.0
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
scan-bundle:mvn:org.apache.felix/org.apache.felix.gogo.command/0.8.0
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--clean
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--vmOptions=-Dorg.ops4j.pax.exam.rbc.rmi.host=PC142
-Dorg.ops4j.pax.exam.rbc.rmi.port=21413 -Dorg.ops4j.pax.exam.rbc.rmi.name
=7766538b-1363-419d-8d2a-6413bd39982f
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--noConsole
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--noDownloadFeedback
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--log=warn
>
> [org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer] : #
--workingDirectory=\target\server
> Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.felix.framework.ServiceRegistry.<init>(Lorg/apache/felix/framework/Logger;)V
>
> at org.ops4j.pax.runner.Run.createContext(Run.java:241)
> at org.ops4j.pax.runner.Run.start(Run.java:194)
> at org.ops4j.pax.runner.Run.start(Run.java:163)
> at
org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer.start(PaxRunnerTestContainer.java:128)
>
>
>
> Date: Wed, 20 Jul 2011 19:31:30 +0200
> Subject: Re: Pax Exam - Bundles are not activated
> From: [email protected]
>
> To: [email protected]
>
> Yes, you either replicate it or use pax exam as your environment (see
serverMode:
https://github.com/tonit/Learn-PaxExam/blob/master/lesson-servermode/src/main/java/org/ops4j/pax/exam/servermode/SimpleServer.java
)
>
>
>
>
>
> On Wed, Jul 20, 2011 at 7:19 PM, Rodolfo Barbeiro <
[email protected]> wrote:
>
>
>
>
>
>
>
>
> Achim,
>
> "I would try is to setup a "working" environment for testing such cases"
>
>
>
> Today I do it. Run the tests in a real environment with all the necessary
dependencies for my bundle. But this is laborious. I would like to run these
tests functional/integrated with Pax Exam. Is it possible?
>
>
> I think I'm using Pax incorrectly. I am replicating the real OSGi
environment in the Pax Exam. Should I do this?
>
>
>
> Regards,
>
>
>
> Rodolfo Barbeiro
>
> Date: Wed, 20 Jul 2011 01:05:58 +0200
> From: [email protected]
> To: [email protected]
>
>
> Subject: Re: Pax Exam - Bundles are not activated
>
>
>
>
>
>
>
>
>
> Rodolfo,
>
>
>
> ok, so back to your initial issue :)
>
> usually bundles stay in the installed state if a needed dependency
> isn't resolved.
>
> And this is usually also not printed to you on the console. So how
> you may get still
>
> to this. Another way for testing this is to manually start the
> corresponding bundles.
>
> Now I'm not sure either if this really works with pax exam since the
> main focus
>
> for exam is to run unit/integration tests inside a osgi environment.
>
>
>
>
> Now if I do recall correct you have a lot of bundles to get this
> going, right?
>
> One thing I would try is to setup a "working" environment for
> testing such cases.
>
> now depending on what kind of bundles you got (FileInstaller) for
> example you
>
> might consider to use Apache Karaf as your Runtime to test your
> bundles.
>
> With Karaf you also get a interactive Shell for testing such
> scenarios.
>
>
>
> regards, Achim
>
>
>
> Am 20.07.2011 00:22, schrieb Rodolfo Barbeiro:
>
>
>
> Achim,
>
>
>
> "but usually the std. console log
> should be sufficient"
>
>
>
> In the console does
> not show why the bundles are
> not being "activated". I have
> listed all the bundles manually,
> showing the status. And I found
> that most stay with
> the status "Installed".
>
>
>
> In the console log shows
> nothing wrong.
>
>
>
>
> Date: Wed, 20 Jul 2011 00:06:49 +0200
>
> From: [email protected]
>
> To: [email protected]
>
> Subject: Re: Pax Exam - Bundles are not activated
>
>
>
>
> Ok,
>
>
>
> if you want to use the felix fileinstaller you also need the
> ConfigurationAdmin Service installed.
>
> Since the fileinstaller interprets the config file as a
> setting for the ConfigurationAdmin Service.
>
> In turn the pax logging bundle does get configured
> accordingly.
>
>
>
> but usually the std. console log should be sufficient
>
>
>
> regards, Achim
>
>
>
>
>
>
>
> Am 19.07.2011 23:43, schrieb Rodolfo Barbeiro:
>
>
>
>
> I added the bundle
> pax-logging-service.
>
>
>
> How do I set the cfg file? I tried to indicate the property
> "systemProperty("felix.fileinstall.filename=org.ops4j.pax.logging.cfg")"
did not work.
>
>
>
> The file "org.ops4j.pax.logging.cfg" exists! Just do not know if it's in
correct place ... :)
>
>
>
>
>
>
> Date: Tue, 19 Jul 2011 23:29:18
> +0200
>
> From: [email protected]
>
> To: [email protected]
>
> Subject: Re: Pax Exam - Bundles are not activated
>
>
>
> Hi Rodolfe,
>
>
>
>
> yep this is the one. So I guess you already used it :-)
>
> But do you also use the pax-logging-service?
>
> Cause that's the one actually doing the logging.
>
>
>
> If you have these running you actually should see
>
> log messages on the console, I'm unsure about
>
> a specialized log file. For that you might need to
>
> configure it to use a cfg file.
>
>
>
> regards, Achim
>
>
>
>
>
>
>
> Am 19.07.2011 23:22, schrieb Rodolfo Barbeiro:
>
>
> Hello
> Achim!
>
>
>
>
>
> Are
>
> you referring to this bundle:
>
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").version("1.6.1"),
>
>
>
>
>
>
>
>
>
> Date: Tue, 19 Jul 2011
> 23:14:34 +0200
>
> From: [email protected]
>
> To: [email protected]
>
> Subject: Re: Pax Exam - Bundles are not activated
>
>
>
> Hi,
>
>
>
> you also need to provide the pax logging bundles.
>
>
> AFAIK those are not included with the pax exam
> bundles
>
> so you need to tell exam to also start those.
>
>
>
> regards, Achim
>
>
>
> Am 19.07.2011 23:10, schrieb Rodolfo Barbeiro:
>
>
> Hello
>
> Harald!
>
>
>
>
>
> I'm using felix
> framework.
>
>
>
> I
> would like to
> know how to
> enable logging. Because I
> noticed that in the
> cache folder has no log
> files so I
> can inspect.
>
>
>
> I set the property: systemProperty(
>
>
>
> "org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG").
>
>
>
> But the log is not generated.
>
>
>
> You can help me
> with this?
>
>
>
>
>
>
>
> Rodolfo Barbeiro
>
>
>
> > Date: Tue, 19 Jul 2011 22:36:44
> +0200
>
> > From: [email protected]
>
> > To: [email protected]
>
> > Subject: Re: Pax Exam - Bundles are not
> activated
>
> >
>
> > To find out why your bundles fail to
> resolve, add the following to your
>
> > Pax Exam configuration
>
> >
>
> > equinox(),
>
> > workingDirectory("/tmp/pax"),
>
> > keepCaches()
>
> >
>
> > When your test terminates, you will
> find the bundles provisioned by Pax
>
> > Exam and the generated config.ini in
> the "equinox" and "bundles"
>
> > subdirectories of /tmp/pax
>
> >
>
> > Running Equinox manually via
>
> >
>
> > java -jar
> path/to/org.eclipse.osgi_XXX.jar
> -configuration <configDir>
>
> > -console
>
> >
>
> > (sorry, I don't remember the exact
> names off the top of my head...)
>
> >
>
> > you can then use
>
> >
>
> > diag <bundle id>
>
> >
>
> > from the Equinox console to find out
> what dependencies the given bundle
>
> > is missing.
>
> >
>
> > Or you can set a breakpoint in your Pax
> Exam test and connect to the
>
> > console of the running Equinox
> framework via
>
> >
>
> > telnet localhost 6666
>
> >
>
> > I don't know if Pax Exam activates the
> console by default - if not, then
>
> > have a look at the Equinox
> documentation (Eclipse Help | Eclipse
>
> > Runtime Options) to find the system
> property you need to set.
>
> >
>
> > HTH,
>
> > Harald
>
> >
>
> >
>
> >
>
> >
>
> > Am 19.07.2011 20:16, schrieb Rodolfo
> Barbeiro:
>
> > > But thebundlesI needto simulatemy
> environmentdoes notbecome
>
> > > active.Almost everybody getsthe
> status"Installed".
>
> > >
>
> > > Is this normal?
>
> > >
>
> >
>
> >
> _______________________________________________
>
> > general mailing list
>
> > [email protected]
>
> > http://lists.ops4j.org/mailman/listinfo/general
>
>
>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
>
>
>
>
> _______________________________________________
> general mailing list [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
>
>
>
>
> _______________________________________________ general
> mailing list [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
>
>
>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>
>
>
>
>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
> _______________________________________________
>
> general mailing list
>
> [email protected]
>
> http://lists.ops4j.org/mailman/listinfo/general
>
>
>
>
> --
> Toni Menzel Source
>
>
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
> _______________________________________________
>
> general mailing list
>
> [email protected]
>
> http://lists.ops4j.org/mailman/listinfo/general
>
>
>
>
> --
> Toni Menzel Source
>
>
>
> _______________________________________________
> 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