1 Reply Latest reply on Aug 19, 2013 11:17 AM by Wolf-Dieter Fink

    EJB2.x invocation in jboss-as-7.1.1.Final

    Surendra Ind Newbie

      Hi,

          

      I had a problem while invocating ejbs in jboss as 7. Here i have a statefull session bean named EJBController.The jndi lookup works fine but when i say HomeInterface.create() i am getting the exception saying  "java.lang.IllegalArgumentException: Could not find ejb ControllerEJB in app: savoya module: savoya distinct name:"

       

      help me to solve the above error?

       

       

      ejb-jar.xml

      ========

       

      <session>

                                    <display-name>EJBController Service</display-name>

                                    <ejb-name>ControllerEJB</ejb-name>

                                    <home>com.mysedan.application.limonet.control.ejb.EJBControllerHome</home>

                                    <remote>com.mysedan.application.limonet.control.ejb.EJBController</remote>

                                    <ejb-class>com.mysedan.application.limonet.control.ejb.EJBControllerBean</ejb-class>

                                    <session-type>Stateful</session-type>

                                    <transaction-type>Container</transaction-type>

                                    <resource-ref>

                                              <description>The mysedan DS</description>

                                              <res-ref-name>datasources/mysedanDS</res-ref-name>

                                              <res-type>javax.sql.DataSource</res-type>

                                              <res-auth>Container</res-auth>

                                              <lookup-name>java:jboss/datasources/mysedanDS</lookup-name>

                                    </resource-ref>

                          </session>

       

       

      jboss.xml

      =========

       

      <session>

                                    <ejb-name>ControllerEJB</ejb-name>

                                    <jndi-name>com.mysedan.application.limonet.control.ejb.EJBControllerHome</jndi-name>

                                    <resource-ref>

                                              <res-ref-name>datasources/mysedanDS</res-ref-name>

                                              <resource-name>datasources/mysedanDS</resource-name>

                                    </resource-ref>

      </session>

       

      jboss-ejb-client.properties

      =================

       

      #endpoint.name=client-endpoint

      remote.connections=default

      remote.connection.default.host=localhost

      remote.connection.default.port = 4447

      jboss.naming.client.ejb.context=true

      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

       

       

       

       

      private static Object lookup(String JNDIName, Class classType) throws NamingException { 

                          Object objref=null;

                          try

                          { 

                                    InitialContext ic = new InitialContext();

                                    objref = ic.lookup(JNDIName);

                                    System.out.println("\n *****************Lookup successful ************** \n"+objref);

                          }

                          catch (Exception e)

                          {

                                    System.out.println("\n *****************Got Exception while lookup ************** \n");

                                    e.printStackTrace();

                          }

                          //return objref;

                          return PortableRemoteObject.narrow(objref, classType);

              }

       

       

      public static EJBControllerHome getEJBControllerHome() throws NamingException {

                                    return (EJBControllerHome) lookup("ejb:savoya/savoya/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome?stateful", EJBControllerHome.class);

                }

       

       

       

      EJBController = getEJBControllerHome().create(); //getting the exception here

       

       

      server.log

      ===========

      15:54:36,231 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ControllerEJB in deployment unit subde

      ployment "savoya.jar" of deployment "savoya.ear" are as follows:

       

       

              java:global/savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBController

              java:app/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBController

              java:module/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBController

              java:jboss/exported/savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBController

              java:global/savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome

              java:app/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome

              java:module/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome

              java:jboss/exported/savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome

       

       

       

      54:51,404 WARN  [org.jboss.ejb.client.naming] (http--0.0.0.0-80-1) Ignoring 'stateful' option on lookup of home interface com.mysedan.application.limonet.control.ejb.EJBControllerHome

      54:51,413 INFO  [org.jboss.ejb.client] (http--0.0.0.0-80-1) JBoss EJB Client version 1.0.5.Final

      54:51,426 INFO  [stdout] (http--0.0.0.0-80-1)

      54:51,428 INFO  [stdout] (http--0.0.0.0-80-1)  *****************Lookup successful **************

      54:51,430 INFO  [stdout] (http--0.0.0.0-80-1) Proxy for remote EJB EJBHomeLocator{appName='savoya', moduleName='savoya', distinctName='', beanName='ControllerEJB', view='interface com.mysedan.appli

      ion.limonet.control.ejb.EJBControllerHome'}

      54:51,443 ERROR [stderr] (http--0.0.0.0-80-1) java.lang.IllegalArgumentException: Could not find ejb ControllerEJB in app: savoya module: savoya distinct name:

      54:51,446 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.findBean(LocalEjbReceiver.java:281)

      54:51,451 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:109)

      54:51,455 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)

      54:51,468 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)

      54:51,472 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      54:51,474 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)

      54:51,487 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      54:51,489 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

      54:51,502 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

      54:51,505 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

      54:51,516 ERROR [stderr] (http--0.0.0.0-80-1)        at com.sun.proxy.$Proxy10.create(Unknown Source)

      54:51,519 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.getEJBController(ModelManager.java:1613)

      54:51,522 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.<init>(ModelManager.java:287)

      54:51,534 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doProcess(MainServlet.java:804)

      54:51,537 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doGet(MainServlet.java:52)

      54:51,540 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

      54:51,551 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      54:51,554 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      54:51,566 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      54:51,569 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      54:51,572 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      54:51,584 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      54:51,587 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      54:51,590 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      54:51,602 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      54:51,605 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      54:51,616 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      54:51,619 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      54:51,623 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      54:51,634 ERROR [stderr] (http--0.0.0.0-80-1)        at java.lang.Thread.run(Thread.java:724)

        • 1. Re: EJB2.x invocation in jboss-as-7.1.1.Final
          Wolf-Dieter Fink Master

          With the ejb-client library (since AS7) there is no server connection if you do a lookup, therefore there is no failure.

           

          from what I see your module is installed

             java:jboss/exported/savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBController

           

          so you lookup should use the following pattern ejb:<ear>/<module jar>[/<distinct>]/<bean>!<view>

          in this case it will be

              ejb:savoya/savoya.jar/ControllerEJB!com.mysedan.application.limonet.control.ejb.EJBControllerHome?stateful

           

          The reason is that your jar file inside the ear is named savoya.jar.jar or you override the name in the deployment descriptor