在 Eclipse 和 Java EE 代码中调试会话很痛苦,我希望有人有比我更好的方法。
这是 2 个 EJB 无状态 bean 方法(使用 TomEE 1.0)之间的典型调用堆栈:
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
ReflectionInvocationContext$BeanInvocation(ReflectionInvocationContext$Invocation).invoke() line: 181
ReflectionInvocationContext.proceed() line: 163
StatsInterceptor.record(InvocationContext, Method) line: 176
StatsInterceptor.invoke(InvocationContext) line: 95
GeneratedMethodAccessor35.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
ReflectionInvocationContext$InterceptorInvocation(ReflectionInvocationContext$Invocation).invoke() line: 181
ReflectionInvocationContext.proceed() line: 163
CdiInterceptor.invoke(InvocationContext) line: 129
CdiInterceptor.access$000(CdiInterceptor, InvocationContext) line: 45
CdiInterceptor$1.call() line: 66
CdiInterceptor.aroundInvoke(InvocationContext) line: 72
GeneratedMethodAccessor34.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
ReflectionInvocationContext$InterceptorInvocation(ReflectionInvocationContext$Invocation).invoke() line: 181
ReflectionInvocationContext.proceed() line: 163
InterceptorStack.invoke(Object...) line: 138
StatelessContainer._invoke(Method, Method, Object[], Instance, ThreadContext, InterfaceType) line: 226
StatelessContainer.invoke(Object, InterfaceType, Class, Method, Object[], Object) line: 178
StatelessEjbObjectHandler(EjbObjectProxyHandler).synchronizedBusinessMethod(Class<?>, Method, Object[], Object) line: 260
StatelessEjbObjectHandler(EjbObjectProxyHandler).businessMethod(Class<?>, Method, Object[], Object) line: 240
StatelessEjbObjectHandler(EjbObjectProxyHandler)._invoke(Object, Class, Method, Object[]) line: 91
StatelessEjbObjectHandler(BaseEjbProxyHandler).invoke(Object, Method, Object[]) line: 284
MyService$LocalBeanProxy.removeScheduledEvent(ScheduledEvent) line: not available
那是我不想检查的 30 行 Java EE 管道方法调用!
我在进入方法时跳过所有这些的唯一可靠方法是在下一个方法调用中放置一个断点,然后点击“Step Over”而不是“Step Into”。然而,与简单的“Step Into”相比,像这样一直设置断点是一个很大的麻烦。当我需要退出我正在检查的方法时,我必须重复同样的事情。
我知道 Eclipse 中的步骤过滤器并尝试使用这些过滤器,但是一些自动生成的代理类被注入到我自己的包中,所以我不能轻易使用它。
有人对此有很好的解决方案吗?
更新
使用以下步骤过滤器暂时跳过所有不需要的步骤:
*$$* // for CGLib proxies
*$LocalBeanProxy // for other EJB proxies
java.*
net.sf.*
sun.*
编辑 2
这是 MyService 类的一个示例:
public void removeScheduledEvent(ScheduledEvent event) {
// ...
otherEJB.doStuff(event);
}
由于 otherEJB 是在无状态容器中运行的 EJB bean,因此上面的 30 个调用是通过代理自动插入的。