我希望看到已在ActiveMQ队列中排队的消息内容.我打开了web-console.(http:// localhost:8161/admin/queues.jsp)并点击了队列消息的message-id.它在"消息详细信息"窗口中给出了以下错误,而不是给出消息内容.
"javax.jms.JMSException:无法从内容构建正文.可序列化的类不可用于代理.原因:java.lang.ClassNotFoundException:"
这个异常的原因是什么?我需要做些什么来摆脱这个?
我想将 json 字符串反序列化为具有重载字段设置器的对象。我不想用 @JsonIgnore 显式注释其中一个 setter。为什么 Jackson 库不能根据在 json 字符串中获取的值的类型使用适当的 setter?以下是代码:
public class A {
Set<Integer> set = new HashSet<Integer>();
public Set<Integer> getSet() {
return set;
}
public void setSet(Set<Integer> set) {
this.set = set;
}
public void setSet(String str)
{
this.set = null;
}
}
=========================
String input = "{\"set\":[1,4,6]}";
A b = mapper.readValue(input, A.class);
System.out.println(b.getSet());
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Exception in thread "main" com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token
at [Source: (String)"{"set":[1,4,6]}"; line: 1, column: 8] (through …Run Code Online (Sandbox Code Playgroud) "java.lang.OutOfMemoryError: Java heap space"运行以下代码片段时出现异常.我8192M用命令设置了JVM堆大小set JVM_ARGS="-Xms8192m -Xmx8192m".
List<Integer> largeList = new ArrayList<>();
Random rand = new Random();
for(int i=0;i<Integer.MAX_VALUE/2;i++)
{
largeList.add(rand.nextInt(Integer.MAX_VALUE));
}
Run Code Online (Sandbox Code Playgroud)
我认为JVM堆积,我设置,足以容纳数组.