Questions tagged [javaagents]

A Java agent allows for the instrumentation of a Java application by using another Java program that is specified on the command line.

Filter by
Sorted by
Tagged with
0 votes
2 answers
32 views

Can't use static variable in @Advice.OnMethodEnter method in opentelemetry javaagent extension

I'm trying to create an extension for opentelemetry javaagent. I need some static variables outside the methods to handle spans. But I get the error java.lang.ClassNotFoundException for a class where ...
  • 2,460
3 votes
1 answer
76 views

How to use Java agent with native compiled spring boot application

Together with our SpringBoot (3.0.3) application we are using Application Insights (Azure) for monitoring. Currently we are trying to compile the application natively with the GraalVM. That works ...
0 votes
0 answers
12 views

Log4j appender vs Agent for exporting logs for Analytics

I am want to export specific application logs from servers to cloud (publish to SNS) and have our analytics consumers to ingest them down the stream. Since the service which produces the application ...
1 vote
2 answers
38 views

Error: can not find or load main class com.briar.Agent

My project structure is as follows: ---Detail-RASP---src My maven pom file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0&...
0 votes
2 answers
116 views

NoClassDefFoundError when trying to use opentelemetry Instrumenter in javaagent extension

I want to implement extension to manage methods tracing. I've implemented TypeInstrumentation class to around and utilite class for instrumenter() as described opentelemetry instrumentation module: ...
  • 2,460
0 votes
0 answers
57 views

Maven example to add extended agent

I m writing my own extension with maven and I wanted to embed the extension and create a single jar. I saw an example in https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/...
  • 1
0 votes
0 answers
49 views

OpenTelemetry Java agent extension to add Spring authenticated User id in Span attributes

I have a Spring Boot 2.7.5 application running with an opentelemetry-javaagent.jar that includes some custom extensions. I now want to add a custom SpanProcessor that adds an attribute userId to all ...
  • 78
0 votes
1 answer
43 views

Akka http request does not trace through opentelemetry

