getappmap / appmap-java

AppMap client agent for Java
Other
82 stars 16 forks source link

java.lang.InternalError: java.lang.ClassNotFoundException: org.apache.http.client.utils.URIBuilder #260

Closed saisumit closed 9 months ago

saisumit commented 9 months ago
I am trying to remotely run app-map on an ECS machine in a dockerized environment. I am getting this error : ` February 11, 2024 at 15:11 (UTC+5:30) java.lang.InternalError: java.lang.ClassNotFoundException: org.apache.http.client.utils.URIBuilder cerebro-development
February 11, 2024 at 15:11 (UTC+5:30) at com.appland.appmap.process.hooks.http.HttpClientRequest.newBuilder(HttpClientRequest.java:92) cerebro-development
February 11, 2024 at 15:11 (UTC+5:30) at com.appland.appmap.process.hooks.http.HttpClientRequest.execute(HttpClientRequest.java:43) cerebro-development
February 11, 2024 at 15:11 (UTC+5:30) at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java)

`

Here is the docker file:

FROM maven:3.8.4-amazoncorretto-17 AS build
COPY pom.xml /usr/src/cerebro/pom.xml

COPY cerebro-authentication /usr/src/cerebro/cerebro-authentication
COPY cerebro-chain /usr/src/cerebro/cerebro-chain
COPY cerebro-clients /usr/src/cerebro/cerebro-clients
COPY cerebro-common /usr/src/cerebro/cerebro-common
COPY cerebro-core /usr/src/cerebro/cerebro-core
COPY cerebro-data /usr/src/cerebro/cerebro-data
COPY cerebro-entities /usr/src/cerebro/cerebro-entities
COPY cerebro-ethereum /usr/src/cerebro/cerebro-ethereum
COPY cerebro-main /usr/src/cerebro/cerebro-main
COPY cerebro-transaction /usr/src/cerebro/cerebro-transaction
COPY cerebro-users /usr/src/cerebro/cerebro-users
COPY cerebro-proto /usr/src/cerebro/cerebro-proto
COPY cerebro-rulengine /usr/src/cerebro/cerebro-rulengine

RUN mkdir -p /usr/src/appmap

RUN mvn  -f /usr/src/cerebro/pom.xml -e clean install -U
RUN mvn dependency:get -Dartifact=com.appland:appmap-agent:1.25.3 -Ddest=/usr/src/appmap/appmap-agent-1.25.3.jar

FROM amazoncorretto:17.0.1-alpine3.14
USER root
COPY --from=build /usr/src/cerebro/cerebro-main/target/cerebro-main.jar /cerebro-main/cerebro-main.jar
COPY --from=build /usr/src/appmap/appmap-agent-1.25.3.jar /appmap/appmap-agent-1.25.3.jar

RUN chmod 644 /cerebro-main/cerebro-main.jar
RUN chmod 644 /appmap/appmap-agent-1.25.3.jar

EXPOSE 8080
ENTRYPOINT ["java", "-javaagent:/appmap/appmap-agent-1.25.3.jar", "-jar","/cerebro-main/cerebro-main.jar"]
saisumit commented 9 months ago

Tried installing : https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.5.13 in the root pom but to no avail.

apotterri commented 9 months ago

Hi @saisumit. Thanks for your interest in AppMap!

Can you upgrade to v1.26.3 of the agent, please? It will generate a log file named appmap*.log, which may help to determine what's going wrong.

You can join us on Slack and DM me (@Alan Potter) the file, or you can email it to me.

saisumit commented 9 months ago

Further debugged it, it's coming whenever i am setting the spring profile SPRING_PROFILES_ACTIVE=development java -javaagent:/Users/saisumit/Desktop/appmap/appmap-agent-1.26.3.jar -jar cerebro-main/target/cerebro-main.jar OR java -Dspring.profiles.active=development -javaagent:/Users/saisumit/Desktop/appmap/appmap-agent-1.26.3.jar -jar cerebro-main/target/cerebro-main.ja

The spring profile tries to load a URL corresponding to a secret-manager AWS application.yml Here is the appmap log


