Beleza galera?
Estou testando o weblogic 10,0 com ejb3 e por algum motivo não consigo fazer injeção do ejb3 em um servlet.
MNeus ejbs:
package uk.co.regdeveloper.webservice;
import javax.ejb.Stateless;
/**
* Session Bean implementation class TesteInjecao
*/
@Stateless(mappedName = "TesteInjecao")
public class TesteInjecaoBean implements TesteInjecao {
/**
* Default constructor.
*/
public TesteInjecaoBean() {
// TODO Auto-generated constructor stub
}
public String echo(String e) {
Teste teste = new Teste();
teste.setTeste("Web Service Echo !!!!!!!!!!!!1 + " + e);
return teste.getTeste();
}
}
package uk.co.regdeveloper.webservice;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@Stateless(mappedName="EchoBean")
//@WebService(endpointInterface = "uk.co.regdeveloper.webservice.Echo")
public class EchoBean implements Echo{
@EJB(beanName="TesteInjecaoBean")
private TesteInjecao teste;
public String echo(String e) {
return teste.echo(e);
}
}
meu Servlet
package br.com.teste;
import java.io.IOException;
import java.util.Hashtable;
import javax.ejb.EJB;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import uk.co.regdeveloper.webservice.Echo;
/**
* Servlet implementation class EchoServlet
*/
public class EchoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@EJB(beanName="EchoBean")
private Echo ejb;
/**
* @see HttpServlet#HttpServlet()
*/
public EchoServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String returno = "ejb não encontrato!!! "+ejb;
returno = ejb.echo(request.getParameter("echo"));
response.getWriter().print(returno);
}
}
Tentei fazer lookup diretamernte e me deu ese erro:
javax.naming.NameNotFoundException: Unable to resolve 'EchoBean'. Resolved ''; remaining name 'EchoBean'
Agradeço a oportunidade!