I am trying to use opentelemtry (OTEL) in akka-http application (Scala), using the stand alone agent. In my sbt I have this: fork := true run / javaOptions ++= Seq( "-XX:+UseG1GC", &...
0 votes
0 answers
27 views

Why would retransformClasses fail silently?

I'm trying to retransform classes with java instrumentation. The code below runs just fine, it prints Hello World!!. public class Main { public static void main(String[] args) throws Throwable { ...
0 votes
1 answer
51 views

attach failed with error: java.io.IOException: Premature EOF

while I try to attach a process with code like: vm = VirtualMachine.attach(pid); vm.loadAgent(attachJarPath, properties); I got this error: java.io.IOException: Premature EOF at sun.tools.attach....
  • 1
0 votes
1 answer
27 views

How can I check that my application is shutdown with QFTest?

I check a Java application with QFTest. I need to prove that the HMI is stopped at Shutdown. In QFTest, I created a Jython procédure which try to send a socket to the HMI, if it can't, then it means ...
  • 541
0 votes
0 answers
43 views

ClassNotFoundException while calling a class in main application from java agent extension

I am running a spring boot application, which has a dependency in pom.xml (i.e., client-library) A java agent extension is running parallelly with spring boot application. I am trying to call a class ...
1 vote
1 answer
145 views

Trying to implement interface and override java.lang.String with Byte Buddy

I tried with this example especially designed for ignored by byte-buddy. I solved errors, and it looks like working with this code. new AgentBuilder.Default() .with(new AgentBuilder....
0 votes
1 answer
66 views

TraceId is lost in graphql GraphQLAsyncExceptionHandler onException logs

I have the graphql fetcher as below: import com.fasterxml.jackson.databind.ObjectMapper; import com.newrelic.api.agent.NewRelic; import com.newrelic.api.agent.Token; import com.newrelic.api.agent....
  • 3,618
0 votes
0 answers
41 views

Junit test cases give InvocationTargetException with Java11 on graviton machines

I have been facing very weird issue where my unit test cases fail on arm graviton aws machines. The same unit test cases pass on intel machines with Java8 I am getting the below errors: Exception in ...
  • 4,271
0 votes
0 answers
33 views

Javassist ClassPool instantiation fails silently

I'm currently trying to write a Java agent for monitoring purposes. I use maven as build system. I have a Agent.java file: import java.lang.instrument.Instrumentation; public class Agent { ...
0 votes
0 answers
104 views

Java Agent "java.lang.UnsupportedOperationException: class redefinition failed: attempted to change method modifiers"

I am trying to change the method access modifier through an agent via javassist, however, I get an error. So, is it possible to change the access modifier via java agent and how to fix it? Is there ...
0 votes
1 answer
40 views

Rename jar and it's classes

I want to run multiple jacoco javaagents on the same target with tcp ports. This causes an issue due to a naming conflict. My thought is to rename the jacoco_agent.jar to jacoco2_agent.jar including ...
0 votes
0 answers
91 views

Can we configure jib-maven-plugin to download a jar from maven to docker root folder

I am using jib-maven-plugin to build docker image of a maven spring boot application. I want to attach an agent jar to docker entry point run command. I am using the below configuration to attach the ...
0 votes
0 answers
34 views

Invoking Application Insights dynamically in Java application

We have a Java application that is hosted by another party that pulls code from our repository, compiles and packages the code and hosts it. We would like to use Application Insights here and it works ...
1 vote
1 answer
76 views

How do I reference a runtime Maven dependency in the the java CLI?

I need to add an instrumentation JAR to my Java command line. If possible, I want to this argument to reference a JAR included in my Maven dependencies. As an example: java -javaagent:tooling.jar -jar ...
0 votes
1 answer
47 views

How to reset instrumented classes in Javaagent

I'm using java instrumentation API to change the byte code of few classes. How can I deinstrument those classes at runtime?
  • 57
-1 votes
1 answer
43 views

NewRelic configuration in Mendix private cloud

Can anyone provide the location of m2ee.yaml file for configuring Newrelic in mendix private cloud. Ref URL: https://docs.mendix.com/developerportal/deploy/setting-up-monitoring-with-new-relic/
0 votes
1 answer
108 views

Bytebuddy Java Agent: AgentBuilder affects control flow of a second, unrelated AgentBuilder

So I am implementing a Java Agent that installs multiple AgentBuilder, one of them only if an environment variable was defined correctly. The problem I face is that the behavior of a second ...
  • 136
1 vote
1 answer
78 views

Bytebuddy: How to inject class that can be read by java.net.http.HttpClient#sendAsync

I'm trying to time time it takes for the CompletableFuture that is being returned by java.net.http.HttpClient#sendAsync // premain public static void premain(String arguments, Instrumentation ...
  • 35
2 votes
1 answer
160 views

Bytebuddy: Method not being called in agent

I'm creating an agent and using bytebuddy. I'd like to measure the time it takes to execute the java.net.http.HttpClient's send method. // premain public static void premain(String arguments, ...
  • 35
0 votes
2 answers
912 views

How to exclude urls(health check traces) in opentelemetry

I am trying to integrate opentelemetry in spring boot with Automatic instrumentation, it's generating health check urls. How to exclude specific urls in opentelemetry
  • 21
0 votes
1 answer
51 views

How to instrument java methods and register callbacks implemented in java agent

I am writing a java agent to instrument user annotated methods. Currently, with javassist, I can identify the annotated methods and insert logging information. However, I am wondering how I can ...
  • 326
2 votes
1 answer
216 views

How to add okhttp custom interceptor at runtime using bytebuddy?

I want to add my interceptor at runtime in okhttpclient, I am making Agent using bytebuddy in premain class. And i am trying to intercept the constructor of "okhttp3.OkHttpClient.Builder" to ...
0 votes
0 answers
75 views

Instrumenting a spring bean class with bytebuddy

I'm looking to instrument a Spring bean class(a class annotated with @RestController for example),then making sure that the instrumented version of that class is used to create the application context....
0 votes
1 answer
55 views

Get jar manifest attributes from Java agent

I am running my own java agent on a jar containing some sample code. Input to the command line: java -javaagent:path/to/agent.jar=path/to/main-class -jar path/to/sample-code.jar I'm currently ...
1 vote
1 answer
141 views

ConcurrentHashMap of <String, ConcurrentLinkedQueue> pairs not consistently registering additions

Background I have a program, which by use of a Java agent and ASM, adds to a static ConcurrentHashMap containing ConcurrentLinkedQueues of Object arrays (termed as ThreadMarkers in the below snippets)....
0 votes
1 answer
227 views

Failed to find Agent-Class manifest attribute

whenever I try to attach an agent to the JVM I get this error: Failed to find Agent-Class manifest attribute from /Users/yanjobs/Downloads/Dumper-master-2/out/artifacts/Dumper_master_2_jar/Dumper-...
0 votes
1 answer
2k views

How to configure OTEL collector with Spring app using micrometer library and java instrumentation agent to get metrics

Issue Otel collector instrumentation agent does not forward prometheus metrics from Spring app correctly Local reproduction steps Simple java springboot app with gradle dependencies { ...
2 votes
0 answers
263 views

How to save method name and class name in database using javassist?

InterceptingClassTransformer class I want to save method name and class name in database at runtime. I want to save method name and class name. I don't know how to insert data into database. I want ...
3 votes
1 answer
455 views

Manage javaagent dependencies in a Java project built with Gradle

For systems that require a javaagent (say, OpenTelemetry) the docs often start with "download the agent JAR from this URL and add it to your command line". In a world where library ...
  • 919
1 vote
0 answers
120 views

Instrument native method in java 13+

I want to instrument native method in java 13+ (preferably using javassist). Say I want to add logging for particular method and then call real native method. It was possible before via native method ...
  • 514
0 votes
0 answers
357 views

How to instrument a spring boot application using java agent and javassist?

I have a spring boot project. I want to instrument this application using java agent and javassist library. I have created a maven project for java agent with Premain(String args, Instrumentation inst)...
2 votes
2 answers
263 views

ASM & Javaagent bytecode instrumentation: ClassFormatError: StackMapTable format error: bad offset for Uninitialized

What am I doing I am using ASM and javaagent to instrument classes to report their coverage (why am I not using jacoco? Well it is nothing to do with this question), the basic logic is that, every ...
  • 1,986
0 votes
0 answers
57 views

Byteman script failed to refer to a class on Tomcat from a Java agent

Background Now I am trying to make the MBean SessionMonitor (the MBean to measure the size of HttpSession) into a Java agent for portability. The Eclipse project is: https://github.com/satob/...
  • 1,465
0 votes
1 answer
93 views

How can I implement configurable java agent in runtime

In a static java agent, we predefine the intercepted class and methods and related advice, the code may look like follows, which means when enter and exit class1.method1(), code in MyAdvice will be ...
1 vote
2 answers
197 views

Why am i getting AgentLoadException?

Its my first time using agents, i went to task manager and picked the pid of my minecraft, when i do > jvm.attach(myAgent); i get AgentLoadException. loader: File agentFile = new File("src/...
  • 23
0 votes
0 answers
203 views

OpenTelemetry Muzzle matcher warn; instrumentation skipped in OSGi container

For a project I'm doing I'm trying to run OpenTelemetry (OTEL) in an OSGi-container. Hereby the situation: I have a simple Maven/Java-application in which includes the @WithSpan-annotations via the ...
-1 votes
1 answer
41 views

Perfino agent failed to start on linux machine

I tried to start perfino agent on linux machine using various ways. I also followed recommended instruction from perfino more times. It still failing. Please help me. Please see below error. [root@...
0 votes
1 answer
269 views

Class Retransformation with Bytebuddy Agent

I am writing a Java agent with ByteBuddy API. Therefore, I want to get in touch with the method delegation of classes that are alredy loaded using the retransformation capabilities of the Bytebuddy ...
3 votes
1 answer
1k views

java module access issue: "Class in a module cannot access class in unnamed module because module x does not read unnamed module y"

My source code compiles on java 7 and runs on java 11. I am trying to integrate imperva RASP as a java agent in tomcat. However, when I start the tomcat server, it is throwing following exception: ...
1 vote
0 answers
213 views

`java.lang.NoClassDefFoundError` from javaagent built by `maven package`

I've been trying to build javaagent (containing premain()) to .jar file using maven mvn package, and keep getting java.lang.NoClassDefFoundError exception related to external dependencies. For details,...
  • 11
0 votes
0 answers
35 views

Tracking down jMonitor

I found a paper describing jMonitor (runtime event specification and monitoring library). I cannot seem to get my hands on the actual tool itself though. Does anyone know anything about it? I found a ...
0 votes
0 answers
88 views

Getting field offset in java object using ASM agent

I am interested in writing an ASM Java agent to monitor the offset of the object fields. Currently, I can use Google's AllocationInstrumenter (https://github.com/google/allocation-instrumenter) to get ...
  • 326
0 votes
2 answers
423 views

Java agent OTel not working with New Relic

I have a Java application running with an OTel agent to collect telemetries and send them to the New Relic platform. Configuration of OTel Java agent: -javaagent:./agents/opentelemetry-javaagent-all....

1
2 3 4 5
11