Thank you, Pete, for your help.

I dove in a bit further and found that the error was on my part.  My parent
bundle exported the package "com.example" and my child class was in the
package "com.example.child".  When I moved my child class to
"com.example.something.else" it worked as I expected.

I am very new to OSGI, but that was not how I expected the export directive
to work.  Regardless, my error is fixed, and I appreciate the help from this
community.

Thank you,
Kyle Miller


On Tue, Dec 28, 2010 at 9:25 PM, Pete Carapetyan
<[email protected]>wrote:

> In an interesting twist I'm seeing this NoClassDefFound exception now
> on some code that I thought had been working, so after much
> experimentation I am discovering that I introduced a class with some
> runtime calls to spring that were making it barf.
>
> Bottom line is that NoClassDefFound exception seems to mean "Hey
> something happened in here that made pax exam barf, but we can't tell
> you what it is because we can't even get that far".
>
> This also leads me to advise
> you of something else I found - Among other things to try is that if you
> are
> experimenting with various configurations, keep the bundle deployment
> directory accessible and make sure you manually delete each old bundle
> when you build a new one in maven. Not sure if this *should* be
> necessary but I have discovered that it often makes the difference
> between success and failure. Otherwise you iterate, and it may never
> see the latest iteration.
>
> For example, here is where paxrunner stashes my bundles to run the
> pax-exam tests with (Vista).
> C:\Users\pete\AppData\Local\Temp\paxexam_runner_pete
>
> I have hoped to document the processes that I used to get pax-exam
> 1.2.2 to work, but am still
> experimenting and learning a lot about them, so not ready yet.
>
> On Thu, Dec 23, 2010 at 10:28 PM, Kyle Miller <[email protected]>
> wrote:
> > Thanks, Pete, for looking at it.
> > I did indeed try to comment it out because I thought I was seeing a class
> > loading problem...with the class in my test probe AND in the parent
> bundle
> > which was deployed.  It does not work commented or uncommented.
> > Thanks,
> > Kyle
> > On Thu, Dec 23, 2010 at 12:36 PM, Pete Carapetyan
> > <[email protected]> wrote:
> >>
> >> Hi Kyle I may be missing something but I opened up your zip and looked
> >> at the test and found this, with the maven import commented out:
> >> @Override
> >>        protected List<Option> getChildOptionList() {
> >>                List<Option> list = new ArrayList<Option>();
> >>                list.add(vmOption(
> >> "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" ));
> >>                list.add(logProfile());
> >>        list.add(systemProperty(
> >> "org.ops4j.pax.logging.DefaultServiceLog.level" ).value( "DEBUG" ));
> >>
> >>                //list.add(mavenBundle("pax-parent", "pax-parent",
> >> "1.0.0-SNAPSHOT"));
> >>                list.add(workingDirectory("working/1"));
> >>                list.add(new Customizer() {
> >>                        public InputStream customizeTestProbe(
> InputStream
> >> testProbe )
> >> throws Exception {
> >>                                TinyBundle newBundle =
> >> TinyBundles.modifyBundle(testProbe).add(BasePaxTest.class);
> >>                                //newBundle.set(Constants.REQUIRE_BUNDLE,
> >> "pax-parent");
> >>                                //newBundle.set(Constants.IMPORT_PACKAGE,
> >> "com.example*");
> >>                                testProbe = newBundle.build();
> >>                                return testProbe;
> >>                        }
> >>
> >>                });
> >>                return list;
> >>        }
> >>
> >> If I'm understanding this with the few seconds that I looked at it,
> >> the bundle you need is not a part of the classpath yet.
> >>
> >> On Thu, Dec 23, 2010 at 11:29 AM, Kyle Miller <
> [email protected]>
> >> wrote:
> >> > (Thank you in advance for any direction you can give.)
> >> >
> >> > I am having trouble trying to run a pax exam test that extends from a
> >> > class
> >> > in another bundle.
> >> >
> >> > My setup contains two bundles:
> >> >
> >> > pax-parent - contains abstract class with most pax exam configuration
> >> >
> >> > pax-child - contains extended class with some config.
> >> >
> >> > When I run the class in pax-child as a jUnit test, it installs my
> >> > bundles,
> >> > starts equinox, and then when it tries to call the test, I get a
> >> > NoClassDefFound exception referring to the base class in the
> pax-parent
> >> > bundle:
> >> >
> >> > Pax Exam 1.2.2 from OPS4J - http://www.ops4j.org
> >> > ------------------------------------------------
> >> >
> >> > [              JUnit4TestMethod] - Starting test runTestSteps
> >> > [equinox](com.example.BasePaxTest)
> >> > [        PaxRunnerTestContainer] - Starting up the test container (Pax
> >> > Runner 1.5.0 )
> >> > [        PaxRunnerTestContainer] - Acquire lock for new Pax Runner
> >> > instance
> >> > on
> >> >
> /Users/millkyl/Documents/workspace-trunk/pax-child/working/1/paxexam.lock
> >> > [             ConfigurationImpl] - Using config
> >> > [classpath:META-INF/runner.properties]
> >> > [                           Run] - Using only arguments from command
> >> > line
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.exam/pax-exam/1....@1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.exam/pax-exam-junit-extender/1....@1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> >
> >> >
> [scan-bundle:mvn:org.ops4j.pax.exam/pax-exam-junit-extender-impl/1....@1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.url/pax-url-mvn/0.4.0]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:wrap:mvn:org.ops4j.base/ops4j-base-util/0....@update]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> >
> >> >
> [scan-bundle:wrap:mvn:org.ops4j.pax.exam/pax-exam-container-default/1....@update
> ]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:wrap:mvn:org.ops4j.pax.exam/pax-exam-junit/1....@update]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.junit/com.springsource.org.junit/4....@1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.exam/pax-exam-container-rbc/1....@1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-composite:mvn:org.ops4j.pax.runner.profiles/log//composite]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-api/1.5.1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-service/1.5.1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-composite:mvn:org.ops4j.pax.runner.profiles/log//composite]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-api/1.5.1]
> >> > [          ProvisionServiceImpl] - Scan bundles from
> >> > [scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-service/1.5.1]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.ops4j.pax.exam/pax-exam/1.2.2, at start level 1, bundle will
> be
> >> > started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.ops4j.pax.exam/pax-exam-junit-extender/1.2.2, at start level
> 1,
> >> > bundle will be started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.ops4j.pax.exam/pax-exam-junit-extender-impl/1.2.2, at start
> >> > level
> >> > 1, bundle will be started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.ops4j.pax.url/pax-url-mvn/0.4.0, at default start level,
> bundle
> >> > will be started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [wrap:mvn:org.ops4j.base/ops4j-base-util/0.5.3, at default start
> level,
> >> > bundle will be started, bundle will be re-downloaded]
> >> > [                           Run] - Provision bundle
> >> > [wrap:mvn:org.ops4j.pax.exam/pax-exam-container-default/1.2.2, at
> >> > default
> >> > start level, bundle will be started, bundle will be re-downloaded]
> >> > [                           Run] - Provision bundle
> >> > [wrap:mvn:org.ops4j.pax.exam/pax-exam-junit/1.2.2, at default start
> >> > level,
> >> > bundle will be started, bundle will be re-downloaded]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.junit/com.springsource.org.junit/4.4.0, at start level 1,
> >> > bundle
> >> > will be started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.ops4j.pax.exam/pax-exam-container-rbc/1.2.2, at start level
> 1,
> >> > bundle will be started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4, at default
> >> > start
> >> > level, bundle will be started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.ops4j.pax.logging/pax-logging-api/1.5.1, at default start
> >> > level,
> >> > bundle will be started, bundle will be loaded from the cache]
> >> > [                           Run] - Provision bundle
> >> > [mvn:org.ops4j.pax.logging/pax-logging-service/1.5.1, at default start
> >> > level, bundle will be started, bundle will be loaded from the cache]
> >> > [                  PlatformImpl] - Preparing framework [Equinox 3.6.0]
> >> > [                  PlatformImpl] - Downloading bundles...
> >> > [                   StreamUtils] -
> >> > wrap:mvn:org.ops4j.base/ops4j-base-util/0.5.3 : downloading...
> >> > [                   StreamUtils] -
> >> > wrap:mvn:org.ops4j.base/ops4j-base-util/0.5.3 : 15808 bytes @ [
> 526kBps
> >> > ]
> >> > [                   StreamUtils] -
> >> > wrap:mvn:org.ops4j.pax.exam/pax-exam-container-default/1.2.2 :
> >> > downloading...
> >> > [                   StreamUtils] -
> >> > wrap:mvn:org.ops4j.pax.exam/pax-exam-container-default/1.2.2 : 35051
> >> > bytes @
> >> > [ 1298kBps ]
> >> > [                   StreamUtils] -
> >> > wrap:mvn:org.ops4j.pax.exam/pax-exam-junit/1.2.2 : downloading...
> >> > [                   StreamUtils] -
> >> > wrap:mvn:org.ops4j.pax.exam/pax-exam-junit/1.2.2 : 29417 bytes @ [
> >> > 1838kBps
> >> > ]
> >> > [          ExecutionEnvironment] - Using execution environment
> >> > [J2SE-1.6]
> >> > [             DefaultJavaRunner] - Runner has successfully finished
> his
> >> > job!
> >> >
> >> > [        PaxRunnerTestContainer] - Test container (Pax Runner 1.5.0)
> >> > started
> >> > in 4541 millis
> >> > [        PaxRunnerTestContainer] - Wait for test container to finish
> its
> >> > initialization for 300000 millis
> >> > Listening for transport dt_socket at address: 5005
> >> > [org.ops4j.pax.exam.rbc.internal.Activator] : RMI registry started on
> >> > port
> >> > [1099]
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Enabling SLF4J API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Enabling Jakarta Commons Logging API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Enabling Log4J API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Enabling Avalon Logger API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Enabling JULI Logger API support.
> >> > [     RemoteBundleContextClient] - Remote bundle context found after
> >> > 2180
> >> > millis
> >> > [                    RawBuilder] - Copy thread finished.
> >> > [RMI TCP Connection(1)-10.15.1.17] INFO
> >> > org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Install
> bundle
> >> > from URL
> >> >
> >> >
> [file:/var/folders/5J/5JLin7oUG9GXEhGIIJKiGU+++TI/-Tmp-/tb/tinybundles_2e604b2e930e1edfe39b11ab14d83c29c1b12b58.bin]
> >> > [RMI TCP Connection(1)-10.15.1.17] INFO
> >> > org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Look up
> >> > service
> >> > [org.osgi.service.startlevel.StartLevel], timeout in 0 millis
> >> > [RMI TCP Connection(1)-10.15.1.17] INFO
> >> > org.ops4j.pax.exam.junit.extender.impl.internal.TestBundleObserver -
> >> > Found
> >> > test: com.example.child.ChildPaxTest.runTestSteps
> >> > [RMI TCP Connection(1)-10.15.1.17] INFO
> >> > org.ops4j.pax.exam.junit.extender.impl.internal.TestBundleObserver -
> >> > Registered testcase [com.example.child.ChildPaxTest.runTestSteps]
> >> > [              JUnit4TestMethod] - Starting test runTestSteps
> >> > [equinox](com.example.BasePaxTest)
> >> > [RMI TCP Connection(1)-10.15.1.17] INFO
> >> > org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Remote call
> of
> >> > [org.ops4j.pax.exam.junit.extender.CallableTestMethod.call]
> >> > [RMI TCP Connection(1)-10.15.1.17] INFO
> >> > org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Look up
> >> > service
> >> > [org.ops4j.pax.exam.junit.extender.CallableTestMethod], timeout in 0
> >> > millis
> >> > [        PaxRunnerTestContainer] - Shutting down the test container
> (Pax
> >> > Runner)
> >> >
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Disabling SLF4J API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Disabling Jakarta Commons Logging API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Disabling Log4J API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Disabling Avalon Logger API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
> >> > : Disabling JULI Logger API support.
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.exam.junit.extender.impl.internal.TestBundleObserver]
> >> > : Unregistered testcase [com.example.child.ChildPaxTest.runTestSteps]
> >> >
> >> >
> org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.exam.rbc.internal.Activator]
> >> > : RMI registry stopped
> >> >
> >> > [             DefaultJavaRunner] - Platform has been shutdown.
> >> >
> >> > The exception:
> >> > java.lang.NoClassDefFoundError: BasePaxTest
> >> >     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.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:580)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:550)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:481)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:469)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
> >> >     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
> >> >     at
> >> >
> >> >
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:99)
> >> >     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.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
> >> >     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
> >> > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
> >> >     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:886)
> >> >     at
> >> >
> >> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >> >     at java.lang.Thread.run(Thread.java:680)
> >> > Caused by: java.lang.ClassNotFoundException: BasePaxTest
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
> >> >     at
> >> >
> >> >
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
> >> >     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> >> >     ... 39 more
> >> >
> >> >
> >> > I added a Customizer option to the child test to try to include the
> >> > parent
> >> > class in my test probe to no avail.  I tried deploying the parent
> bundle
> >> > and
> >> > importing the parent class in my test probe to no avail.
> >> >
> >> > Should I be able to do this?  Can anyone give me an idea of where I am
> >> > going
> >> > wrong?
> >> >
> >> > (For reference, I have included the contrived projects I am working
> >> > with.
> >> > If the attachments cannot be delivered, I would be happy to post them
> on
> >> > the
> >> > web somewhere.)
> >> >
> >> > Again, thank you in advance.
> >> >
> >> > Kyle Miller
> >> > Pax Exam Enthusiast.
> >> >
> >> > _______________________________________________
> >> > 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

Reply via email to