This is my bean:
package ejbPackage;
import java.util.Collection;
import javax.ejb.Stateless;
import javax.ejb.*;
import javax.annotation.PostConstruct;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless(name="haloBean")
public class haloBean implements ejbPackage.haloRemote {
private int temp;
// @PersistenceContext
// EntityManager em;
/** Creates a new instance of helloBean */
public haloBean() {
}
// public String addTeam(int id,String name, String desc){
// Team tm = new Team(id,name,desc);
// em.persist(em);
// return "dodano - ok";
// }
@PostConstruct
public void inicjalizacja(){
this.temp = 10;
//nie wypisuje bo to nie jego konsola :-P
System.out.println("@PostConstruct");
}
public String sayHello(){
return "hello master";
}
public int getTemp(){
return temp;
}
// public Collection getTeam(){
//
// return em.createQuery("from Team t").getResultList();
// }
}
Its run, but when i uncomment it's crasched:
javax.naming.NameNotFoundException: remote not bound
....
I can't find my remote interface in jmx console (there is only client and bean) when the part of code is comment the interface is visible too.
Which line of your code generated the exception?
Is this line a typo: em.persist(em); (should read em.persist(tm);)