[jboss-user] [EJB 3.0] - Problem Call ejb3.0

fduartej do-not-reply at jboss.com
Wed Jul 16 13:17:57 EDT 2008


Hello:

I have a problem when call ejb 3.0,
I am use jboss-4.2.2.GA

My problem report is

2008-07-16 11:16:27,176 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/appprueba].[ControlServlet]] Servlet.service() para servlet ControlServlet lanzó excepción
java.lang.NoSuchMethodError: model.CalculatorLocal.foo(Ljava/lang/String;)Ljava/lang/String;
	at control.ControlServlet.doPost(ControlServlet.java:49)
	at control.ControlServlet.doGet(ControlServlet.java:31)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
	at java.lang.Thread.run(Thread.java:595)

My ejb is

import javax.ejb.*;

import org.jboss.annotation.ejb.LocalBinding;
import org.jboss.annotation.ejb.RemoteBinding;

@Stateless
@Local ({CalculatorLocal.class})
@LocalBinding (jndiBinding="EJB3Trail/LocalCalculator")
@Remote ({Calculator.class})
@RemoteBinding (jndiBinding="EJB3Trail/RemoteCalculator")
public class CalculatorBean implements Calculator, CalculatorLocal {


    public String foo(String param){
        return "hola"+param;
    }
}

My interface ejb local is


import javax.ejb.Local;

@Local
public interface CalculatorLocal {

    String foo(String param);
}

My Servlet invoque ejb 3.0 is

import java.io.IOException;
import java.io.PrintWriter;

import javax.naming.InitialContext;

import javax.servlet.*;
import javax.servlet.http.*;

import model.CalculatorLocal;

public class ControlServlet extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";

    public void doPost(HttpServletRequest request, 
                       HttpServletResponse response) throws ServletException, IOException {response.setContentType(CONTENT_TYPE);
        CalculatorLocal cal = null;
        try {
            InitialContext ctx = new InitialContext();
             cal = (CalculatorLocal) ctx.lookup("EJB3Trail/LocalCalculator");
        } catch (Exception e) {
              e.printStackTrace ();
        } 

        //Problem al invoque method
        String msj = cal.foo("fred");  //The problem is here


        PrintWriter out = response.getWriter();
        out.println("");
        out.println("ControlServlet");
        out.println("");
        out.println(""+msj+"");
        out.println("");
        out.close();
    }
}



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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4164819




More information about the jboss-user mailing list