2 Replies Latest reply on Aug 22, 2013 6:50 AM by Surendra Ind

    Does jboss-as-7.1.1.Final supports entity beans?

    Surendra Ind Newbie

      I am using EJB2.x. So I just want to confirm whether jboss-as-7.1.1.Final supports entity beans or not?

       

      If yes then can you please help me how to lookup for local EJB ?

       

      I tried but getting  Naming Exception...

       

      can you please help to solve the Naming Exception?

       

      ejb-jar.xml

      =========

       

      <entity>

                   <display-name>Affiliate Assignment Entity Bean</display-name>

                                      <ejb-name>MsAffiliateAssignment</ejb-name>

       

                                      <local-home>com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignmentHome</local-home>

                                      <local>com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignment</local>

                                      <ejb-class>com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignmentEJB</ejb-class>

       

                                      <persistence-type>Container</persistence-type>

                                      <prim-key-class>com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignmentPK</prim-key-class>

                                      <reentrant>False</reentrant>

                     <cmp-version>2.x</cmp-version>

                     <abstract-schema-name>MsAffiliateAssignment</abstract-schema-name>

       

                                      <cmp-field> <field-name>metroId</field-name> </cmp-field>

                                      <cmp-field> <field-name>countryState</field-name> </cmp-field>

                                      <cmp-field> <field-name>landmarkId</field-name> </cmp-field>

                                      <cmp-field> <field-name>affiliateId</field-name> </cmp-field>

                                      <cmp-field> <field-name>ranking</field-name> </cmp-field>

                                      <cmp-field> <field-name>licenseeId</field-name> </cmp-field>

       

               <query>

                  <query-method>

                     <method-name>findByMetroIdForLicensee</method-name>

                                       <method-params>

                                                 <method-param>java.lang.Long</method-param>

                                                 <method-param>java.lang.Long</method-param>

                                       </method-params>

                  </query-method>

                  <ejb-ql><![CDATA[  SELECT OBJECT(a)   FROM MsAffiliateAssignment AS a   WHERE a.metroId=?1 and a.licenseeId=?2 ]]></ejb-ql>

               </query>

               <query>

                  <query-method>

                     <method-name>findByAffiliateIdForLicensee</method-name>

                                       <method-params>

                                                 <method-param>java.lang.Long</method-param>

                                                 <method-param>java.lang.Long</method-param>

                                       </method-params>

                  </query-method>

                  <ejb-ql><![CDATA[ SELECT OBJECT(a) FROM MsAffiliateAssignment AS a  WHERE a.affiliateId=?1 and a.licenseeId=?2 ]]></ejb-ql>

               </query>

               <query>

                  <query-method>

                     <method-name>findByCountryStateForLicensee</method-name>

                                       <method-params>

                                                 <method-param>java.lang.String</method-param>

                                                 <method-param>java.lang.Long</method-param>

                                       </method-params>

                  </query-method>

                  <ejb-ql><![CDATA[   SELECT OBJECT(a)   FROM MsAffiliateAssignment AS a  WHERE a.countryState=?1 and a.licenseeId=?2 ]]></ejb-ql>

               </query>

                          </entity>

       

       

      jboss.xml

      ==========

       

      <entity>

                                    <ejb-name>MsAffiliateAssignment</ejb-name>

                                    <local-jndi-name>com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignmentHome</local-jndi-name>

                              <method-attributes>

                                          <method>

                                            <method-name>get*</method-name>

                                            <read-only>true</read-only>

                                          </method>

                              </method-attributes>

                          </entity>

       

      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

       

       

       

       

       

      InitialContext ic = new InitialContext();

      ic.lookup("com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignmentHome"); //getting exception here

       

       

      server.log

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

       

      14:13:16,948 ERROR [stderr] (http--0.0.0.0-80-1) javax.naming.NameNotFoundException: com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignmentHome -- service jboss.naming.context.java."com.mysedan.lookup.MsAffiliateAssignment.MsAffiliateAssignmentHome"

      14:13:16,952 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

      14:13:16,953 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

      14:13:16,955 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)

      14:13:16,965 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)

      14:13:16,968 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.naming.InitialContext.lookup(InitialContext.java:411)

      14:13:16,973 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.util.EJBUtil.lookup(EJBUtil.java:127)

      14:13:16,977 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.util.EJBUtil.getMsLicAffHome(EJBUtil.java:244)

      14:13:16,980 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.getAffLicenseeInfo(ModelManager.java:382)

      14:13:16,983 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.<init>(ModelManager.java:288)

      14:13:16,987 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doProcess(MainServlet.java:804)

      14:13:16,997 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doGet(MainServlet.java:52)

      14:13:17,001 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

      14:13:17,004 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      14:13:17,009 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      14:13:17,012 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      14:13:17,016 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      14:13:17,019 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      14:13:17,022 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      14:13:17,033 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      14:13:17,036 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      14:13:17,041 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      14:13:17,044 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      14:13:17,048 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      14:13:17,051 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      14:13:17,052 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      14:13:17,054 ERROR [stderr] (http--0.0.0.0-80-1)        at java.lang.Thread.run(Thread.java:724)

      14:13:17,065 ERROR [stderr] (http--0.0.0.0-80-1) java.lang.NullPointerException

      14:13:17,068 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.getAffLicenseeInfo(ModelManager.java:383)

      14:13:17,071 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.<init>(ModelManager.java:288)

      14:13:17,076 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doProcess(MainServlet.java:804)

      14:13:17,078 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doGet(MainServlet.java:52)

      14:13:17,082 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

      14:13:17,086 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      14:13:17,087 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      14:13:17,089 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      14:13:17,098 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      14:13:17,101 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      14:13:17,103 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      14:13:17,105 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      14:13:17,115 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      14:13:17,118 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      14:13:17,121 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      14:13:17,125 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      14:13:17,128 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      14:13:17,131 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      14:13:17,134 ERROR [stderr] (http--0.0.0.0-80-1)        at java.lang.Thread.run(Thread.java:724)

      14:13:17,152 ERROR [stderr] (http--0.0.0.0-80-1) java.lang.RuntimeException: ClassNotFoundException marshaling EJB parameters

      14:13:17,154 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:229)

      14:13:17,155 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:216)

      14:13:17,158 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:188)

      14:13:17,161 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)

      14:13:17,164 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)

      14:13:17,167 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      14:13:17,170 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)

      14:13:17,174 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      14:13:17,183 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

      14:13:17,186 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

      14:13:17,190 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

      14:13:17,193 ERROR [stderr] (http--0.0.0.0-80-1)        at com.sun.proxy.$Proxy11.getStateMachine(Unknown Source)

      14:13:17,196 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.ModelManager.setSiteId(ModelManager.java:1211)

      14:13:17,199 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doProcess(MainServlet.java:826)

      14:13:17,202 ERROR [stderr] (http--0.0.0.0-80-1)        at com.mysedan.application.limonet.control.web.MainServlet.doGet(MainServlet.java:52)

      14:13:17,206 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)

      14:13:17,215 ERROR [stderr] (http--0.0.0.0-80-1)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      14:13:17,218 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      14:13:17,223 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      14:13:17,226 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      14:13:17,230 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      14:13:17,233 ERROR [stderr] (http--0.0.0.0-80-1)        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

      14:13:17,237 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      14:13:17,239 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      14:13:17,249 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      14:13:17,252 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)

      14:13:17,255 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      14:13:17,264 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      14:13:17,269 ERROR [stderr] (http--0.0.0.0-80-1)        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      14:13:17,271 ERROR [stderr] (http--0.0.0.0-80-1)        at java.lang.Thread.run(Thread.java:724)

      14:13:17,277 ERROR [stderr] (http--0.0.0.0-80-1) Caused by: java.lang.ClassNotFoundException: org.jboss.as.naming.ValueManagedReferenceFactory$ValueManagedReference from [Module "deployment.savoya.ear

      .savoya.jar:main" from Service Module Loader]

        • 1. Re: Does jboss-as-7.1.1.Final supports entity beans?
          Wolf-Dieter Fink Master

          Yes, AS7.1.1 supports EJB2 entity beans.

          But for CMP you need to start a *full* profile for this to have the cmp subsystem available. Otherwise the beans are ignored. You will see that during deployment, the beans will be shown in the log if they are started.

           

          The Exception look something different, there is a ClassNotFound, you have to package the Entity interfaces in your application or provide it as module (which I do not recommend, seems to static for me you have to restart the AS if you change it)

           

          From the lookup you show it seems to me that you try to lookup remote, right?

          The lookup is different in AS7, you need to have

            <appname>/<module name>/<bean name>!<interface class>

          for lookup.

           

          see documentation https://docs.jboss.org/author/display/AS72/EJB+invocations+from+a+remote+client+using+JNDI

          • 2. Re: Does jboss-as-7.1.1.Final supports entity beans?
            Surendra Ind Newbie

            I used standard-full and i can able to see my entity beans are also in the log and successfully done with the EJB2 entity beans.

             

            And i lookup the entity beans locally, below lookup works for me.

             

            10:59:38,161 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named MsLicAff in deployment unit subdeploym

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

                

            java:global/savoya/savoya.jar/MsLicAff!com.mysedan.lookup.MsLicAff.MsLicAffHome

            java:app/savoya.jar/MsLicAff!com.mysedan.lookup.MsLicAff.MsLicAffHome

            java:module/MsLicAff!com.mysedan.lookup.MsLicAff.MsLicAffHome

            java:global/savoya/savoya.jar/MsLicAff!com.mysedan.lookup.MsLicAff.MsLicAff

            java:app/savoya.jar/MsLicAff!com.mysedan.lookup.MsLicAff.MsLicAff

            java:module/MsLicAff!com.mysedan.lookup.MsLicAff.MsLicAff

             

             

            And now, i want to lookup these entity bean locally.

             

             

            InitialContext ic = new InitialContext();

            ic.lookup("java:app/savoya.jar/MsLicAff!com.mysedan.lookup.MsLicAff.MsLicAffHome");