开发者

ejb reference in deployment descriptor (without annotations )

开发者 https://www.devze.com 2023-03-28 11:16 出处:网络
I try to inject dependency in EJB 3.0 using only deployment descriptor. When I deploy my app to Glassfish (v3.1) I get this exception:

I try to inject dependency in EJB 3.0 using only deployment descriptor. When I deploy my app to Glassfish (v3.1) I get this exception:

java.lang.RuntimeException: Warning : Unable to determine local  business vs. remote business designation for  EJB 3.0 ref Local ejb-ref name=ejb/Test2,Local 3.x interface =pl.Test2Local,ejb-link=Test2,lookup=,mappedName=,jndi-name=,refType=Session

I have no idea what I do wrong. Can anybody help me, please?

The ejb-jar.xml descriptor is:

<session>
    <ejb-name>Test2</ejb-name>
    <remote>pl.Test2Remote</remote>
    <local>pl.Test2Local</local>
    <ejb-class>pl.Test2</ejb-class>
    <session-type>Stateless</session-type>
</session>

<session>
    <ejb-name>Test</ejb-name>
    <remote>pl.TestRemote</remote>
    <local开发者_JS百科>pl.TestLocal</local>
    <ejb-class>pl.Test</ejb-class>
    <session-type>Stateless</session-type>
    <ejb-local-ref>
        <ejb-ref-name>ejb/Test2</ejb-ref-name>
        <local>pl.Test2Local</local>
        <ejb-link>Test2</ejb-link>
        <injection-target>
            <injection-target-class>pl.Test</injection-target-class>
            <injection-target-name>test2</injection-target-name>
        </injection-target>
    </ejb-local-ref>
</session>

Class pl.Test:

public class Test implements TestRemote, TestLocal {
private Test2Local test2;
public Test() {
}

}


The solution is:

<enterprise-beans>
    <session id="Test">
        <ejb-name>Test</ejb-name>
        <ejb-class>pl.Test</ejb-class>
        <session-type>Stateless</session-type>
        <transaction-type>Container</transaction-type>
        <ejb-local-ref>
            <ejb-ref-name>pl.Test/test2</ejb-ref-name>
            <local>pl.Test2Local</local>
            <injection-target>
                <injection-target-class>pl.Test</injection-target-class>
                <injection-target-name>test2</injection-target-name>
            </injection-target>
        </ejb-local-ref>
        <depends-on/>
    </session>
    <session id="Test2">
        <ejb-name>Test2</ejb-name>
        <mapped-name></mapped-name>
        <ejb-class>pl.Test2</ejb-class>
        <session-type>Stateless</session-type>
        <transaction-type>Container</transaction-type>
        <depends-on/>
    </session>
</enterprise-beans>


you need to replace below tags in the XML:

remote = business-remote local = business-local

0

精彩评论

暂无评论...
验证码 换一张
取 消