警告:JSF1074:名为';bean';已经注册了

警告:JSF1074:名为';bean';已经注册了,jsf,annotations,managed-bean,Jsf,Annotations,Managed Bean,我使用的是MojarraJSF2.2 我们定义的豆子是基于Anotion的 @ManagedBean(name = "codeBean") @ViewScoped public class CodeRuleBean implements Serializable 我正在使用Tomcat7.0.53部署相同的功能。然而,我得到一个警告,说 警告:JSF1074:名为“codeBean”的托管bean已注册。将现有托管bean类类型com.myclass.rule.ui.CodeRuleBean替

我使用的是MojarraJSF2.2

我们定义的豆子是基于Anotion的

@ManagedBean(name = "codeBean")
@ViewScoped
public class CodeRuleBean implements Serializable
我正在使用Tomcat7.0.53部署相同的功能。然而,我得到一个警告,说

警告:JSF1074:名为“codeBean”的托管bean已注册。将现有托管bean类类型
com.myclass.rule.ui.CodeRuleBean
替换为
com.myclass.rule.ui.CodeRuleBean

faces config.xml
中没有。我正在使用
faces config.xml
来定义导航规则

<?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>

这是如何造成的,我如何解决它?

我想您已经为jsf空间注册了多个侦听器。过来看。如果web.xml中有
com.sun.faces.config.ConfigureListener
,请将其删除


因为
com.sun.faces.config.FacesInitializer
onStartup
方法上注册
com.sun.faces.config.ConfigureListener

发布你的faces配置和web.xml这是我的faces配置看不到它,请粘贴faces配置和web.xml刚刚编辑了问题。。请检查它是否可见。我收到的警告与所有豆子相同,不知道为什么。
<?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>