문제

I have a stateless EJB SessionBean with bith @local and @remote annotations. The code is working fine in weblogic server. However on deploying it to Websphere it gives following exception.

bm.ejs.container.EJBConfigurationException: BUSINESS_INTERFACE_DESIGNATED_AS_BOTH_REMOTE_AND_LOCAL: 'oracle.odc.session.ODCSession'

The oracle.odc.session.ODCSession business interface class cannot be both remote and local.

Is there any workaround available to make it work without writing seperate EJBs for remote and local invocation?

도움이 되었습니까?

해결책

One workaround is to have a base interface with the method declarations & then have a local interface & a remote inteface, which extend the base interface, e.g.

public interface MyEJBBase {
    public void foo();
    public void bar();
}

@Local
public interface MyEJBLocal extends MyEJBBase {}

@Remote
public interface MyEJBRemote extends MyEJBBase {}

다른 팁

AFAIK there is no way, the error seems pretty descriptive.

From section 4.9.7 of the EJB 3.2 specification:

The same business interface cannot be both a local and a remote business interface of the bean.

You can use subinterfaces as a workaround:

public interface MyInterface { /* all the methods */ }
public interface MyRemoteInterface extends MyInterface { /* empty */ }

@Stateless
@Remote(MyRemoteInterface.class)
@Local(MyInterface.class)
public class MyBean { /* ... */ }

Note that the parameters and return values of the methods on the remote interface will be pass-by-value but the parameters and return values of the methods on the local interface will be pass-by-reference.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top