As I said, this worked in Beta4 and the approach is right out of the Manning 
EJB3 book.

Interface:
package ic.poc.wc;
  | 
  | import javax.ejb.Remote;
  | 
  | @Remote
  | public interface CoverageWC {
  |     public int retrieveSubmission(int covSubmissionId);
  | }

Implementation:
package ic.poc.wc;
  | 
  | import javax.ejb.Stateless;
  | 
  | @Stateless
  | public class CoverageWCBean implements CoverageWC {
  |     public int retrieveSubmission(int covSubmissionId) {
  |             return 1;
  |     }
  | }

Usage:
import java.io.IOException;
  | import javax.servlet.ServletException;
  | import javax.servlet.http.HttpServletRequest;
  | import javax.servlet.http.HttpServletResponse;
  | import javax.ejb.EJB;
  | import ic.poc.wc.*;
  | 
  |  public class EJB3TestServlet extends javax.servlet.http.HttpServlet 
implements javax.servlet.Servlet {
  |    static final long serialVersionUID = 1L;
  |    @EJB
  |    private CoverageWC wc;
  |    
  |     public EJB3TestServlet() {
  |             super();
  |     }       
  |     
  |     protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
  |             response.setContentType("text/plain");
  |             System.out.println(new java.util.Date()+"XXXXXXXEEEEEEEEEEEE");
  |             response.getOutputStream().println("Go !");
  |             response.getOutputStream().println(new java.util.Date()+"");
  |             response.getOutputStream().println(wc.retrieveSubmission(1));
  |     }       
  |     
  |     protected void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
  |             // TODO Auto-generated method stub
  |     }                   
  | }

I did find a work-around...it required two things:
1.  Added 'mappedName="EJB3Test1/CoverageWCBean/remote"' to the @EJB annotation 
in the servlet.
2.  That then created another exception which required that I set 
CallByValue=true in the Naming service.

Why are these required now?

tia, Rick

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159138#4159138

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159138
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to