SonarQube analysis of Java module fails in Jenkins - java

I have created a Jenkins project to run SonarQube analysis of my product code. The workspace contains multiple modules (some in Nodejs i.e. Javascript) and some in Java. My sonar properties looks like
sonar.projectKey=product-key
sonar.projectName=product-name
sonar.projectVersion=1.0
sonar.sources=./nodejsmodule1,./nodejsmodule2
sonar.sourceEncoding=UTF-8
This works perfectly without issue and gives me a nice SonarQube dashboard. However, if I change the sonar.sources property to:
sonar.sources=./nodejsmodule1,./nodejsmodule2,./java-module-name/src/main/java
the Jenkins build fails with the following error:
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getPom()Lorg/apache/maven/project/MavenProject;
at org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectoryFromPluginConfiguration(SurefireUtils.java:56)
at org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(SurefireUtils.java:39)
at org.sonar.plugins.surefire.SurefireSensor.analyse(SurefireSensor.java:63)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:258)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:253)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:76)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
When I use
sonar.sources=./nodejsmodule1,./nodejsmodule2,./java-module-name/pom.xml
The error goes away. The multi-language analysis happens. The events widget on the SonarQube dashboard for the project shows that Java and JavaScript profiles got used during the analysis. But the code analysis results don't contain anything about Java. JavaScript analysis results show up. Doesn't matter in which order I specify the sonar.sources values (i.e. JavaScript followed by Java or Java followed by JavaScript). I looked at other StackOverflow questions (e.g. Sonar analysing Maven 3 and multi language project using JENKINS). Clearly, they are specifying the location of the classes file as well. Maybe the java code is getting compiled during the Jenkins build step for SonarQube analysis so they can point to the target/classes location. When I try this (i.e. sonar.binaries=./java-module-name/target/classes), the build fails.
Based on http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+Maven#AnalyzingwithSonarQubeScannerforMaven-AnalyzingaMulti-languageProject, I also tried sonar.sources=./java-module-name/src,./java-module-name/pom.xml. But that brings back the exception. The exception also happens for sonar.sources=./java-module-name,./java-module-name/pom.xml, sonar.sources=./java-module-name/src/main,./java-module-name/pom.xml and sonar.sources=./java-module-name/src/main/java,./java-module-name/pom.xml.
What am I doing wrong?

The error only shows up when you include Java sources? So maybe you are using some outdated plugins on your 5.2, which are triggered on Java analysis and use the no longer available getPom() method.
org.sonar.api.resources.Project.getPom() is no longer available in SQ 5.2.
See Project.class in 5.2
The stacktrace points to surefire. Which version are you using?

Related

Weblogic Error - Could not initialize class weblogic.jndi.Environment

