問題タブ [btrace]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
btrace - btrace で、バイト配列を読み取り可能な形式で出力するにはどうすればよいですか?
アノテーションbtrace
を使用してメソッド戻り値の byte[] 値を検査するために使用したい。@Return
バイト配列は、実際には utf8 を使用してエンコードされた通常の文字列です。
クラスは以下のようなものです。
試してみprintArray
ましたが、Objetc[] のタイプのみを受け入れ、byte[] のタイプでは機能しません。の場合print
、'[B@4fbc7b65' のような内部オブジェクト ID を出力するだけです。
問題を解決できる他の方法はありますか?
java - 指定されたメソッドが呼び出されたときに、btrace は何も出力しませんでした
btrace の使い方を学んでいます。そのために、次のコードを含む spring-boot プロジェクトを作成しました。
次に、 を使用してプロジェクトを開始し、mvn spring-boot:run
その後、次のように btrace スクリプトを作成しました。
ご覧のとおり、このスクリプトはjava.io.File#createNewFile
が呼び出されたときに何かを出力する必要があります。これはまさに上記のコントローラーが行うことです。次に、次のコードを使用して、実行中の spring-boot プロジェクトに btrace をアタッチしました。
30716 は、実行中の spring-boot プロジェクトの PID です。次に、にアクセスしてみhttp://localhost:8080/testFile
ました。実行中の spring-boot プロジェクトから、次のような追加の出力が得られました。
が出力されることを期待していましたNew file is being created
が、そうではありませんでした。なんで?私は何か間違ったことをしましたか?
java - I got an error("Handler dispatch failed; nested exception is java.lang.NoSuchFieldError: runtime") when I tried to trace a spring project using btrace
As I mentioned in the title,I tried to using btrace to trace the execution of a restful api and got this error:"Handler dispatch failed; nested exception is java.lang.NoSuchFieldError: runtime"
when I invoked the restful api.And before I start the btrace process,this restful api works well,once I start the btrace process,this restful api keeps throwing the error everytime ths api is called.
some information:
Restful API(java code):
btrace test class code:
I wonder if this has something to do with the btrace version? Hope someone can save me,THANKS!