9 Replies Latest reply on Nov 23, 2011 5:02 AM by Prasad Deshpande

    Remote EJB lookup in WAR file

    Prasad Deshpande Expert

      Hu Guys,

       

      I've got following piece of code where I'm lookingup for a remote interface from a WAR. WAR & ejb both are part of same EAR.

       

      PropertyManager p = (PropertyManager) mContext.lookup("java:global/efp/efprocess/PropertyManager");

       

      This throws me an exception :

      15:50:08,630 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1) java.lang.ClassCastException: $Proxy125 cannot be cast to com.banctec.caseware.server.propertymanager.PropertyManager

       

      This used to work in AS 7.0.1, I was wondering, since remoting is now introduced, is it because of which lookup for remote interfaces from the same application is not allowed anymore? If so, how do I lookup for remote interface in war that is part of same EAR as EJB's?

       

      Thank you,

      Prasad

        • 1. Re: Remote EJB lookup in WAR file
          Prasad Deshpande Expert

          Basically bean only has remote interface & is been looked-up from a helper class so I can't use injection either. Any workaround?

          • 3. Re: Remote EJB lookup in WAR file
            jaikiran pai Master

            Can you please post the entire excpetion stacktrace and also a bit more details on the packaging? If possible please attach a application that reproduces this.

            • 4. Re: Remote EJB lookup in WAR file
              Prasad Deshpande Expert

              I'll need some time to get a sample app ready, but in the meanwhile, here is the complete stacktrace. I've also attached server.log with this one

               

              Thanks,

              Prasad

               

              10:49:55,716 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1) java.lang.ClassCastException: $Proxy125 cannot be cast to com.banctec.caseware.server.propertymanager.PropertyManager

              10:49:55,716 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.client.api.API.createPropertyManager(API.java:3085)

              10:49:55,716 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.client.api.API.login(API.java:437)

              10:49:55,716 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.components.common.WorkplaceController.login(WorkplaceController.java:922)

              10:49:55,716 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.components.workplace.functions.LogonFunction.executeFunction(LogonFunction.java:119)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.components.workplace.functions.ApplicationController.performLogon(ApplicationController.java:2816)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.components.workplace.functions.ApplicationController.executeFunction(ApplicationController.java:137)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.components.framework.web.WorkplaceAction.execute(WorkplaceAction.java:175)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at com.banctec.caseware.components.common.WorkplaceFilter.doFilter(WorkplaceFilter.java:194)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

              10:49:55,732 ERROR [stderr] (http-0.0.0.0-0.0.0.0-8080-1)     at java.lang.Thread.run(Thread.java:662)

              • 5. Re: Remote EJB lookup in WAR file
                Prasad Deshpande Expert

                turned out to be typical reason of having a copy of remote interface in WAR/lib too along with lib directory of EAR. Due to which error was thrown.

                • 6. Re: Remote EJB lookup in WAR file
                  Stephen Coy Master

                  The container is required to make all EJB interfaces available to WAR files within the same EAR. Therefore the idea of having a "client" jar in either the WEB-INF/lib or ear-file/lib is likely to be redundant in your case.

                   

                  Is there any particular reason that you're not using local interfaces, rather than remote?

                  • 7. Re: Remote EJB lookup in WAR file
                    Prasad Deshpande Expert

                    Just because, that war file can be used as a standalone application & be deployed on it's own.. so we have choice of either embedding in EAR or running standalone mode.

                    • 8. Re: Remote EJB lookup in WAR file
                      Stephen Coy Master

                      That could be tricky then, because the standalone version will need access to the interface classes somehow.

                       

                      You may need to build different standalone and embeddable WARs.

                      • 9. Re: Remote EJB lookup in WAR file
                        Prasad Deshpande Expert

                        yes, I've already changed my build yesterday when I found that error. Without that change it worked in 7.0.1 but not in nightly builds, so I guess 7.0.1 release had some bug on classloading which seems be resolved in 7.1 beta nightly build, due to which this problem was highlighted in first place. I agree, that container should make EJB interfaces available to WAR within same EAR.