与PrettyFaces复制的映射ID [英] Duplicated mapping id with PrettyFaces

查看:95
本文介绍了与PrettyFaces复制的映射ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Spring Security 3 中使用了 PrettyFaces 3.3.0 我有两个 UserBean 豆,它们被映射为投放到页面(用户,添加) 和 LoginBean 来提供登录页面

i am using PrettyFaces 3.3.0 with Spring Security 3 i have two beans UserBean which is mapped to serve to pages (users,add) and LoginBean to serve the login page

我的映射如下:

1- UserBean:

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:

2- LoginBean:

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

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

but when i try to run the application i am getting the following exception (i added some debugs before and after the exception):

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重复两次,这是问题吗?

this line is repeated twice for LoginBean, is it the problem ?

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

请告知.

推荐答案

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

Please make sure that your IDE/build tool is not putting duplicated class files into your web application output directory. This is most likely the cause. I also believe this issue has been addressed in the PrettyFaces class scanner, but the fault is in the build.

这篇关于与PrettyFaces复制的映射ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