[ 
https://issues.apache.org/jira/browse/FELIX-5328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15496053#comment-15496053
 ] 

Konrad Windszus commented on FELIX-5328:
----------------------------------------

Thanks [~cziegeler]. Your fix looks better and should cover all exceptions.

> NoClassDefFound not wrapped in the ClassScanner
> -----------------------------------------------
>
>                 Key: FELIX-5328
>                 URL: https://issues.apache.org/jira/browse/FELIX-5328
>             Project: Felix
>          Issue Type: Bug
>          Components: SCR Tooling
>    Affects Versions: scr generator 1.14.0
>            Reporter: Konrad Windszus
>            Assignee: Carsten Ziegeler
>             Fix For: maven-scr-plugin 1.23.0, scr ant task 1.16.0, scr 
> generator 1.15.0, scr bnd plugin 1.6.0
>
>
> Unfortunately only {{ClassNotFoundException}} is wrapped in 
> https://github.com/apache/felix/blob/trunk/tools/org.apache.felix.scr.generator/src/main/java/org/apache/felix/scrplugin/helper/ClassScanner.java#L148.
>  Every other exception is not wrapped at all, making it very hard to figure 
> out where an issue happened.
> An example stack trace of an error might look likes this
> {code}
> [ERROR] Bundle <some bundle : Got unexpected exception while 
> analyzing:java.lang.NoClassDefFoundError: 
> javax/servlet/jsp/el/VariableResolver
>       at java.lang.ClassLoader.defineClass1(Native Method)
>       at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
>       at 
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>       at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
>       at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
>       at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
>       at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>       at 
> org.apache.felix.scrplugin.helper.ClassScanner.scanSources(ClassScanner.java:144)
>       at 
> org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:146)
>       at 
> org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin.analyzeJar(SCRDescriptorBndPlugin.java:178)
>       at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:656)
>       at aQute.bnd.osgi.Analyzer.analyze(Analyzer.java:209)
>       at aQute.bnd.osgi.Builder.analyze(Builder.java:385)
>       at aQute.bnd.osgi.Analyzer.calcManifest(Analyzer.java:687)
>       at aQute.bnd.osgi.Builder.build(Builder.java:105)
>       at 
> org.apache.felix.bundleplugin.BundlePlugin.buildOSGiBundle(BundlePlugin.java:972)
>       at 
> org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:470)
>       at 
> org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:387)
>       at 
> org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:378)
>       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>       at 
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
>       at 
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
>       at 
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>       at 
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
>       at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
>       at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:497)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> Caused by: java.lang.ClassNotFoundException: 
> javax.servlet.jsp.el.VariableResolver
>       at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> {code}
> I would suggest to not only catch {{ClassNotFoundException}} in the 
> {{ClassScanner}} but basically all {{Throwable's}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to