2017-04-13 1 views
0
log.info(m.differenceValue(jsonElement1,jsonElement2)); 

beanshellからの呼び出し関数です。 jarファイルで実装されたコード。メソッド情報(java.util.HashMap)がクラス'org.apache.log.Logger 'に見つかりません

public static <K, V> Map<String,Object> differenceValue(JsonElement json1, JsonElement json2){ 
    Gson g = new Gson(); 

    Type mapType = new TypeToken<Map<String, Object>>(){}.getType(); 
    Map<String,Object> firstMap = g.fromJson(json1, mapType); 
    Map<String, Object> secondMap = g.fromJson(json2, mapType); 
    return(mapDifference(firstMap,secondMap)); 
}  
public static <K, V> Map<K, V> mapDifference(Map<? extends K, ? extends V> left, Map<? extends K, ? extends V> right) { 
    Map<K, V> difference = new HashMap<K, V>(); 
    difference.putAll(left); 
    difference.putAll(right); 
    difference.entrySet().removeAll(right.entrySet()); 
    return difference; 
} 

は日食で正常に動作しているですが、JMeterの中で、それはあなたが方法など、warn()、それはinfo()のための唯一の文字列を受け入れながらLogger地図に合格しようとしている

error:Method info(java.util.HashMap) not found in class'org.apache.log.Logger'

答えて

1

public String toString()

Returns a string representation of this map. The string representation consists of a list of key-value mappings in the order returned by the map's entrySet view's iterator, enclosed in braces ("{}"). Adjacent mappings are separated by the characters ", " (comma and space). Each key-value mapping is rendered as the key followed by an equals sign ("=") followed by the associated value. Keys and values are converted to strings as by String.valueOf(Object).

+0

こんにちはゆり(あなたは、キーが&値のために持っているものに依存する)HashMapのために働くかもしれない、マニュアルに従って共有ソリューションのおかげでlog.info(m.differenceValue(jsonElement1,jsonElement2).toString());

を試してみてください。今すぐデータを印刷しています – sindhu

+0

No prob。あなたがそれが問題を解決すると思うなら、答えを受け入れてください。 :-) –

1

を投げています何らかの理由でMapをStringにキャストする必要があります。

また、私はBeanshellでジェネリックスをサポートしているとは思わないので、代わりにJSR223 Elements and Groovy languageに切り替えることを検討してください。

関連する問題