PrettyFaces 的重复映射 ID
我正在使用 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类
请指教。
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
my mappings is as follows:
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 {
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
this line is repeated twice for LoginBean, is it the problem ?
Bytecode filter recommends to scan class LoginBean
please advise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请确保您的 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.