11 Replies Latest reply on Oct 31, 2011 8:37 AM by rodakr

    JBoss AS 7.0.1 and EJB 3 lookup

    paykin

      Hello,

      I deploy my app as 2 separate deployments: EAR and WAR.

      I put my EJB interfaces inside both WAR and JAR inside EAR.

      When I trying to lookup EJB from WAR I recieve exception:

       

      java.lang.ClassCastException: ruleEngine.api.ApplicationData$$$view12 cannot be cast to org.omg.CORBA.Object

                at org.jboss.com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:225) [jboss-rmi-api_1.0_spec-1.0.1.Final.jar:1.0.1.Final]

       

      or simple ClassCastException when I just cast the class without narrowing.

       

      The application worked fine in JBoss 6, only when I put property

      properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");

      to InitialContext. When I removed the property, I started to recieve the same error as on JB7.

       

      Unfortunatelly, I can not create separate jar with interfaces, because of dependencies exist in the project. Because of the same problem I can not include EAR JAR in WAR's classpath.

       

      Any help?

        • 1. Re: JBoss AS 7.0.1 and EJB 3 lookup
          wolfc

          Is it a remote business view or a local business view?

           

          If it is a local, it is not supposed to work.

           

          If it is a remote, it is a bug in both AS 6 and 7.

          • 2. Re: JBoss AS 7.0.1 and EJB 3 lookup
            paykin

            It is Remote interfaces.

            Can I somehow make it work?

            Thanks

            • 3. Re: JBoss AS 7.0.1 and EJB 3 lookup
              wolfc

              Can you post a stack trace?

               

              We can patch the AS code. :-)

              • 4. Re: JBoss AS 7.0.1 and EJB 3 lookup
                paykin

                I attach full stacktrace.

                 

                As I see the problem,

                 

                The classloader of ApplicationData.class is:

                ModuleClassLoader for Module "deployment.RuleEngineEjb.ear.RuleEngine.war:main" from Service Module Loader

                 

                The clasloader of remote interface ("obj") is:

                ModuleClassLoader for Module "deployment.RuleEngineEjb.ear.RuleEngine.jar:main" from Service Module Loader

                 

                i.e. the classloaders are diferent, so it can not make direct casting.

                 

                The following is a snippet of a code that produces the error.

                I tried to pack WAR inside the EAR, it produces the same error.

                 

                ...

                Object obj = context.lookup(jndiName);

                ...

                // EJBHomeFactory.java line 66

                Object homeInterface = javax.rmi.PortableRemoteObject.narrow(obj, ApplicationData.class);

                ...

                 

                 

                10:38:29,266 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RuleEngine].[jsp]] (http--127.0.0.1-8081-2) Servlet.service() for servlet jsp threw exception: java.lang.ClassCastException: com.comtec.ruleEngine.api.ApplicationData$$$view12 cannot be cast to org.omg.CORBA.Object

                          at org.jboss.com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:225) [jboss-rmi-api_1.0_spec-1.0.1.Final.jar:1.0.1.Final]

                          at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:158) [jboss-rmi-api_1.0_spec-1.0.1.Final.jar:1.0.1.Final]

                          at com.comtec.ruleEngine.utils.EJBHomeFactory.lookup(EJBHomeFactory.java:66) [classes:]

                          at com.comtec.ruleEngine.utils.SF.getEjb(SF.java:192) [classes:]

                          at com.comtec.ruleEngine.actions.LoginAction.doLogout(LoginAction.java:89) [classes:]

                          at com.comtec.ruleEngine.actions.LoginAction.<init>(LoginAction.java:46) [classes:]

                          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_26]

                          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0_26]

                          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0_26]

                          at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0_26]

                          at java.lang.Class.newInstance0(Class.java:355) [:1.6.0_26]

                          at java.lang.Class.newInstance(Class.java:308) [:1.6.0_26]

                          at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:188) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:67) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.ajax4jsf.taglib.html.jsp.KeepAliveTag.doStartTag(KeepAliveTag.java:113) [richfaces-ui-3.3.3.Final.jar:]

                          at org.apache.jsp.WEB_002dINF.tiles.bodies.homePage_jsp._jspx_meth_a4j_005fkeepAlive_005f0(homePage_jsp.java:138)

                          at org.apache.jsp.WEB_002dINF.tiles.bodies.homePage_jsp._jspService(homePage_jsp.java:100)

                          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:576) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:621) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:705) [tiles.jar:]

                          at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:816) [tiles.jar:]

                          at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:469) [tiles.jar:]

                          at org.apache.jsp.WEB_002dINF.tiles.layouts.generalLayout_jsp._jspx_meth_tiles_005finsert_005f1(generalLayout_jsp.java:599)

                          at org.apache.jsp.WEB_002dINF.tiles.layouts.generalLayout_jsp._jspx_meth_t_005fdiv_005f1(generalLayout_jsp.java:561)

                          at org.apache.jsp.WEB_002dINF.tiles.layouts.generalLayout_jsp._jspx_meth_t_005fdiv_005f0(generalLayout_jsp.java:496)

                          at org.apache.jsp.WEB_002dINF.tiles.layouts.generalLayout_jsp._jspx_meth_f_005fview_005f0(generalLayout_jsp.java:188)

                          at org.apache.jsp.WEB_002dINF.tiles.layouts.generalLayout_jsp._jspService(generalLayout_jsp.java:110)

                          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:576) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:621) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:705) [tiles.jar:]

                          at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:816) [tiles.jar:]

                          at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:469) [tiles.jar:]

                          at org.apache.jsp.homePage_jsp._jspx_meth_tiles_005finsert_005f0(homePage_jsp.java:91)

                          at org.apache.jsp.homePage_jsp._jspService(homePage_jsp.java:66)

                          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:363) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:194) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93) [tomahawk20-1.1.10.jar:]

                          at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) [richfaces-api-3.3.3.Final.jar:]

                          at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176) [richfaces-impl-jsf2-3.3.3.Final.jar:]

                          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.0.4-b09-jbossorg-4.jar:2.0.4-b09-jbossorg-4]

                          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:1.0.0.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl-jsf2-3.3.3.Final.jar:]

                          at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-jsf2-3.3.3.Final.jar:]

                          at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl-jsf2-3.3.3.Final.jar:]

                          at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl-jsf2-3.3.3.Final.jar:]

                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]

                          at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]

                          at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.1.Final]

                          at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]

                • 5. Re: JBoss AS 7.0.1 and EJB 3 lookup
                  wolfc

                  Ah yes, silly me. That trace won't give  any help. My bad.

                   

                  The problem lies in org.jboss.as.ee.component.ViewService$View$ViewInstance.createProxy. In case of a remote view it should create a proxy using the TCCL.

                  • 6. Re: JBoss AS 7.0.1 and EJB 3 lookup
                    paykin

                    How can I help you to help me?

                    Thank you

                    • 7. Re: JBoss AS 7.0.1 and EJB 3 lookup
                      paykin

                      I see the issue is not resolved in JBoss 7.0.2.Final : (

                      I recieved the same error.

                      • 8. Re: JBoss AS 7.0.1 and EJB 3 lookup
                        wolfc

                        Correct, the associated pull request has been rejected.

                        • 9. Re: JBoss AS 7.0.1 and EJB 3 lookup
                          paykin

                          Is there any way to solve it?

                          Thanks

                          • 10. Re: JBoss AS 7.0.1 and EJB 3 lookup
                            wolfc

                            Either pull in the request in your own development branch or wait for AS7-1939 to finish.

                            • 11. Re: JBoss AS 7.0.1 and EJB 3 lookup
                              rodakr

                              Hi

                               

                              I'm able to lookup with latest AS 7.0.x build version SLEJB using @EJB Annotation from WEB Container.

                              My question is, how can I lookup clustered SLEJB...?

                              In AS 6 there is Annotation import org.jboss.ejb3.annotation.Clustered  ( @Clustered ) which will do the job for HA-JNDI.

                              I can't find this Annotation in any of AS 7.0.x  jars...

                               

                              Any suggestions?