When I try to debug a WebApp configured to run with Oracle Weblogic Server from NetBeans 10, I always get the following error:
There's not even complicated steps, I just open my project and then right-click / Debug.
java.lang.NoClassDefFoundError: Could not initialize class weblogic.jndi.Environment
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730)
at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
at weblogic.management.remote.common.ClientProviderBase.makeConnection(ClientProviderBase.java:178)
at weblogic.management.remote.common.ClientProviderBase.newJMXConnector(ClientProviderBase.java:84)
at java.management/javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:378)
at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport$1.call(WLConnectionSupport.java:182)
at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport.executeAction(WLConnectionSupport.java:112)
at org.netbeans.modules.j2ee.weblogic9.WLConnectionSupport.executeAction(WLConnectionSupport.java:161)
at org.netbeans.modules.j2ee.weblogic9.deploy.WLDeploymentManager.getTargets(WLDeploymentManager.java:632)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargetMap(ServerInstance.java:560)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.getTargets(ServerInstance.java:518)
at org.netbeans.modules.j2ee.deployment.impl.ServerString.getTargets(ServerString.java:117)
at org.netbeans.modules.j2ee.deployment.impl.ServerString.toTargets(ServerString.java:155)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:146)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.undeploy(TargetServer.java:771)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.undeploy(Deployment.java:337)
at org.netbeans.modules.j2ee.ant.Undeploy.execute(Undeploy.java:92)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at jdk.internal.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:261)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:574)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:128)
BUILD FAILED (total time: 0 seconds)
My environment is:
NetBeans 10 running on Java 10.0.2+13
Windows 10
Weblogic Server 10.3.6 running on Java 1.6.0.45
How to fix?
For Eclipse IDE, the solution for me was to switch from JDK11 to JDK8 on the client.
I've decided to post this question because it took me the whole morning to find a solution... especially because the most common reason for java.lang.NoClassDefFoundError: Could not initialize class weblogic.jndi.Environment to occur, is when weblogic.jar and wlfullclient.jar aren't being properly located by any of IDE, WebApp, or WL.
To fix the issue just run your project using NetBeans 8.2, this seems to be a bug at NB10 only.
Also, don't even try running it on NB11, NB12, NB12.1 nor NB12.2. Currently, Java EE plugin for those versions is discontinued so you'll not even be able to add WL to your server list.
The reason it broke in NB10 is that they started removing Java 8 vendor features from it, And the reason it doesn't even is possible to add WL to NB11 > is because Oracle removed JDK8 features for the followed releases of Java... NB integration is not under Apache Licence so they just aren't giving support to it now (is an issue that they refused to fix). However, with a bit of risk, it can be added manually.

Not able to generate aggregate csv file in Jmeter

In my application i am not able to create the aggregate file in my test? Below is the error iam facing, Any plugin i need to add?
ERROR: java.lang.NoSuchMethodError: org.apache.jorphan.util.JOrphanUtils.closeQuietly(Ljava/io/Closeable;)V
* Problem's technical details go below *
Home directory was detected as: /prod/products/Performance_Testing/apache-jmeter-2.11/lib/ext
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.jorphan.util.JOrphanUtils.closeQuietly(Ljava/io/Closeable;)V
at org.apache.jmeter.util.JMeterUtils.loadJMeterProperties(JMeterUtils.java:198)
at kg.apc.jmeter.PluginsCMDWorker.initializeProperties(PluginsCMDWorker.java:95)
at kg.apc.jmeter.PluginsCMDWorker.prepareJMeterEnv(PluginsCMDWorker.java:85)
at kg.apc.jmeter.PluginsCMDWorker.(PluginsCMDWorker.java:55)
at kg.apc.cmdtools.ReporterTool.processParams(ReporterTool.java:66)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:63)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
/prod/products/Performance_Testing/Application/Batch/../Results/1496905397Filters_ByPerson_PeopleSideA_1/Report/1496905686911/aggregate_00.csv (No such file or directory)
IOException: processing requests
I think this is due to JMeter Plugins and JMeter version mismatch
Upgrade to JMeter 3.2 (or whatever version will be the latest by that time), you can get it from JMeter Downloads page
Install JMeter Plugins Manager
Install plugins you require via the JMeter Plugins Manager
If the problem still persists report the problem via JMeter Plugins Support Forum

Intellij Groovy Compiler throws error Grabbing Grapes (download failed)

