Bean already exists exception in weblogic

While deploying WAR file if you get below error and it fails to deploy, then follow below steps to fix the issue.

<Error> <J2EE> <BEA-160197> <Unable to load descriptor TEST.war/WEB-INF/web.xml of module TEST.war.

The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:161)
at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:323)
at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:788)
at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:409)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:759)
.
>
Caused by: com.bea.xml.XmlException: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "[email protected](/FilterMappings[[CompoundKey: SessionTimeoutFilter[Com
poundKey: ][CompoundKey: *.do]]])"
at com.bea.staxb.runtime.internal.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:54)
at com.bea.staxb.runtime.internal.RuntimeBindingType$BeanRuntimeProperty.setValue(RuntimeBindingType.java:536)
at com.bea.staxb.runtime.internal.AttributeRuntimeBindingType$QNameRuntimeProperty.fillCollection(AttributeRuntimeBindingType.java:381)
...
at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65)
at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:150)
... 121 more
Caused by: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "[email protected](/FilterMappings[[CompoundKey: SessionTimeoutFilter[CompoundKey: ][CompoundKey: *
.do]]])"
at weblogic.descriptor.internal.ReferenceManager.registerBean(ReferenceManager.java:227)
at weblogic.j2ee.descriptor.WebAppBeanImpl.setFilterMappings(WebAppBeanImpl.java:881)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.staxb.runtime.internal.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:48)
... 129 more
.
>


This is caused due to the duplicate <filter-mapping> in the web.xml file.

Eg:

<filter-mapping>

<filter-name>SessionTimeoutFilter</filter-name>
<url-pattern>*.do</url-pattern>

</filter-mapping>

<filter-mapping>

<filter-name>SessionTimeoutFilter</filter-name>
<url-pattern>*.do</url-pattern>

</filter-mapping>

Once we eliminate/remove the duplicated <filter-mapping> in the web.xml file. The issue will be resolved.

In case of any ┬ęCopyright or missing credits issue please check CopyRights page for faster resolutions.

3 Responses

  1. Abby says:

    Fine!! Thanks a lot, was a big help for me!!
    Good job!!

    Nice day.

  2. ronaldo says:

    What if you have two filter mappings, with different descriptors. one for forward and other for request. It shows me same exception. How do i get it resolved ?

Leave a Reply