/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clientjavase;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import com.delta.br.HelloUser;
import java.io.FileInputStream;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
*
*/
public class Main {
@EJB
private static HelloUser helloUser ;
public static void main(String[] args) {
try {System.out.println("testando ... ");
Properties props = new Properties();
props.load(new FileInputStream("C:\\jndiFile.properties"));
InitialContext ctx = new InitialContext(props);
helloUser = (HelloUser) ctx.lookup("HelloUser");
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (NamingException nex) {
nex.printStackTrace();
}
helloUser.sayHello("Curious George");
System.out.println("Invoked EJB successfully .. see server console for output");
}
}
esse lookup está correto ?