1

我正在做一个 SUP MBO 项目。我正在尝试使用结果集过滤器来自定义我的 MBO。在那个类中,我需要 http 获取一些东西并根据反馈自定义 MBO 行。我使用 SUP2.1.2 的 MobileSDK 并尝试预览结果集。我启用了调试,可以看到控制台的输出。

更改后的结果集过滤器代码片段如下所示:

@覆盖

公共 ResultSet 过滤器(ResultSet in,Map arg1)

    throws Exception {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("www.google.com");
HttpResponse response1 = httpclient.execute(httpGet);
httpGet.releaseConnection();
return in;

}

每次调用 httpclient.execute(httpGet) 时,都会抛出一个异常,如下所示:

00:06:42 [ERROR] [ExecuteSection]:执行错误

java.lang.reflect.InvocationTargetException

at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at com.sybase.uep.tooling.ui.dialogs.preview.ExecuteSection.execute(ExecuteSection.java:227)
...

原因:java.lang.VerifyError:无法从最终类继承

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
...
at com.sybase.uep.tooling.ui.dialogs.preview.ExecuteSection$4.run(ExecuteSection.java:207)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

我尝试了不同的 httpclient jar 版本(包括 3.0.1、4.2),但总是失败。

有没有人有任何提示?谢谢。

4

1 回答 1

0

从这里得到解决方案


你好,

通常,当 java 编译器在 2 个不同的包中发现 2 个具有相同名称的不同类时,会发生“java.lang.reflect.InvocationTargetException”。当您一次导入两个类并且尝试创建该类的对象时,它会抛出“java.lang.reflect.InvocationTargetException”异常。

解决方案是,当您创建类的对象时,还要使用包名和类名,以便编译器知道它必须使用哪个类。

于 2012-10-31T04:40:55.037 回答