users@glassfish.java.net

Component dependencies in standart .xml and via annotation

From: <glassfish_at_javadesktop.org>
Date: Thu, 17 May 2007 22:38:55 PDT

Hi!
I have the following simple ejb-jar, which has depend on JMS topic:
@Remote
public interface SLSB0517A
{
        public String get1();
}
@Stateless
public class SLSB0517AImpl implements SLSB0517A
{
        @Resource (name="topic1")
        Topic t;
        public String get1()
        {
                return (t==null?"null":t.toString());
        }
}
---------------------------------
sun-ejb-jar.xml:
<sun-ejb-jar>
        <enterprise-beans>
                <ejb>
                        <ejb-name>SLSB0517AImpl</ejb-name>
                        <resource-ref>
                                <res-ref-name>topic1</res-ref-name>
                                <jndi-name>jms/Topic</jndi-name>
                        </resource-ref>
                </ejb>
        </enterprise-beans>
</sun-ejb-jar>
---------------------------------------
This ejb module doesn't deploy, with message:
Error loading deployment descriptors for module [ejb0517A] -- This bean [SLSB0517AImpl] has no resource reference by the name of [topic1]

If I declare dependency through standart descriptor, it's deployed successfully:
---------------------------------
ejb-jar.xml:
<enterprise-beans>
        <session>
                <ejb-name>SLSB0517AImpl</ejb-name>
                <resource-ref>
                        <res-ref-name>topic1</res-ref-name>
                        <injection-target>
                                <injection-target-class>test.SLSB0517AImpl</injection-target-class>
                                <injection-target-name>t</injection-target-name>
                        </injection-target>
                </resource-ref>
        </session>
</enterprise-beans>
---------------------------------
Can you give any suggestions? Thanks.

GF2, b46
WinXP
[Message sent by forum member 'sinus' (sinus)]

http://forums.java.net/jive/thread.jspa?messageID=217778