Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WARNING: JSF1074: Managed bean named 'bean' has already been registered

I'm using mojarra JSF 2.2.

The beans that we have defined are anotation based eg.

@ManagedBean(name = "codeBean")
@ViewScoped
public class CodeRuleBean implements Serializable

I am using tomcat 7.0.53 to deploy the same. However, I am getting a warning that says

WARNING: JSF1074: Managed bean named 'codeBean' has already been registered. Replacing existing managed bean class type com.myclass.rule.ui.CodeRuleBean with com.myclass.rule.ui.CodeRuleBean.

There is none in faces-config.xml. I am using faces-config.xml only to define the navigation rules.

<?xml version="1.0" encoding="UTF-8"?>

<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee \
              http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">


    <application>
        <navigation-handler>com.configurator.application.navigator.MyNavigator</navigation-handler>
    </application>

    <navigation-rule>
        <navigation-case>
            <from-outcome>codeRulePage</from-outcome>
            <to-view-id>/pages/rule/shortCodeMain.xhtml
            </to-view-id>
            <redirect />
            <to-flow-document-id />
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>/pages/rule/shortCodeMain.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>successPage</from-outcome>
            <to-view-id>/pages/rule/successCodeRule.xhtml
            </to-view-id>
        </navigation-case>
    </navigation-rule>
</<faces-config>

Here is the web.xml, it does not contain any web listeners.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>MyWeb</display-name>

    <context-param>
        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <filter-mapping>
        <filter-name>cachePreventionFilter</filter-name>
        <url-pattern>*.xhtml</url-pattern>
        <url-pattern>*.jsf</url-pattern>
        <url-pattern>*.jsp</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <servlet>
        <servlet-name>FacesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
</web-app>

How is this caused and how can I solve it?

like image 208
Ghosh Avatar asked May 27 '14 14:05

Ghosh


1 Answers

I think you have registered multiple listener for jsf space. Check it out. If you have com.sun.faces.config.ConfigureListener in your web.xml remove it.

Because com.sun.faces.config.FacesInitializer registers com.sun.faces.config.ConfigureListener on onStartup method.

like image 172
M.Sinan Şahin Avatar answered Dec 04 '22 19:12

M.Sinan Şahin