Please, I'm trying to do a simple
test EJB project in Netbeans 6.5 and Glassfish V2, but It is terrible.
Look... I just do It. First a created a project in New Project ->
Java EE -> EJB Module. Ok!
In directory "Source Code Packeages" I created one package called "stateless" with yours two ejb. They are:
package stateless;
import javax.ejb.Stateless;
/**
*
* @author Higor
*/
@Stateless
public class TesteEJBBean implements TesteEJBRemote {
public
String getMessage() {
return "Hello EJB World";
}
}
And the Remote:
package stateless;
import javax.ejb.Remote;
/**
*
* @author Higor
*/
@Remote
public interface TesteEJBRemote {
public java.lang.String getMessage();
}
In Enterprise Beans directory it have the same code of TesteEJBBean. I think Netbeans do it automaticaly, I dont remember if I put it there.
Ok,it's work!
But How can I try test it???
I tryed to put a simple java class in "Test Package" directory like it:
package Teste;
import javax.ejb.EJB;
import stateless.TesteEJBRemote;
/**
*
* @author Higor
*/
public class NewClass {
@EJB
private static TesteEJBRemote teste;
public static void main(String[] args) {
//System.out.println(teste.getMessage());
System.out.println("teste");
}
}
The compilation is Ok, but when I select it and select Execute option it have a error.
The compilation step I'm doing with all this classes is: Select the project and right mouse click and select BUILD.
Later I just select NewClass in Test Package directory and try Compile -> Execute.
Anyone can help me please??
Thank you a lot if you can help me!!!
Higor