Embedded EJB3 Services
majohnst Oct 19, 2005 12:20 AMI am trying to learn EJB3, so I downloaded the Embedded version and I am running the samples through JUnit in Eclipse. I have the tutorial examples of entity beans working fine. But I can't get a @Service bean to load.
Here is my service
public interface IndexerMBean { public String getResults(); void create() throws Exception; void start() throws Exception; void stop(); void destroy(); } @Service @Management(IndexerMBean.class) public class IndexerService implements IndexerMBean { protected static final Log log = LogFactory.getLog(IndexerService.class); private String indexDir; private String results = "my results"; public String getResults() { return results; } public void create() throws Exception { System.out.println("ServiceOne - Creating"); } public void start() throws Exception { System.out.println("ServiceOne - Starting"); } public void stop() { System.out.println("ServiceOne - Stopping"); } public void destroy() { System.out.println("ServiceOne - Destroying"); } }
When I run my junit test based on the tutorial examples, I get the error message
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.jboss.ejb3.service.ServiceMBeanDelegate.register(ServiceMBeanDelegate.java:67)
at org.jboss.ejb3.service.ServiceContainer.registerManagementInterface(ServiceContainer.java:303)
at org.jboss.ejb3.service.ServiceContainer.start(ServiceContainer.java:70)
at org.jboss.ejb3.service.ServiceManager.startService(ServiceManager.java:97)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:181)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployment.start(EJB3StandaloneDeployment.java:101)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:389)
Does anyone know what causes this error?