[jboss-user] [EJB3] - Re: Using ejb-jar.xml for @Singleton bean
Viggo Navarsete
do-not-reply at jboss.com
Wed Apr 6 07:10:55 EDT 2011
Viggo Navarsete [http://community.jboss.org/people/viggo.navarsete] created the discussion
"Re: Using ejb-jar.xml for @Singleton bean"
To view the discussion, visit: http://community.jboss.org/message/598173#598173
--------------------------------------------------------------
Did you ever get this to work? I have a Singleton bean like this:
@Singleton
public class DummySingleton implements Dummy {
public String getHello() {
return "Hello Dummy!";
}
}
and an interface like this:
public interface Dummy {
public String getHello();
}
I've tried this in ejb-jar.xml (everything is packaged into an EAR file):
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee" version="3.1"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
<enterprise-beans>
<session>
<ejb-name>DummySingleton</ejb-name>
<ejb-class>com.tracetracker.global.aps.DummySingleton</ejb-class>
<session-type>Singleton</session-type>
<init-on-startup>false</init-on-startup>
<ejb-local-ref>
<ejb-ref-name>ejb3/hub/DummySingleton</ejb-ref-name>
<local>com.tracetracker.global.aps.Dummy</local>
</ejb-local-ref>
</session>
</enterprise-beans>
</ejb-jar>
I've also tried to add it to jboss.xml like this:
<session>
<ejb-name>DummySingleton</ejb-name>
<local-jndi>ejb3/hub/DummySingleton</local-jndi>
</session>
but no matter what I try it will not end up in JNDI bound to ejb3/hub/DummySingleton.
I can have normal session beans, and they will bind to ejb3/hub/xxxxx, but not when it's a singleton.
What am I doing wrong?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/598173#598173]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110406/cba91f27/attachment-0001.html
More information about the jboss-user
mailing list