这是 JMX bean 调用(失败):
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.ws.rs.core.Response;
MBeanServerConnection mbeanConn
//some code going on ...
...
response = (Response) mbeanConn.invoke(myBean,"example", null, null);
它抛出异常:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.cxf.jaxrs.impl.ResponseIm
在查看我的代码时,调用的函数是:
import javax.ws.rs.core.Response;
@ManagedOperation
public Response example() throws GeneralException {
//do some things with the response object
...
return response.build();
}
据我了解,我有一个抽象类 javax.ws.rs.core.Response 没有序列化的问题。
任何想法如何绕过这个问题?