question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No agent booting via Java

See original GitHub issue

Describe the bug

I can run my application via maven exec:java because it starts a Java class which will create an agent.

However, I cannot anymore in 0.11.0 start an agent directly using Java + SRE’s Booting service.

Even trying to do what is stated in http://www.sarl.io/docs/official/gettingstarted/RunSARLAgentCLI.html gives error:

$ java -cp target/agtcity-sarl-base-4.5.0.11.0-jar-with-dependencies.jar io.sarl.sre.boot.Boot --help
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/home/ssardina/git/soft/agents/MAC-AgtCity/2018-rmit/agtcity-sarl-base.git/target/agtcity-sarl-base-4.5.0.11.0-jar-with-dependencies.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Could not find a suitable constructor in io.sarl.sre.boot.commands.RunSingleAgentCommand. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
  at io.sarl.sre.boot.commands.RunSingleAgentCommand.class(RunSingleAgentCommand.java:60)
  at io.bootique.BQCoreModuleExtender.setDefaultCommand(BQCoreModuleExtender.java:95)

1 error
	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)
	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
	at com.google.inject.Guice.createInjector(Guice.java:99)
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at io.bootique.Bootique.createInjector(Bootique.java:472)
	at io.bootique.Bootique.createRuntime(Bootique.java:330)
	at io.sarl.sre.boot.SreMain.createRuntime(SreMain.java:232)
	at io.sarl.sre.boot.SreMain.ensureBootiqueRuntimeInstance(SreMain.java:238)
	at io.sarl.sre.boot.SreMain.runSRE(SreMain.java:253)
	at io.sarl.sre.boot.Boot.main(Boot.java:84)

When I try to boot an agent:

$ java -cp target/agtcity-sarl-base-4.5.0.11.0-jar-with-dependencies.jar io.sarl.sre.boot.Boot au.edu.rmit.agtgrp.agtcity.sarl.agents.dummy.SuperSingleAgent
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/home/ssardina/git/soft/agents/MAC-AgtCity/2018-rmit/agtcity-sarl-base.git/target/agtcity-sarl-base-4.5.0.11.0-jar-with-dependencies.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Could not find a suitable constructor in io.sarl.sre.boot.commands.RunSingleAgentCommand. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
  at io.sarl.sre.boot.commands.RunSingleAgentCommand.class(RunSingleAgentCommand.java:60)
  at io.bootique.BQCoreModuleExtender.setDefaultCommand(BQCoreModuleExtender.java:95)

1 error
	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:470)
	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
	at com.google.inject.Guice.createInjector(Guice.java:99)
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at io.bootique.Bootique.createInjector(Bootique.java:472)
	at io.bootique.Bootique.createRuntime(Bootique.java:330)
	at io.sarl.sre.boot.SreMain.createRuntime(SreMain.java:232)
	at io.sarl.sre.boot.SreMain.ensureBootiqueRuntimeInstance(SreMain.java:238)
	at io.sarl.sre.boot.SreMain.runSRE(SreMain.java:253)
	at io.sarl.sre.boot.Boot.main(Boot.java:84)

System configuration: – SARL version: 0.11.0 – SARL compiler:

    • [] Eclipse compiler without Maven
    • Eclipse compiler with Maven
    • Maven compiler on the command line
    • sarlc compiler – Java JDK version (with the manufacturer name): – Operating System:
    • Linux 64bits
    • Windows 64bits
    • MacOS 64bits

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ssardinacommented, Feb 16, 2021

ahhh OK so I was a bit useful then 😉 ha!

Just tested and it works! I can run the system via Java.

1reaction
gallandarakhneorgcommented, Feb 15, 2021

No problem; I have added it a couple of days ago based on your issue report 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Instrument Java bytecode without agent - Stack Overflow
One way to circumvent this, is to use another process. All this process has to to, is to attach to your original process...
Read more >
Unable to start NR as java agent in spring boot application
I've edited my app startup script and added the line -javaagent:/path-to-NR.jar. But it seems NR does not want to start all all. No...
Read more >
Error in configuring javaagent in Spring Boot application
The agent is not getting started and the application is not getting detected by appdynamics. Can you please help resolve. Thanks.
Read more >
Java Instrumentation Agent's Boot-Class-Path is not visible
According to the documentation, If I have specified jars in Boot-Class-Path attribute in my agent MANIFEST.MF - it should locate the jars and...
Read more >
Package java.lang.instrument - Oracle Help Center
An agent provides an implementation of this interface in order to ... When the agent is started after VM startup the premain method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found