Olá,
estou usando :
jboss-4.2.2.GA
jre1.5.0_16
e na hora que um link no jsp chama o servlet abaixo como acha o nome na linha lookup esse remote mais nome javaBean e a aplicação EAR
não entendi ???
TestApplication --> ear
TestApplicationEJB --> ejb
TestApplicationWeb -->web
Se alguém puder me ajudar
abs
HelloWorld hello = (HelloWorld) ctx.lookup("TestApplication/HelloWorldBean/remote");
----servlet
public class TestServlet extends HttpServlet implements javax.servlet.Servlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TestServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
InitialContext ctx = new InitialContext();
HelloWorld hello = (HelloWorld) ctx.lookup("TestApplication/HelloWorldBean/remote");
System.out.println(hello.getMessage());
} catch (NamingException e) {
e.printStackTrace();
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
super.doPost(request, response);
}
}
----Descriptor
<display-name>
TestApplication</display-name>
<module>
<web>
<web-uri>TestApplicationWeb.war</web-uri>
<context-root>TestApplicationWeb</context-root>
</web>
</module>
<module>
<ejb>TestApplicationEJB.jar</ejb>
</module>
</application>
----ejb
@Stateless
@Remote(HelloWorld.class)
public class HelloWorldBean implements HelloWorld {
public String getMessage() {
// TODO Auto-generated method stub
return "Olá,,,Paulo";
}
}
-----
public interface HelloWorld {
public String getMessage();
}