Debugging sessions in Eclipse and Java EE code are a pain and I'm hoping someone has a better method than mine.
Here is a typical call stack between 2 EJB stateless bean methods (using 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
That's 30 lines of Java EE plumbing method calls that I don't want to inspect!
My only reliable way to skip all this when stepping into a method is to put a breakpoint in the next method call, then hit "Step Over" instead of "Step Into". However, setting breakpoints all the time like that is a major hassle compared to a simple "Step Into". I have to repeat the same thing when I need to step out of the method I'm inspecting.
I know about step filters in Eclipse and tried using those but some automatically-generated proxy classes are injected in my own packages so I can't easily use that.
Does anybody have a good solution for this?
update
Using the following step filters skips all unwanted steps for now :
*$$* // for CGLib proxies
*$LocalBeanProxy // for other EJB proxies
java.*
net.sf.*
sun.*
edit 2
Here's an example from the MyService class:
public void removeScheduledEvent(ScheduledEvent event) {
// ...
otherEJB.doStuff(event);
}
Since otherEJB is an EJB bean running in a stateless container, the 30 calls above are inserted automatically via proxies.