I'm currently getting the following error when I try to compile my groovy project in Intellij IDEA 15.0.3 on Mac OSX 10.10.5. (This issue is not occurring for the same project on a Windows machine)
Information:Groovyc: java.lang.RuntimeException: Error grabbing Grapes -- [download failed:
com.google.code.gson#gson;2.2.4!gson.jar]
The JAR exists in repo.maven.org and in jcenter.bintray.com.
I can download and include it in my project explicitly using compile "com.google.code.gson:gson:2.2.4" - I still see this compiler issue.
I can't see any reason why the download would fail, I'm using the out-of-the-box ~/.gradle/grapeConfig.xml.
I've tried deleting my grapes cache directory and re-downloading dependencies - works for all my explicitly defined dependencies.
I'm on a home network - no proxy.
I want to enable advanced logging, so that I can see the exact reason why the Grapes download is failing. I've tried adding the groovy.grape.report.downloads=true system property to the terminal (and in ~/.bashrc), but to no avail. I couldn't find any way of setting these properties in the Intellij "Groovy Compiler" settings page. (If I could enable Grapes logging, I'm confident I'd be able to see the root cause)
The Intellij project is setup from gradle cleanIdea idea. When the project is built from the command line - gradle clean build (on Mac and Windows), the application compiles with no errors - only problem is in Intellij on a Mac.
This gson.jar isn't actually referenced in any #Grab/#Grape annotations, I haven't checked but I'm guessing it's a transitive dependency.
Any help would be greatly appreciated!
Full Stack Trace
Information:Using javac 1.8.0_60 to compile java sources
Information:Groovyc: Groovyc stub generation failed
Information:Groovyc: java.lang.RuntimeException: Error grabbing Grapes -- [download failed: com.google.code.gson#gson;2.2.4!gson.jar]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:74)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at groovy.grape.GrapeIvy.getDependencies(GrapeIvy.groovy:421)
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.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:169)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:566)
at groovy.grape.GrapeIvy$resolve$1.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:190)
at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:535)
at groovy.grape.GrapeIvy$resolve$0.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:257)
at groovy.grape.Grape.grab(Grape.java:166)
at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:360)
at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:321)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115)
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.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:134)
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.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:156)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.access$000(InProcessGroovyc.java:51)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc$1.call(InProcessGroovyc.java:85)
at org.jetbrains.jps.incremental.groovy.InProcessGroovyc$1.call(InProcessGroovyc.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Information:java: Errors occurred while compiling module 'server'
Information:12/02/2016 6:45 PM - Compilation completed with 3 errors and 0 warnings in 9s 266ms
/<myproject>/WebConfigurer.java
Error:(10, 37) java: cannot find symbol
symbol: class HtmlHttpMessageConverter
location: package mypackage.mediaType
Error:(113, 16) java: cannot find symbol
symbol: class HtmlHttpMessageConverter
location: class mypackage.WebConfigurer
/<myproject>/SirenConverters.java
Error:(14, 38) java: package mypackage.controller does not exist
Related(?)
Groovy - Grab - download failed
Update 14/02/16 - still no luck
Moved grapeConfig.xml to correct directory - ~/.groovy/grapeConfig.xml
Enabled debug logging in Intellij:
...
<root>
<priority value="DEBUG"/>
<appender-ref ref="DIALOG"/>
<appender-ref ref="CONSOLE-DEBUG"/>
<appender-ref ref="FILE"/>
</root>
...
No further details about exception found in ~/Library/Logs/IdeaIC15/idea.log
Added logging flag to /Applications/IntelliJ\ IDEA\ 15\ CE.app/Contents/bin/idea.vmoptions
-Dgroovy.grape.report.downloads=true
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops
No observable change in the logs or console.
Added -Dgroovy.grape.report.downloads=true to Intellij Preferences > Compiler > Shared build process VM options:
No observable change in the logs or console.
I had the same problem and for me it was the maven cache that was the problem.
I found the solution on this page:
rm -rf ~/.m2/repository ~/.groovy/grapes
I had previously tried removing the ~/.groovy/grapes cache, but that didn't fix the problem. Removing the ~/.m2/repository is what actually did it for me.
I got this script working in IntelliJ without problem:
#Grab(group = 'com.google.code.gson', module = 'gson', version = '2.2.4')
import com.google.gson.Gson
println Gson
First thing I did was to write the #Grab declaration... right-click on it, select "Grab artifacts"...
EDIT: Actually, I think put the cursor on #Grab, then pushed Alt+Enter (which is what I usually do to get suggestions from IntelliJ).
IntelliJ failed and told me I need to add Ivy to the classpath... so I opened Project Structure, in Module dependencies added Ivy, tried again... it worked.
Running the script again, it printed the expected message.
Hope that helps somehow...

java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy?

while starting my weblogic(having my app war file containing logback-classic-1.0.1.jar),i am getting below exception.Any suggestion ?
<Sep 9, 2015 9:27:13 AM UTC> <Warning> <Common> <BEA-000632> <Resource Pool "JDBC Data Source-0" shutting down, ignoring 3 resources still in use by applications..>
Exception in thread "Thread-12" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:125)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:468)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:424)
at ch.qos.logback.classic.Logger.log(Logger.java:824)
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:415)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:213)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
................
at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:52)
... 18 more
Exception in thread "Thread-18" java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:125)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:468)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:424)
at ch.qos.logback.classic.Logger.log(Logger.java:824)
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:415)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:114)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:213)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
.......................
at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:52)
... 18 more
This error happens when spring applications jar are rebuilt, removed, or updated during execution.
Ref: https://github.com/spring-projects/spring-boot/issues/4968
I have been getting this same error when breaking out (ctrl-c) from Dropwizard server, I finally learned why I get it.
My Dropwizard is build into one fat jar, that I build with Gradle, and when running server on my local computer I run it directly from build/libs/...fat.jar
So this exception occurs when I have changed source code, built app-server again, and Gradle has overwritten the same jar I am currently running with "java -jar ...", so it's not that weird that classes that haven't been used before that session will not load ok :)
This type of exception occurs when your classpath does not contain this class. If the jar's class is in your classpath, you pay attention to what classpath application you using at runtime. Indeed, often, classpath can be overwritten during runtime, or simply you can use a different one (for example, in a startup script).
For us, appears this meant "you are running out of file handles, increase your open file handle limit." (too many sockets were being created, using them all up). Credit to the original answer here.
Other things I've seen: make sure your spring boot is at least 1.3.8
Also make sure the jars underneath aren't being overwritten/changed/unstable file system. FWIW.
I got this runtime error in my spring boot app using Spring Boot version 2.3.5.RELEASE. Resolved by adding following dependencies in my build.gradle file.
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.3'
Two options I see(not enough information yet):
1. It happens right upon loading, I bet for classpath, see answers above.
2. It happens after some time, when app is runnig(my case), read next paragraphs.
When I got class not found errors and also have the same error like you right now, quite offten is issued with no space left on device aka full disk, full memory.
My environment, is spring boot, logback is included automagicaly, in maven have repackage, so wverithing I need is included.
This error occures after my app is runnig for 20 minutes or so, is has thousands of threads. If you do not limit memory for your virtual maschine, it can get very high even if it is not necessary.
Once(2 days ago) I spend 3 hours looking around claspath stuf, ... issue was full disk
If you exactly ensure that logback-class and logback-core already are in your classpath. See below.
In your Logback.xml, you need add debug="true"
<configuration debug="true">
I encountered the problem 'java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy' in my tomcat.
However, after adding debug = 'true', anything is ok.
The class that is missing definitely exists in the JAR you have, I checked logback-classic-1.0.1.jar:
2012-03-07 07:34:18 ..... 4729 2018 ch\qos\logback\classic\spi\ThrowableProxy.class
Make sure your classpath is set up correctly. By the way: if possible update logback because this version is 3 years old.
I solved this problem by doing "mvn install" instead of "mvn clean install".

