karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <ch0...@gmail.com>
Subject Re: Debug pax-exam unit test
Date Tue, 11 Jun 2013 12:25:58 GMT
My class contains the following @Configure configuration

    @Configuration
    public static Option[] configure() {
        return new Option[]{

                // Install Karaf Container
                karafDistributionConfiguration().frameworkUrl(

maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject())

.karafVersion(MavenUtils.getArtifactVersion("org.apache.karaf",
"apache-karaf")).name("Apache Karaf")
                        .unpackDirectory(new File("target/exam/unpack/")),

                keepRuntimeFolder(),
                logLevel(LogLevelOption.LogLevel.INFO),

                // Option to be used to do remote debugging
                //
vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
systemTimeout(0),
                debugConfiguration("5005", true),

If I add a breakpoint here (refresh()) of the following unit test

    @Test
    public void testKContainer() throws Exception {
        refresh();

and start my class using local debug in intellij, the debugger does not
stop there.




On Tue, Jun 11, 2013 at 1:58 PM, Achim Nierbeck <bcanhome@googlemail.com>wrote:

> Hi Charles,
>
> I think you're mixing some things up here.
> If your trying to debug a karaf - container inside Pax-Exam it's working
> differently then debugging a standalone Pax-Exam Container with remote
> debugging, for example if run from maven and not embedded inside eclipse.
> So please take a look at the KarafBase Test class I've given you. It's
> fully working with Pax-Web and Karaf.
> Make sure your running the test as a regular Junit test, Pax-Exam will
> deploy your test as a test bundle inside Karaf so no need to debug the
> "outer" framework stuff.
>
> regards, Achim
>
>
> 2013/6/11 Charles Moulliard <ch007m@gmail.com>
>
> > Why do we show a different port number (intellij screenshot) in the doc
> > here -->
> > https://ops4j1.jira.com/wiki/display/paxexam/Pax+Exam+-+Tutorial+1?
> >
> >
> > On Tue, Jun 11, 2013 at 12:52 PM, Charles Moulliard <ch007m@gmail.com
> > >wrote:
> >
> > > No. Everytime I click on debug button of "Karaf" = Remote Debugger,
> > > intellij is not able to be attached to pax exam started separately
> > >
> > >
> > > On Tue, Jun 11, 2013 at 12:46 PM, Andreas Pieber <anpieber@gmail.com
> > >wrote:
> > >
> > >> is it possible that intellij has troubles with two debug processes at
> > the
> > >> same time? try to run the tests regularly and attach the remote
> > debugger.
> > >> Does this do the trick?
> > >>
> > >> Kind regards,
> > >> Andreas
> > >>
> > >>
> > >> On Tue, Jun 11, 2013 at 12:00 PM, Charles Moulliard <ch007m@gmail.com
> > >> >wrote:
> > >>
> > >> > Even if I use this option, I cannot attach from intellij a remote
> > >> process
> > >> > on the port 5005 when I start also in intellij the unit test in
> debug
> > >> mode.
> > >> > So is there another magic thing to do ?
> > >> >
> > >> >
> > >> > On Tue, Jun 11, 2013 at 11:12 AM, Achim Nierbeck <
> > >> bcanhome@googlemail.com
> > >> > >wrote:
> > >> >
> > >> > > Hi Charles,
> > >> > >
> > >> > > afairc something like this should be sufficient :)
> > >> > >
> > >> > > debugConfiguration("5005", true),
> > >> > >
> > >> > > regards, Achim
> > >> > >
> > >> > >
> > >> > > P.S. you might also take a look here:
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >>
> >
> https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-itest-karaf/src/test/java/org/ops4j/pax/web/itest/karaf/KarafBaseTest.java#L89
> > >> > >
> > >> > >
> > >> > > 2013/6/11 Charles Moulliard <ch007m@gmail.com>
> > >> > >
> > >> > > > Has added this option to the Unit test config
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
> > >> > > > systemTimeout(0),
> > >> > > >
> > >> > > > but when the unit test is launched, I get this exception
> > >> > > >
> > >> > > > java.rmi.NotBoundException: b7cb86c5-596e-4265-be00-a3c8d38c28ff
> > >> > > > at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:114)
> > >> > > > at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
> > >> > > > at
> > >> >
> sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:390)
> > >> > > > at
> > >> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:248)
> > >> > > > at sun.rmi.transport.Transport$1.run(Transport.java:159)
> > >> > > > at java.security.AccessController.doPrivileged(Native Method)
> > >> > > > at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> > >> > > > at
> > >> > >
> > >>
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
> > >> > > > at java.lang.Thread.run(Thread.java:680)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
> > >> > > > at
> > >> > > >
> > >> >
> > >>
> > sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
> > >> > > > at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
> > >> > > > at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRemoteBundleContext(RemoteBundleContextClientImpl.java:263)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.waitForState(RemoteBundleContextClientImpl.java:234)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.karaf.tooling.exam.container.internal.KarafTestContainer.waitForState(KarafTestContainer.java:599)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> org.apache.karaf.tooling.exam.container.internal.KarafTestContainer.start(KarafTestContainer.java:183)
> > >> > > > at
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:67)
> > >> > > >
> > >> > > >
> > >> > > > On Tue, Jun 11, 2013 at 10:44 AM, Achim Nierbeck <
> > >> > > bcanhome@googlemail.com
> > >> > > > >wrote:
> > >> > > >
> > >> > > > > Hi Charles,
> > >> > > > >
> > >> > > > > as Karaf is started as a separate jvm process in the
> > >> pax-exam-karaf
> > >> > > setup
> > >> > > > > you need to enable remote debugging.
> > >> > > > >
> > >> > > > > Regards, Achim
> > >> > > > >
> > >> > > > >
> > >> > > > > 2013/6/11 Charles Moulliard <ch007m@gmail.com>
> > >> > > > >
> > >> > > > > > Hi,
> > >> > > > > >
> > >> > > > > > Is there something to be able do debug a unit
test class
> using
> > >> > > > pax-exam2
> > >> > > > > ?
> > >> > > > > > I have added a break point in one the bundle that
I would
> like
> > >> to
> > >> > > debug
> > >> > > > > but
> > >> > > > > > when pax-exam + karaf container is started then
the debugger
> > >> never
> > >> > > > stops
> > >> > > > > > there ? Do we have to start a remote debugger
?
> > >> > > > > >
> > >> > > > > > Regards,
> > >> > > > > >
> > >> > > > > > --
> > >> > > > > > Charles Moulliard
> > >> > > > > > Apache Committer / Architect (RedHat)
> > >> > > > > > Twitter : @cmoulliard | Blog :
> http://cmoulliard.blogspot.com
> > >> > > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > --
> > >> > > > >
> > >> > > > > Apache Karaf <http://karaf.apache.org/> Committer
& PMC
> > >> > > > > OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> > >> > > Committer
> > >> > > > &
> > >> > > > > Project Lead
> > >> > > > > OPS4J Pax for Vaadin <
> > >> > > http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> > >> > > > > Commiter & Project Lead
> > >> > > > > blog <http://notizblog.nierbeck.de/>
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > --
> > >> > > > Charles Moulliard
> > >> > > > Apache Committer / Architect @RedHat
> > >> > > > Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
> > >> > > >
> > >> > >
> > >> > >
> > >> > >
> > >> > > --
> > >> > >
> > >> > > Apache Karaf <http://karaf.apache.org/> Committer &
PMC
> > >> > > OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> > >> Committer
> > >> > &
> > >> > > Project Lead
> > >> > > OPS4J Pax for Vaadin <
> > >> http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> > >> > > Commiter & Project Lead
> > >> > > blog <http://notizblog.nierbeck.de/>
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > Charles Moulliard
> > >> > Apache Committer / Architect @RedHat
> > >> > Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > Charles Moulliard
> > > Apache Committer / Architect @RedHat
> > > Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
> > >
> > >
> >
> >
> > --
> > Charles Moulliard
> > Apache Committer / Architect @RedHat
> > Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
> >
>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message