I'm new to EJB3, and have limited experience in EJB 2.1.
We have an existing application running on jboss 5.0.1GA using EJB 2.1, and I would like to start using EJB3.
Tutorials like this one and this one imply that all I need to do to get started is to annotate a POJO with @Stateful
or @Stateless
and jboss will pick it up automatically.
So I've tried annotating a couple of simple POJOs, like this:
@Stateful(description="matt's new test counter")
public class Counter {
private int count = 0;
public int count() {
return count;
}
public int increment() {
return ++count;
}
public int reset() {
return (count = 0);
}
@PostConstruct
public void initialize () {
// Initialize here objects which will be used
System.out.println("Counter initialized.");
}
@PreDestroy
public void destroyBean() {
// Free here resources acquired by the session bean
System.out.println("Counter destroyed.");
}
}
There is no sign in the log file or the JNDI of the word 'Counter'. According to the tutorials, in the absence of any other config the container will assign a default JNDI name to my bean.
How do I get my EJB deployed? The old EJBs on our system use application.xml, but I was hoping to do this new one using annotations only.
Aucun commentaire:
Enregistrer un commentaire