Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Debugging Tycho Surefire Class Loading issues

Hi Christoph,

Thanks for the tips. I as anticipating those split packages because I am in the process of converting the project to Tycho. Split packages usually can be ignored when you use Require-Bundle.

I also did some further digging and it turned out to be an instance of a build.properties issue, which isn't observed when testing self-hosted but brutally exposed when using Tycho.
https://github.com/salesforce/bazel-eclipse/pull/216/files#diff-0836dc81a6f8f87fda41fc45f6eddf0976abe91d883eaa34d1742ea95e293a07L5


TL;DR:

-        bin/ 
+       .

-Gunnar


-- 
Gunnar Wagenknecht
gunnar@xxxxxxxxxxxxxxx, http://guw.io/


> On May 1, 2021, at 19:06, Christoph Läubrich <laeubi@xxxxxxxxxxxxxx> wrote:
> 
> Hi Gunnar,
> 
> if you like to debug classlaoding itself, you can try the new tycho 2.4-SNAPSHOT that allows to specify debug options:
> 
> https://github.com/eclipse/tycho/blob/master/RELEASE_NOTES.md
> https://git.eclipse.org/c/equinox/rt.equinox.framework.git/plain/bundles/org.eclipse.osgi/.options?h=R3_8_maintenance
> 
> I have take a look here:
> https://github.com/salesforce/bazel-eclipse/blob/master/tests/com.salesforce.bazel-java-sdk.tests/META-INF/MANIFEST.MF
> 
> and it seems your test-bundle export (and contains) the package
> 
> com.salesforce.bazel.sdk.model
> 
> that means your construction some kind of split-package here that
> 
> a) is generally bad
> b) might fails to load if not configured properly
> 
> so as a first step I would try to make the package-structure distinct maybe
> 
> com.salesforce.bazel.sdk.[test].model
> 
> or something.
> 
> 
> Am 01.05.21 um 18:01 schrieb Gunnar Wagenknecht:
>> Hi,
>> I'm setting up a new project with Tycho 2.3.0 in pomless mode and I'm running into issues getting tests to run.
>> This is the exception I am seeing:
>> Root exception:
>> java.lang.NoClassDefFoundError: com/salesforce/bazel/sdk/model/BazelPackageLocation
>> 	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
>> 	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
>> 	at java.base/java.lang.Class.getMethodsRecursive(Class.java:3307)
>> 	at java.base/java.lang.Class.getMethod0(Class.java:3293)
>> 	at java.base/java.lang.Class.getMethod(Class.java:2106)
>> 	at org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod(ReflectionUtils.java:60)
>> 	at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isSuiteOnly(JUnit3TestChecker.java:66)
>> 	at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isValidJUnit3Test(JUnit3TestChecker.java:61)
>> 	at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.accept(JUnit3TestChecker.java:56)
>> 	at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:53)
>> 	at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:102)
>> 	at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:309)
>> 	at org.apache.maven.surefire.junit4.JUnit4Provider.setTestsToRun(JUnit4Provider.java:189)
>> 	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:132)
>> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>> 	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:206)
>> 	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:161)
>> 	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:84)
>> 	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:116)
>> 	at org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.start(HeadlessTestApplication.java:23)
>> 	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
>> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
>> 	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
>> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
>> 	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
>> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>> 	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:654)
>> 	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
>> 	at org.eclipse.equinox.launcher.Main.run(Main.java:1462)
>> 	at org.eclipse.equinox.launcher.Main.main(Main.java:1435)
>> Caused by: java.lang.ClassNotFoundException: com.salesforce.bazel.sdk.model.BazelPackageLocation cannot be found by com.salesforce.bazel-java-sdk.tests_1.0.0.qualifier
>> 	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:519)
>> 	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:171)
>> 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
>> 	... 36 more
>> At a first glance, it looks like a test platform issue. The class exists in a bundle that is part of the reactor (also build by Tycho pomless) and listed as Require-Bundle dependency in the com.salesforce.bazel-java-sdk.tests_1.0.0.qualifier bundle.
>> The class itself is an interface and shouldn't cause any issues loading.
>> https://github.com/salesforce/bazel-eclipse/blob/master/bundles/com.salesforce.bazel-java-sdk/src/main/java/com/salesforce/bazel/sdk/model/BazelPackageLocation.java
>> Inspecting the work folder I can see that the bundle with the class is actually listed in config.ini/osgi.bundles
>> I checked with the OSGi console and all bundles seems to be there. Also the bundle with the class in question. Thus, I don't really understand why Surefire is failing to load the class.
>> Any ideas?
>> -Gunnar
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/tycho-user



Back to the top