Spring + EJB 3.1 CMT vs BMT transactions

We have a simple stateless EJB timer that gets an instance of a spring service injected into it. The spring service has a method marked as transactional. When the EJB uses Transaction Management Type CONTAINER the spring service call results in an IllegalStateException: Operation not allowed. So we set the EJB Transaction Management Type to be BEAN and everything works as advertised. Is this normal? I was under the impression that the spring transaction management would join the CMT.

example EJB

public class TimerService {
    IHelloService helloService;

    @Schedule(second="*/1", minute="*",hour="*", persistent=false)
    public void doWork(){

example spring service

public class HelloService implements IHelloService {
    public void hello(){



Probably the problem can be fixed, if you would define propagation level for Spring transaction as SUPPORTS (default is REQUIRED). I do not remember exact value for default settings in EJB, but it seems like EJB method is not starting transaction (propagation is DEFAULT), but ‘hello’ tries to do so and that is causing conflict.

Leave a Reply

Your email address will not be published. Required fields are marked *