Uploaded image for project: 'Seam Faces'
  1. Seam Faces
  2. SEAMFACES-55

@WebServices look up EJB's on every single http request (not only webservice requests)

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0.Alpha3
    • Fix Version/s: Future
    • Component/s: CDI Integration
    • Labels:
      None
    • Environment:

      Glassfish 3.0.1 on Windows 7 64 bit, 32 bit jvm (1.6.0_20)

      Description

      After splitting our application into frontend (JSF2) and backend (EJB3.1 remote) modules running on different servers, performance in the application became horrible. Rendering an empty JSF page took about 3 seconds.

      It turned out that because of 3 @WebService annotated beans with remote @EJB's injected, lots of traffic goes to the backend server on every http request (to JSF pages, css, js etc). We don't know exactly what this traffic is, but adding breakpoints in @PostConstruct methods in the webservices showed that they are not being instantiated.

      After removing seam-faces the problems went away. And if we annotate the webservices with @Stateless they also went away. So we have a workaround, but would like to know if this issue could affect other areas as well. Performance is still sub par.

      More info here:
      http://seamframework.org/Community/SeamFaces300Alpha3WeirdButSeriousPerformanceIssue

      I have created some webapps to reproduce the problems:
      faces-server: webapp with a remote ejb EchoService
      faces-client: webapp with an empty jsf page (meaning just plain text) and an EchoWebService that injects EchoService using @EJB
      faces-client-seamfaces: identical to the one above but with seam-faces-3.0.0.Alpha3 in WEB-INF/lib. And different name obviously.

      Steps to reproduce problem (on Glassfish 3.0.1 at least):

      • Deploy faces-server first, and then both faces-client and faces-client-seamfaces.
      • Open /faces-client/empty.xhtml and /faces-client-seamfaces/empty.xhtml. Rendering the first one takes about 4-6ms, the second one takes 60-80ms.
      • Undeploy faces-server and try to reload the pages. The first one still works, the second one gives an exception:

      [#|2010-10-22T10:04:35.241+0200|WARNING|glassfish3.0.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=26;_ThreadName=Thread-1;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
      java.lang.IllegalStateException: Could not wrap ExternalContext
      at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:35)
      at com.sun.faces.context.InjectionExternalContextFactory.getExternalContext(InjectionExternalContextFactory.java:109)
      at com.sun.faces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:93)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:302)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session into class org.jboss.seam.faces.environment.SeamExternalContext
      at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:133)
      at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:47)
      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:171)
      at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:142)
      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:165)
      at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:332)
      at org.jboss.weld.context.AbstractMapContext.get(AbstractMapContext.java:112)
      at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:143)
      at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:100)
      at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
      at org.jboss.seam.faces.environment.SeamExternalContext_$$javassist_21.setWrapped(SeamExternalContext$$_javassist_21.java)
      at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:29)
      ... 27 more
      Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session into class org.jboss.seam.faces.environment.SeamExternalContext
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:614)
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:384)
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:168)
      at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:126)
      ... 38 more
      Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/EchoService' in SerialContext [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'com.example.EchoService#com.example.EchoService' Root exception is javax.naming.NamingException: Lookup failed for 'com.example.EchoService#com.example.EchoService' in SerialContext [Root exception is javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found]]
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:513)
      ... 41 more
      Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'com.example.EchoService#com.example.EchoService' Root exception is javax.naming.NamingException: Lookup failed for 'com.example.EchoService#com.example.EchoService' in SerialContext [Root exception is javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found]
      at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:174)
      at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1040)
      at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:688)
      at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:657)
      at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:148)
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:428)
      ... 43 more
      Caused by: javax.naming.NamingException: Lookup failed for 'com.example.EchoService#com.example.EchoService' in SerialContext Root exception is javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:169)
      ... 48 more
      Caused by: javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found
      at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:197)
      at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:168)
      at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)
      at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:101)
      at com.sun.enterprise.naming.interprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
      ... 50 more

      #]

      [#|2010-10-22T10:04:35.241+0200|WARNING|glassfish3.0.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=26;_ThreadName=http-thread-pool-18080-(1);|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
      java.lang.IllegalStateException: Could not wrap ExternalContext
      at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:35)
      at com.sun.faces.context.InjectionExternalContextFactory.getExternalContext(InjectionExternalContextFactory.java:109)
      at com.sun.faces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:93)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:302)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session into class org.jboss.seam.faces.environment.SeamExternalContext
      at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:133)
      at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:47)
      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:171)
      at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:142)
      at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:165)
      at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:332)
      at org.jboss.weld.context.AbstractMapContext.get(AbstractMapContext.java:112)
      at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:143)
      at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:100)
      at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
      at org.jboss.seam.faces.environment.SeamExternalContext_$$javassist_21.setWrapped(SeamExternalContext$$_javassist_21.java)
      at org.jboss.seam.faces.environment.SeamExternalContextFactory.getExternalContext(SeamExternalContextFactory.java:29)
      ... 27 more
      Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session into class org.jboss.seam.faces.environment.SeamExternalContext
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:614)
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:384)
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:168)
      at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:126)
      ... 38 more
      Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/EchoService' in SerialContext [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'com.example.EchoService#com.example.EchoService' Root exception is javax.naming.NamingException: Lookup failed for 'com.example.EchoService#com.example.EchoService' in SerialContext [Root exception is javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found]]
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:513)
      ... 41 more
      Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=EchoService,Remote 3.x interface =com.example.EchoService,ejb-link=null,lookup=null,mappedName=,jndi-name=com.example.EchoService,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'com.example.EchoService#com.example.EchoService' Root exception is javax.naming.NamingException: Lookup failed for 'com.example.EchoService#com.example.EchoService' in SerialContext [Root exception is javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found]
      at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:174)
      at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1040)
      at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:688)
      at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:657)
      at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:148)
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:428)
      ... 43 more
      Caused by: javax.naming.NamingException: Lookup failed for 'com.example.EchoService#com.example.EchoService' in SerialContext Root exception is javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:169)
      ... 48 more
      Caused by: javax.naming.NameNotFoundException: com.example.EchoService#com.example.EchoService not found
      at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:197)
      at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:168)
      at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:58)
      at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:101)
      at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430)
      ... 50 more

      #]

      mpl.SerialContext.lookup(SerialContext.java:430)
      ... 50 more

      #]

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                andersaa Anders Åberg
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: