getappmap / appmap-java

AppMap client agent for Java
Other
81 stars 15 forks source link

Crash trying to get the URL for an http_client_request #177

Closed apotterri closed 1 year ago

apotterri commented 1 year ago

Details starting here.

Looks like implementing the other overloads for the execute should resolve this.

apotterri commented 1 year ago

@tokazio I should have a fix for this later today or tomorrow, though I'm not sure whether it's complete enough.

Would you be willing to try it out and see whether it works for you?

Thanks!

tokazio commented 1 year ago

Yes i Can try tomorrow, how Can i try ?

apotterri commented 1 year ago

I'll attach a jar here as soon as I can.

tokazio commented 1 year ago

Ok nice, thanks

apotterri commented 1 year ago

Ok, here's a new version of the agent: appmap-1.17.2-SNAPSHOT.jar.zip

I believe it should resolve the crash you found. It's possible, however, that it won't completely capture responses from an external service. Can you give it a try, and see how it works for you?

tokazio commented 1 year ago

OK no error anymore, good job. The request is handled as usual. Thanks!

I'm running the 'service' from Intellij with the agent. I'm recording the local service url (http://localhost:8110) from Intellij. I'm calling a rest endpoint from postman. I'm stopping the recording to see the appmap. I only see the http call, no more details on the java methods used.

Capture d’écran 2023-05-05 à 17 24 19

It's working but i doesn't understand how to proceed to view all methods from the java code used for this call...

tokazio commented 1 year ago

oh sorry, i've missed this error at start:

2023-05-05 16:42:03.736  WARN [prometheus,,] 47170 --- [           main] org.jboss.resteasy.resteasy_jaxrs.i18n   : RESTEASY002120: ClassNotFoundException: Unable to load builtin provider com.alibaba.fastjson.support.jaxrs.FastJsonProvider from jar:file:/Users/romain/appmap-agent-1.17.2.jar!/META-INF/services/javax.ws.rs.ext.Providers

java.lang.ClassNotFoundException: com.alibaba.fastjson.support.jaxrs.FastJsonProvider
    at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:72)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)
    at org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:119)
    at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:45)
    at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.getProviderFactory(ResteasyClientBuilder.java:398)
    at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.register(ResteasyClientBuilder.java:491)
    at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.register(ResteasyClientBuilder.java:40)

adding implementation 'com.alibaba:fastjson:2.0.28' to my gradle file resolved the problem.

but it's not a good thing that i need to do so.

apotterri commented 1 year ago

Ok, thanks, seems like we're making progress!

As far as getting better AppMaps, can you share the appmap.yml from your project, please?

And, as far as that ClassNotFoundException, can you provide the complete commandline that's getting used to start the service? fastjson should be getting embedded in the appmap jar file, and the dependency on it shouldn't be leaking out....

tokazio commented 1 year ago
name: xxx-service
packages:
  - path: io.group

Something like this (at the build.gradle level)

I'm in a multi module gradle project

tokazio commented 1 year ago

my VM options

-javaagent:/Users/bidule/appmap-agent-1.17.2.jar
-Dappmap.record.privat=true
-Dappmap.recording.auto=true
-Dappmap.output.directory=/Users/romain/appmap-record
apotterri commented 1 year ago

So, your application classes are in the package io.group, correct?

For the command line, what's the classpath getting set to? Does it include appmap-agent-1.17.2.jar. If so, does the error still happen if you remove it? (It shouldn't be necessary for it to be on the classpath.)

tokazio commented 1 year ago

removing implementation 'com.alibaba:fastjson:2.0.28' i've got the error but it seems to not prevent the recording, that's ok

yes they're in some sub packages from io.group like io.group.service.xxx

i see the agent and config in the launching command line of intellij, i see a second -javaagent with the ij one appmap-agent-1.17.2.jar only as a -javaagent, not in -classpath

oO i've got the whole data in my last try... lol i don't know what i've changed...

nice ^^

apotterri commented 1 year ago

Oh, hey, FWIW, I noticed a typo here, too: -Dappmap.record.privat=true should be -Dappmap.record.private=true.

tokazio commented 1 year ago

Yes, i've corrected that.

I've got some appmap for my services!

Thanks for your quick fix!

I've drag and drop some in intellij but after 3 or 4 it has stop working and showing me the json insteadof the diagram.

I've restarted intellij but nothing works.

I haven't found another way to open the files.

apotterri commented 1 year ago

Excellent, thanks very for trying out the fix. I'll get it released as soon as possible.

@ghamelin Seems like there's an IntelliJ issue here, too. Can you weigh in, please?

ghamelin commented 1 year ago

I will dig into it and see what I can find I haven't encountered this issue but I'd be happy to look into it.

brikelly commented 1 year ago

@tokazio one thing you could try (temporarily) is to try to open those maps in VS Code (after installing the AppMap extension there too).

tokazio commented 1 year ago

Yes, i'll tryit soon. Maybe i Can grab a log Somewhere for this opening issue ?

ghamelin commented 1 year ago

I experienced a similar issue I have submitted a ticket for getting it fixed.

apotterri commented 1 year ago

Issue for drag-and-drop in IntelliJ extension is here: https://github.com/getappmap/appmap-intellij-plugin/issues/259 .

appland-release commented 1 year ago

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

The release is available on:

Your semantic-release bot :package::rocket: