与PrettyFaces重复的映射ID

时间:2011-10-13 18:33:13

标签: jsf-2 prettyfaces

我正在使用 PrettyFaces 3.3.0 Spring Security 3 我有两个bean UserBean ,它被映射为服务于页面(用户,添加) 和 LoginBean 来提供登录页面

我的映射如下:

1- UserBean:

@Component("user")
@Scope("request")
@URLMappings(mappings = {
        @URLMapping(id = "users", pattern = "/users", viewId = "/faces/users.xhtml"),
        @URLMapping(id = "add", pattern = "/add", viewId = "/faces/add.xhtml") })
public class UserBean {

2- LoginBean:

@Component("login")
@Scope("request")
@URLMapping(id = "login", pattern = "/login", viewId = "/faces/login.xhtml")
public class LoginBean {

但是当我尝试运行该应用程序时 我得到以下异常(我在异常之前和之后添加了一些调试):

DEBUG [main] (FacesConfigBeanNameResolver.java:110) - Found 0 bean names in faces configuration.
DEBUG [main] (CDIBeanNameResolver.java:127) - BeanManager or Bean class not found. CDI resolver has been disabled.
DEBUG [main] (SpringBeanNameResolver.java:95) - Spring detected. Enabling Spring bean name resolving.
DEBUG [main] (SeamBeanNameResolver.java:90) - Seam class has not been found. Seam resolver will be disabled.
DEBUG [main] (AbstractClassFinder.java:200) - Bytecode filter recommends to scan class: myapp.beans.LoginBean
DEBUG [main] (AbstractClassFinder.java:200) - Bytecode filter recommends to scan class: myapp.beans.UserBean


com.ocpsoft.pretty.PrettyException: Failed to load configuration.
    at com.ocpsoft.pretty.faces.config.PrettyConfigurator.configure(PrettyConfigurator.java:90)
    at com.ocpsoft.pretty.PrettyFilter.init(PrettyFilter.java:305)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.IllegalArgumentException: Duplicated mapping id: login
    at com.ocpsoft.pretty.faces.config.annotation.PrettyAnnotationHandler.processPrettyMappingAnnotation(PrettyAnnotationHandler.java:209)
    at com.ocpsoft.pretty.faces.config.annotation.PrettyAnnotationHandler.processClassMappingAnnotations(PrettyAnnotationHandler.java:154)
    at com.ocpsoft.pretty.faces.config.annotation.PrettyAnnotationHandler.processClass(PrettyAnnotationHandler.java:109)
    at com.ocpsoft.pretty.faces.config.annotation.AbstractClassFinder.processClass(AbstractClassFinder.java:219)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:154)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.processDirectory(WebClassesFinder.java:183)
    at com.ocpsoft.pretty.faces.config.annotation.WebClassesFinder.findClasses(WebClassesFinder.java:68)
    at com.ocpsoft.pretty.faces.config.spi.AnnotationConfigurationProvider.loadConfiguration(AnnotationConfigurationProvider.java:82)
    at com.ocpsoft.pretty.faces.config.PrettyConfigurator.configure(PrettyConfigurator.java:63)
    ... 19 more

DEBUG [main] (AbstractClassFinder.java:200) - Bytecode filter recommends to scan class: myapp.LoginBean

对于LoginBean,此行重复两次,这是问题吗?

字节码过滤器建议扫描类LoginBean

请告知。

1 个答案:

答案 0 :(得分:1)

请确保您的IDE /构建工具没有将重复的类文件放入Web应用程序输出目录中。这很可能是原因。我也相信这个问题已在PrettyFaces类扫描程序中得到解决,但错误在构建中。