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...
Related
I have created a library in java and I am trying to use it in my Java Play Framework application with Intellij.
The documentations tells me that I only need to add it to my lib folder in the project.
Yet, when I type activator run on the terminal, I have the following error(the library is seen in the Intellij and I can use it in my new code):
java.lang.ClassCastException: org.slf4j.impl.SimpleLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:80)
at play.api.libs.logback.LogbackLoggerConfigurator.init(LogbackLoggerConfigurator.scala:26)
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:94)
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:65)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:64)
at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala:54)
at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala)
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:498)
at play.runsupport.Reloader$.startDevMode(Reloader.scala:234)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.devModeServer$lzycompute$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:100)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:53)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.lang.reflect.InvocationTargetException
[error] Total time: 0 s, completed 13/out/2016 23:37:26
If your jar is an unmanaged jar, that means it is not part of any sbt repo, then you need to add the following line in your build.sbt.
unmanagedJars in Compile += file("lib/your_jar.jar")
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?
Maybe you can help me
I got a strange apache maven's problem, when opening my project at Intellij Idea 13.
When projects was open I have no libraries at External Libraries section. And at all pom.xml files from diff's modules I see error "Cannot reconnect".
I tried to Invalidate Cache/Restart Idea, try to use Maven Reimport but problem still take a place.
But if I do mvn clean install, and deploy my projects everything works fine.
I use Maven 3.2.3. and Java 1.8.
Maven settings:
Aded idea.log files:
2015-06-03 11:54:24,585 [ 441715] INFO - #org.jetbrains.idea.maven - Cannot reconnect.
java.lang.RuntimeException: Cannot reconnect.
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:98)
at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.resolveProject(MavenEmbedderWrapper.java:97)
at org.jetbrains.idea.maven.project.MavenProjectReader.resolveProject(MavenProjectReader.java:462)
at org.jetbrains.idea.maven.project.MavenProject.resolve(MavenProject.java:624)
at org.jetbrains.idea.maven.project.MavenProjectsTree.resolve(MavenProjectsTree.java:1215)
at org.jetbrains.idea.maven.project.MavenProjectsProcessorResolvingTask.perform(MavenProjectsProcessorResolvingTask.java:42)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:131)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$100(MavenProjectsProcessor.java:28)
at org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:107)
at org.jetbrains.idea.maven.utils.MavenUtil$6.run(MavenUtil.java:440)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)
Caused by: java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:351)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/99407688.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
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)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at com.sun.proxy.$Proxy121.resolveProject(Unknown Source)
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 com.intellij.execution.rmi.RemoteUtil$2$1$1.compute(RemoteUtil.java:106)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:167)
at com.intellij.execution.rmi.RemoteUtil$2$1.invoke(RemoteUtil.java:102)
at com.sun.proxy.$Proxy121.resolveProject(Unknown Source)
at org.jetbrains.idea.maven.server.MavenEmbedderWrapper$4.execute(MavenEmbedderWrapper.java:100)
at org.jetbrains.idea.maven.server.MavenEmbedderWrapper$4.execute(MavenEmbedderWrapper.java:97)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:89)
... 16 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
at org.apache.maven.wagon.providers.file.FileWagon.resolveDestinationPath(FileWagon.java:206)
at org.apache.maven.wagon.providers.file.FileWagon.resourceExists(FileWagon.java:265)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:577)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
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)
2015-06-03 11:54:24,586 [ 441716] WARN - ution.rmi.RemoteProcessSupport - Exception in thread "pool-6-thread-1" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
2015-06-03 11:54:24,586 [ 441716] WARN - ution.rmi.RemoteProcessSupport - at org.apache.maven.wagon.providers.file.FileWagon.resolveDestinationPath(FileWagon.java:206)
I was facing the same error and fixed it like that:
Open settings by pressing Ctrl+Alt+S and navigate to Build, Execution, Deployment | Build Tools | Maven | Importing
Check JDK for Importer and change the exact version of JDK (example : 1.8.0.250) installed on your machine from the drop-down.
After doing the same it prompts for verification and after that, the maven will be automatically updated and the project will run.
In my case, I did the same thing as the JDK which is used in the machine is different when the project is imported from a repository. These things happen when we uninstall the IDE and JDK and install the IDE and different version of JDK, the IDE automatically fetch the project which is available in the machine as before but it can not change the imported JDK.
I fixed this by changing my local Maven 3.3.9 to Idea Bundle Maven3.
Clicking on Reload All Maven Projects helped me in this scenario.
File -> Invalid Cache
might also be helpful in a scenario where IntelliJ seems to tangle up itself.
In case you are running InteliJ in WSL with X-Server (e.g. VcXsrv), a solution may be to
close InteliJ
restart the server
open Intelij
and it will be working.
I was getting this error and I fixed this error in IntelliJ by following steps:
1] close all running application(if any)
2] reimport/reload pom.xml (right-click on pom.xml -> select maven option->reimport/reload project)
3] then run your application(i.e. main file)
by following this I did not needed to delete the .m2 folder manually
I fixed this problem by removing .lastUpdated files coming from transfer error in ~/.m2
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
In my case, I have maven runner and importer set to use Project JDK, but I managed to solve this problem by changing JDK from OpenJDK to Liberica JDK (same Java version) and it magically started working.
So for anyone with similar problem, try to change JDK to different implementation.
I have a project that uses the gradle build system and I'm willing to add New Relic monitoring to it.
The project (including New Relic) is working fine on Linux (Fedora 20), but won't build on my Mac development system, and gives out an error stating Agent JAR loaded but agent failed to initialize.
Here is the full log of the error:
Dev-1:test 0x4d$ ./gradlew clean
> Configuring > 1/2 projects > :appobjc[4437]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
[newrelic.error] Agent startup error
java.lang.IllegalAccessException: Can not set static final java.lang.Object field java.util.logging.Logger.treeLock to com.newrelic.agent.compile.RewriterAgent$InvocationDispatcher
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:73)
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:77)
at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:77)
at java.lang.reflect.Field.set(Field.java:741)
at com.newrelic.agent.compile.RewriterAgent.createInvocationDispatcher(RewriterAgent.java:772)
at com.newrelic.agent.compile.RewriterAgent.premain(RewriterAgent.java:137)
at com.newrelic.agent.compile.RewriterAgent.agentmain(RewriterAgent.java:102)
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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:407)
> Configuring > 1/2 projects > :appExcjava.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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:407)
Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: Can not set static final java.lang.Object field java.util.logging.Logger.treeLock to com.newrelic.agent.compile.RewriterAgent$InvocationDispatcher
at com.newrelic.agent.compile.RewriterAgent.premain(RewriterAgent.java:168)
at com.newrelic.agent.compile.RewriterAgent.agentmain(RewriterAgent.java:102)
... 6 more
Caused by: java.lang.IllegalAccessException: Can not set static final java.lang.Object field java.util.logging.Logger.treeLock to com.newrelic.agent.compile.RewriterAgent$InvocationDispatcher
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:73)
at sun.reflect.UnsafeFieldAccessorImpl.throwFinalFieldIllegalAccessException(UnsafeFieldAccessorImpl.java:77)
at sun.reflect.UnsafeQualifiedStaticObjectFieldAccessorImpl.set(UnsafeQualifiedStaticObjectFieldAccessorImpl.java:77)
at java.lang.reflect.Field.set(Field.java:741)
at com.newrelic.agent.compile.RewriterAgent.createInvocationDispatcher(RewriterAgent.java:772)
at com.newrelic.agent.compile.RewriterAgent.premain(RewriterAgent.java:137)
... 7 more
> Configuring > 1/2 projects > :appAgent failed to start!
[newrelic] Error encountered while loading the New Relic agent
com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize
at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:121)
at com.newrelic.agent.android.NewRelicGradlePlugin.apply(NewRelicGradlePlugin.java:47)
at com.newrelic.agent.android.NewRelicGradlePlugin.apply(NewRelicGradlePlugin.java:15)
at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:104)
at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)
at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:39)
at org.gradle.api.Project$apply.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
at org.gradle.api.Script$apply.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at build_hf6jnn002tc8mnuv025i0lb49.run(/Users/0x4d/Desktop/test/app/build.gradle:15)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:507)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:46)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:37)
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.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.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 org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/0x4d/Desktop/test/app/build.gradle' line: 15
* What went wrong:
A problem occurred evaluating project ':app'.
> com.sun.tools.attach.AgentInitializationException: Agent JAR loaded but agent failed to initialize
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 14.094 secs
I have also tested with a freshly generated, bare-bones project, but it fails with the exact same error.
I use the JDK 1.7u55 version, if that matters.
Thanks
Unfortunately u55 introduced a change that breaks the New Relic agent. For now, if possible, use an older version of Java to work around this issue while building. This shouldn't affect the resulting APK. New Relic is aware of this issue and is working to fix it as fast as possible.
I emailed New Relic support, and I got the following response:
Hello,
Thanks for writing into New Relic support.
A new version of the New Relic for Mobile Apps Android SDK is in beta
and includes a fix for compatibility with JDK v7u55 and JDK v8
It is available here:
https://gist.github.com/asm/bed819fb32253e4cb072.
We're waiting to release this agent until we hear from users like you
that the SDK is running smoothly and instrumentation is now working
correctly.
Please let us know if you have any trouble installing this SDK.
I'm going to leave this ticket open so that you can send us an update.
Our automatic system will ping you to see how you're doing in a few
days and then try to close the ticket a few days after that. If it
does, don't worry, write back any time and we'll get right to helping
you.
There's a new version of new relic client available. It resolves issues that V3.361.0 had around newer JDKs and proguard. Here's what you should use to resolve the JDK problem.
classpath 'com.newrelic.agent.android:agent-gradle-plugin:3.378.0'
Paste this into your build.gradle where you have listed your dependencies. Let me know if it doesn't work.
Following this instruction, I could run headless Eclipse plugin in side Eclipse IDE.
I've got some error log info, but I guess I could ignore it based on this post - Unable to find feature.xml in directory
Following the instruction in site, I could generate the jar file. After copying the org.eclipse.equinox.launcher.jar, I tried to execute the jar file
java -jar org.eclipse.equinox.launcher_1.2.0.v20110502.jar -application headlessHello_1.0.0.201210101430.jar
I tried
java -cp .:org.eclipse.equinox.launcher_1.2.0.v20110502.jar org.eclipse.core.launcher.Main -application headlessHello_1.0.0.201210101430.jar
to get error message
An error has occurred. See the log file
/Users/users/Desktop/configuration/1349897444823.log
with this log file
!SESSION Wed Oct 10 14:30:44 CDT 2012 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2012-10-10 14:30:44.843
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.RuntimeException: Could not find framework
at org.eclipse.equinox.launcher.Main.getBootPath(Main.java:978)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:557)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
ADDED
From this site, the issue was because I didn't setup %R2_HOME%/plugins correctly. After the setup, I still get the error.
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
at org.eclipse.core.launcher.Main.main(Main.java:34)
An instance of headless Eclipse needs to include many plugins, not just your plugin. A minimal product includes:
org.eclipse.core.runtime
org.eclipse.core.variables
<your plugin(s) here>
EDIT
I generated the product, and here is the list of plugins used by my "minimal" headless Eclipse:
I output the product, and here is the list of plugins loaded:
org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar
org.eclipse.core.jobs_3.5.1.R36x_v20100824.jar
org.eclipse.core.runtime.compatibility.auth_3.2.200.v20100517.jar
org.eclipse.core.runtime.compatibility.registry_3.3.0.v20100520
org.eclipse.core.runtime_3.6.0.v20100505.jar
org.eclipse.equinox.app_1.3.1.R36x_v20100803.jar
org.eclipse.equinox.common_3.6.0.v20100503.jar
org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
org.eclipse.equinox.preferences_3.3.0.v20100503.jar
org.eclipse.equinox.registry_3.5.0.v20100503.jar
org.eclipse.osgi.services_3.2.100.v20100503.jar
org.eclipse.osgi.util_3.2.100.v20100503.jar
org.eclipse.osgi_3.6.2.R36x_v20110210.jar
So, might I recommend that you create a product for this Eclipse application you are building, and try that. Looking for a FAQ I found this. http://wiki.eclipse.org/FAQ_What_is_the_minimal_Eclipse_configuration%3F