UnsatisfiedLinkError when running Jetty9's setUID feature

I just tried to run Jetty 9 as non root users, using setuid feature without success for binding low port numbers.
I enabled the module setuid in the start.ini and added -Djava.library.path=/opt/jetty/lib/setuid
But I have the following stack trace when starting Jetty:
2015-06-09 16:27:27.211:WARN:oejx.XmlConfiguration:main: Config error
at | |
java.lang.reflect.InvocationTargetException in
file:/opt/jetty/etc/jetty-setuid.xml
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:321)
at org.eclipse.jetty.start.Main.start(Main.java:817)
at org.eclipse.jetty.start.Main.main(Main.java:112) Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:479)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:815)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1125)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:721)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:417)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:354)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262)
at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1243)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174)
... 7 more Caused by: java.lang.UnsatisfiedLinkError: org.eclipse.jetty.setuid.SetUID.getpwnam(Ljava/lang/String;)Lorg/eclipse/jetty/setuid/Passwd;
at org.eclipse.jetty.setuid.SetUID.getpwnam(Native Method)
at org.eclipse.jetty.setuid.SetUIDListener.setUsername(SetUIDListener.java:53)
... 23 more
Those are the only references to this error:
dev.eclipse.org/mhonarc/lists/jetty-users/msg01657.html
groups.google.com/forum/#!topic/dropwizard-user/aap2B_U_QPo
But they are either stopped or do not show the solution.
The source code I found for the setuid package is:
https://github.com/jetty-project/codehaus-jetty-project/blob/master/jetty-setuid/modules/java/src/main/java/org/mortbay/setuid/SetUID.java
Even though I cannot be sure this is the version I am using, given this one is from a org.mortbay package, while the one Jetty 9 uses is an Eclipse one.
I tried setting -Djetty.libsetuid.path in the java args (first try-catch block), either adding the path to the $PATH variable or setting -Djava.library.path (second try-catch block) or copying the so to /lib and, finally, leaving it as it is (third try-catch block). I got the same exception stack in all the cases.
I cannot be sure if Jetty is either not finding the so file or not being able to load it, given that, if I remove all the references to the path (the cases I described latter), I still get the same error message.
I use Java7 to run Jetty.
Edit
I added the following snippet to one of my webapps as as matter of test, given that if the webapp succeed, I would know the problem is not in finding the shared object:
SetUID.setgid(1002);
SetUID.setuid(1002);
Passwd pw = SetUID.getpwuid(1002);
System.setProperty("user.name", pw.getPwName());
System.setProperty("user.home", pw.getPwDir());
I have the same UnsatisfiedLinkError as a result.
Edit2
I tried, instead, the following:
System.load(SetUID.__FILENAME);
SetUID.setgid(1002);
Which got me the following error message:
javax.servlet.ServletException: java.lang.UnsatisfiedLinkError: Native
Library /lib/libsetuid.so already loaded in another classloader
I may conclude, therefore, that the library has been loaded, at least.
Exploring the libsetuid file (nm -D /path/to/the/so), I realized that the so I was using was outdated and was not compatible with Jetty 9, the functions were named as mortbay:
root#root:~/# nm -D libsetuid.so --size-sort | less
0000000000000010 T Java_org_mortbay_setuid_SetUID_setgid
0000000000000010 T Java_org_mortbay_setuid_SetUID_setuid
0000000000000015 T Java_org_mortbay_setuid_SetUID_setumask
0000000000000018 T throwNewJavaSecurityException 0000000000000058 T
throwNewJavaException 000000000000008e T
Java_org_mortbay_setuid_SetUID_setrlimitnofiles 00000000000000a7 T
getJavaMethodId 00000000000000f5 T
Java_org_mortbay_setuid_SetUID_getrlimitnofiles 0000000000000102 T
getJavaFieldInt 0000000000000111 T setJavaFieldInt 0000000000000111 T
setJavaFieldLong 0000000000000121 T setJavaFieldString
00000000000001ba T Java_org_mortbay_setuid_SetUID_getpwuid
00000000000001e5 T Java_org_mortbay_setuid_SetUID_getpwnam
000000000000027e T Java_org_mortbay_setuid_SetUID_getgrgid
000000000000029e T Java_org_mortbay_setuid_SetUID_getgrnam
Now, I am using the shared object that already comes in the jetty download, not the one linked in the wiki.
In addition to that, looking through the code of the setuid module, I decided using the property -Djetty.libsetuid.path in my java args for indicating the absolute path of the lib, e.g., -Djetty.libsetuid.path=/opt/jetty/lib/setuid.so

Categories