private void checkSessionSynchronization(final Class ejbClass, final SessionBean bean) { if (SessionSynchronization.class.isAssignableFrom(ejbClass)) { if (bean.getAfterBeginMethod() != null || bean.getBeforeCompletionMethod() != null || bean.getAfterCompletionMethod() != null) { fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName()); } else { final ClassFinder classFinder = new ClassFinder(ejbClass); if (classFinder.findAnnotatedMethods(AfterBegin.class).size() > 0 || classFinder.findAnnotatedMethods(BeforeCompletion.class).size() > 0 || classFinder.findAnnotatedMethods(AfterCompletion.class).size() > 0) { fail(bean, "callback.sessionSynchronization.invalidUse", ejbClass.getName()); } } } }