EJB + JNDI BINDING = A MESS
2lopez Aug 26, 2007 11:27 AMI to all.
I'm developing a EJB3 + Struts app on jboss 4.2. It's very important to me, my final project at the university. I have a problem binding the stateless GestionBitacora. Simply I can't!
My code:
GestionBitacora.java
package stateless.bitacora; import java.sql.Timestamp; import java.util.Calendar; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import entidades.Bitacora; @Stateless //@EJB(name="ejb/GestionBitacora",beanName="GestionBitacora",beanInterface=GestionEntrada.class) public class GestionBitacoraBean implements GestionBitacora { @PersistenceContext(unitName="MySqlDS") private EntityManager miEntityManager; public void log(String _msg) { Bitacora b = new Bitacora(); b.setMsg(_msg); b.setTiempo(new Timestamp(Calendar.getInstance().getTimeInMillis())); miEntityManager.persist(b); } }
The remote interface:
package stateless.bitacora; import javax.ejb.Remote; @Remote public interface GestionBitacora { public void log(String _msg); }
The ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"> <enterprise-beans> <!-- MORE STATELESS EJBs, BUT PROPERLY BOUND --> <session> <ejb-name>GestionBitacora</ejb-name> <ejb-ref> <ejb-ref-name>ejb/GestionBitacora</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <remote>stateless.bitacora</remote> <ejb-link>GestionBitacora</ejb-link> <injection-target> <injection-target-class>stateless.bitacora.GestionBitacora</injection-target-class> <injection-target-name>gestionBitacora</injection-target-name> </injection-target> </ejb-ref> </session> </enterprise-beans> </ejb-jar>
I'm completely lost!!! The other Stateless EJB are perfectly deployed and ready to use, but this GestionUsuario isn't, according to the JNDIView... I've been investigating for hours, but found nothing.
Anybody could help me? Thanks in advance, it would be much appreciated.