You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Benjamin Mueller (JIRA)" <ji...@apache.org> on 2017/03/31 13:12:41 UTC

[jira] [Created] (OWB-1175) Duplicate registration of ServletContextBean

Benjamin Mueller created OWB-1175:
-------------------------------------

             Summary: Duplicate registration of ServletContextBean
                 Key: OWB-1175
                 URL: https://issues.apache.org/jira/browse/OWB-1175
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Web
    Affects Versions: 1.7.2
            Reporter: Benjamin Mueller


After updating to 1.7.2 (from 1.6.3) my application on Tomcat 8 stopped working.

It configures both the WebBeansConfigurationListener and WebBeansConfigurationFilter in web.xml
{code:xml}
<listener>
	<listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
</listener>

<filter>
	<filter-name>WebBeansConfigurationFilter</filter-name>
	<filter-class>org.apache.webbeans.servlet.WebBeansConfigurationFilter</filter-class>
</filter>

<filter-mapping>
	<filter-name>WebBeansConfigurationFilter</filter-name>
	<url-pattern>/*</url-pattern>
	<dispatcher>FORWARD</dispatcher>
</filter-mapping>
{code}

I need this setup to handle requests being forwarded by a different webapp (with cross-context).

When starting, Open-Webbeans fails now with:

{noformat}
SCHWERWIEGEND: Exception starting filter WebBeansConfigurationFilter
org.apache.webbeans.exception.DuplicateDefinitionException: PassivationCapable bean id is not unique: SERVLET_CONTEXT#interface javax.servlet.ServletContext#@javax.enterprise.inject.Default(),@javax.enterprise.inject.Any(), bean:ServletContext, WebBeansType:SERVLET_CONTEXT, Name:null, API Types:[java.lang.Object,javax.servlet.ServletContext], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
	at org.apache.webbeans.container.BeanManagerImpl.addPassivationInfo(BeanManagerImpl.java:411)
	at org.apache.webbeans.container.BeanManagerImpl.addInternalBean(BeanManagerImpl.java:365)
	at org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:90)
	at org.apache.webbeans.servlet.WebBeansConfigurationFilter.init(WebBeansConfigurationFilter.java:90)
{noformat}

This is probably due to WebContainerLifecycle#startApplication, which does not first check if it is already started before it adds the ServletContextBean (again) in contrast to AbstractLifecycle#startApplication (bootstrapApplication).




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)