17:30:52.848 [main] INFO Agent.premain: To disable the automatic creation of this log file, set the system property appmap.disableLogFile to 'true'
17:30:52.849 [main] INFO Agent.premain: Agent version 1.26.3, current time mills: 1707739252342
17:30:52.850 [main] INFO Agent.premain: config: {
    "configFile":"appmap.yml",
    "name":"cerebro",
    "packages":[{
        "allMethods":true,
        "exclude":[],
        "path":"com.cerebro.proto",
        "shallow":false
    },{
        "allMethods":true,
        "exclude":[],
        "path":"com.coinbrix.cerebro.ces",
        "shallow":false
    },{
        "allMethods":true,
        "exclude":[],
        "path":"db.changelog",
        "shallow":false
    },{
        "allMethods":true,
        "exclude":[],
        "path":"db.changes",
        "shallow":false
    },{
        "allMethods":true,
        "exclude":[],
        "path":"db.queries",
        "shallow":false
    }]
}
17:30:52.996 [main] INFO Agent.premain: System properties: {java.specification.version=17, sun.jnu.encoding=UTF-8, java.class.path=cerebro-main/target/cerebro-main.jar, java.vm.vendor=Amazon.com Inc., sun.arch.data.model=64, java.vendor.url=https://aws.amazon.com/corretto/, user.timezone=Asia/Kolkata, java.vm.specification.version=17, os.name=Mac OS X, sun.java.launcher=SUN_STANDARD, user.country=IN, sun.boot.library.path=/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home/lib, sun.java.command=cerebro-main/target/cerebro-main.jar, http.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, jdk.debug=release, sun.cpu.endian=little, user.home=/Users/saisumit, user.language=en, sun.stderr.encoding=US-ASCII, java.specification.vendor=Oracle Corporation, java.version.date=2022-01-18, java.home=/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home, file.separator=/, java.vm.compressedOopsMode=Zero based, line.separator=
, sun.stdout.encoding=US-ASCII, java.vm.specification.vendor=Oracle Corporation, java.specification.name=Java Platform API Specification, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, ftp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16, java.runtime.version=17.0.2+8-LTS, user.name=saisumit, path.separator=:, os.version=14.0, java.runtime.name=OpenJDK Runtime Environment, file.encoding=US-ASCII, java.vm.name=OpenJDK 64-Bit Server VM, java.vendor.version=Corretto-17.0.2.8.1, java.vendor.url.bug=https://github.com/corretto/corretto-17/issues/, java.io.tmpdir=/var/folders/3v/ff30yns947s5njcbbcjk8slh0000gn/T/, java.version=17.0.2, user.dir=/Users/saisumit/Desktop/Coinbrix/cerebro, os.arch=x86_64, java.vm.specification.name=Java Virtual Machine Specification, native.encoding=US-ASCII, java.library.path=/Users/saisumit/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:., java.vm.info=mixed mode, sharing, java.vendor=Amazon.com Inc., java.vm.version=17.0.2+8-LTS, sun.io.unicode.encoding=UnicodeBig, socksNonProxyHosts=local|*.local|169.254/16|*.169.254/16, java.class.version=61.0}
17:31:10.572 [main] ERROR HttpClientRequest.newBuilder: failed creating a URIBuilder: java.lang.ClassNotFoundException: org.apache.http.client.utils.URIBuilder
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:375)
    at com.appland.appmap.process.hooks.http.HttpClientRequest.newBuilder(HttpClientRequest.java:83)
    at com.appland.appmap.process.hooks.http.HttpClientRequest.execute(HttpClientRequest.java:43)
    at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1346)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1157)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:814)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:781)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:755)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:715)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:697)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:561)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:541)
    at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.doInvoke(AWSSecretsManagerClient.java:2756)
    at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.invoke(AWSSecretsManagerClient.java:2723)
    at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.invoke(AWSSecretsManagerClient.java:2712)
    at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.executeGetSecretValue(AWSSecretsManagerClient.java:1230)
    at com.amazonaws.services.secretsmanager.AWSSecretsManagerClient.getSecretValue(AWSSecretsManagerClient.java:1199)
    at io.awspring.cloud.secretsmanager.AwsSecretsManagerPropertySource.readSecretValue(AwsSecretsManagerPropertySource.java:76)
    at io.awspring.cloud.secretsmanager.AwsSecretsManagerPropertySource.init(AwsSecretsManagerPropertySource.java:60)
    at io.awspring.cloud.secretsmanager.AwsSecretsManagerPropertySources.createPropertySource(AwsSecretsManagerPropertySources.java:81)
    at io.awspring.cloud.autoconfigure.secretsmanager.AwsSecretsManagerConfigDataLoader.load(AwsSecretsManagerConfigDataLoader.java:43)
    at io.awspring.cloud.autoconfigure.secretsmanager.AwsSecretsManagerConfigDataLoader.load(AwsSecretsManagerConfigDataLoader.java:36)
    at org.springframework.boot.context.config.ConfigDataLoaders.load(ConfigDataLoaders.java:107)
    at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:128)
    at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:86)
    at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:121)
    at org.springframework.boot.context.config.ConfigDataEnvironment.processWithProfiles(ConfigDataEnvironment.java:311)
    at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:232)
    at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102)
    at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94)
    at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102)
    at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
    at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
    at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:374)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:332)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
    at com.coinbrix.cerebro.ces.Application.main(Application.java:34)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91)
    at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
    at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)
17:31:11.100 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: +++ method call +++
17:31:11.101 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: classes examined: 4175
17:31:11.102 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: classes ignored: 2761
17:31:11.104 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: methods examined: 29837
17:31:11.104 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: methods instrumented: 33
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: === method call ===
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: +++ system hook +++
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: classes examined: 3182
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: classes ignored: 2655
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: methods examined: 28860
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: methods instrumented: 18
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: === system hook ===
17:31:11.107 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: +++ proxy hooks +++
17:31:11.108 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: classes examined: 0
17:31:11.109 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: classes ignored: 0
17:31:11.109 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: methods examined: 0
17:31:11.109 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: methods instrumented: 0
17:31:11.109 [Thread-5] INFO ClassFileTransformer.lambda$logStatistics$14: === proxy hooks ===
saisumit commented 9 months ago

Seems like while loading the url of the spring profile, it's trying to use the dependency of the java agent which doesn't have the dependency and thus gives the error, can you release a version with the dependency installed?

appland-release commented 9 months ago

:tada: This issue has been resolved in version 1.26.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: