estou desenvolvedo um exemplo de chamada do EJB por uma aplicação Stand alone, mas esta dando uma exceção.
Estou utilizando o WebLogic 11gR1
A classe que faz o lookup
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3://localhost:7001/");
ctx = new InitialContext(ht);
HelloBean helloBean = (HelloBean) ctx.lookup ("HelloBean#br.com.teste.HelloBeanRemote");
O mapeamento no projeto EJB:
@Stateless (name = "HelloBean" , mappedName = "HelloBean")
public class HelloBean implements HelloBeanRemote{
/**
* Default constructor.
*/
public HelloBean() {
// TODO Auto-generated constructor stub
}
public String test() {
return "Remote is Ready";
}
}
Interface
@Remote
public interface HelloBeanRemote {
public String test( );
}
ele retorna a seguinte exceção :
Exception in thread "main" java.lang.ClassCastException: $Proxy0 cannot be cast to br.com.teste.HelloBean
at br.com.tutorial.EjbCliente.connect(EjbCliente.java:37)
at br.com.tutorial.EjbCliente.main(EjbCliente.java:16)
No overview do JNDI tree fica
This page displays details about this bound object.
Binding Name:
HelloBean#br.com.teste.HelloBeanRemote
Class:
$Proxy109
Hash Code:
14629952
toString Results:
ClusterableRemoteRef(-1985301664966677648S::base_domain:AdminServer [-1985301664966677648S::base_domain:AdminServer/346])/346
Alguem sabe pq dessa exceção?