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.
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'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...
Why? Need to know the reason. Console shows when building the project.
Android Application. When i try to Build the app this error is shown in the console. Anybody know the fix please help. And one main thing is its showing only for one project all other projects are working correctly.I think its the problem with "Android Build Tools"
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.NullPointerException
at com.android.dx.util.ByteArray.<init>(ByteArray.java:76)
at com.android.dx.cf.direct.DirectClassFile.<init>(DirectClassFile.java:206)
at com.android.dx.command.dexer.Main.processClass(Main.java:661)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
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.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:786)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:597)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1143)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:155)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
[2014-03-11 10:34:21 - User] Dx 1 error; aborting
[2014-03-11 10:34:21 - User] Conversion to Dalvik format failed with error 1
This Solves my problem. Well that happend to me as I tried to build my latest project. Solution was quite simple but… strange. Just remove all newer Android SDK build-tools (i.e. 19) until the Version 18.1.1 with the Android SDK Manager. Restart Eclipse. And it will work. If not, try to add the Support Libraries (Right click on your Android Project in Eclipse, choose Android Tools, Add Support Library)
https://stackoverflow.com/questions/22316924/why-need-to-know-the-reason-console-shows-when-building-the-project
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
The question lays out all the pertinent versions.
I'm trying to run one of the sample files at http://www.jcuda.org: JCublasMatrixInvert.java.
I've got the NVIDIA CUDA drivers installed; I've downloaded the JCUDA 0.4.1 bindings and added their /lib directory to my java.library.path. Here are the JVM parameters I set when I run:
-ea -XX:+UseParNewGC -XX:+UseNUMA -XX:PermSize=128m -XX:MaxPermSize=256m -Xmx1024m -Djava.library.path=F:\Projects\Java\learning\out\production\learning
Yet when I try to run the class I get the following stack trace:
Error while loading native library "JCublas-windows-x86_64" with base name "JCublas"
Operating system name: Windows 7
Architecture : amd64
Architecture bit size: 64
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name '/lib/JCublas-windows-x86_64.dll'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:151)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.jcublas.JCublas.initialize(JCublas.java:82)
at jcuda.jcublas.JCublas.<clinit>(JCublas.java:70)
at matrix.jcuda.JCublasMatrixInvert.main(JCublasMatrixInvert.java:34)
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:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: F:\Projects\Java\learning\out\production\learning\JCublas-windows-x86_64.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1928)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at jcuda.LibUtils.loadLibrary(LibUtils.java:94)
at jcuda.jcublas.JCublas.initialize(JCublas.java:82)
at jcuda.jcublas.JCublas.<clinit>(JCublas.java:70)
at matrix.jcuda.JCublasMatrixInvert.main(JCublasMatrixInvert.java:34)
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:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:129)
at jcuda.jcublas.JCublas.initialize(JCublas.java:82)
at jcuda.jcublas.JCublas.<clinit>(JCublas.java:70)
at matrix.jcuda.JCublasMatrixInvert.main(JCublasMatrixInvert.java:34)
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:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 1
I can see the allegedly missing dll at the path
F:\Projects\Java\learning\out\production\learning\JCublas-windows-x86_64.dll
What have I missed? What am I doing wrong? Can anyone who has had success with running this example advise me? Thanks.
If standard way is too hard - I recommend you to use mavenized version of JCuda. You could clone standard project here - https://github.com/MysterionRise/mavenized-jcuda it's working automatically for Windows/Linux 32/64 bit
All you need to do is to run:
You need to install Cuda 5.5 for your platform here - https://developer.nvidia.com/cuda-downloads
Call mvn clean package to build project
Call mvn exec:exec to run main class with "Hello, JCuda" sample :)
After that you could replace main class with your JCuda code
Download that file from the jCuda download section and put it into your library path.