Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
集成jsf2.1Spring4_Spring_Hibernate_Jsf_Jakarta Ee_Web - Fatal编程技术网

集成jsf2.1Spring4

集成jsf2.1Spring4,spring,hibernate,jsf,jakarta-ee,web,Spring,Hibernate,Jsf,Jakarta Ee,Web,正如标题所说,我想将Spring与JSF和Spring安全性集成在一起。。。 我现在遇到的问题是,当我打开web.xml org.springframework.web.context.ContextLoaderListener时,我无法运行索引页 尽管我在faces-config.xml中声明了org.springframework.web.jsf.el.SpringBeanFacesELRe解算器。 这是堆栈的一部分: mai 11, 2014 5:03:55 PM org.apache.c

正如标题所说,我想将Spring与JSF和Spring安全性集成在一起。。。 我现在遇到的问题是,当我打开web.xml org.springframework.web.context.ContextLoaderListener时,我无法运行索引页 尽管我在faces-config.xml中声明了org.springframework.web.jsf.el.SpringBeanFacesELRe解算器。 这是堆栈的一部分:

mai 11, 2014 5:03:55 PM org.apache.catalina.core.AprLifecycleListener init
    Infos: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\app\Ayman\product\11.2.0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\7-Zip;.
    mai 11, 2014 5:03:55 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    Avertissement: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:monProjet' did not find a matching property.
    mai 11, 2014 5:03:55 PM org.apache.coyote.AbstractProtocol init
    Infos: Initializing ProtocolHandler ["http-bio-5050"]
    mai 11, 2014 5:03:55 PM org.apache.coyote.AbstractProtocol init
    Infos: Initializing ProtocolHandler ["ajp-bio-8009"]
    mai 11, 2014 5:03:55 PM org.apache.catalina.startup.Catalina load
    Infos: Initialization processed in 361 ms
    mai 11, 2014 5:03:55 PM org.apache.catalina.core.StandardService startInternal
    Infos: Démarrage du service Catalina
    mai 11, 2014 5:03:55 PM org.apache.catalina.core.StandardEngine startInternal
    Infos: Starting Servlet Engine: Apache Tomcat/7.0.53
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/C:/Users/Ayman/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/monProjet/WEB-INF/lib/slf4j-jdk14-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/C:/Users/Ayman/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/monProjet/WEB-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
    SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6]
    SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
    mai 11, 2014 5:03:59 PM org.apache.catalina.core.ApplicationContext log
    Infos: Initializing Spring root WebApplicationContext
    mai 11, 2014 5:03:59 PM org.apache.catalina.core.StandardContext listenerStart
    Grave: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
    java.lang.AbstractMethodError: org.slf4j.impl.JDK14LoggerAdapter.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:194)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

    mai 11, 2014 5:03:59 PM com.sun.faces.config.ConfigureListener contextInitialized
    Infos: Initialisation de Mojarra 2.2.2 ( 20130809-1625 https://svn.java.net/svn/mojarra~svn/tags/2.2.2@12376) pour le contexte «/monProjet»
    mai 11, 2014 5:03:59 PM com.sun.faces.spi.InjectionProviderFactory createInstance
    Infos: JSF1048 : Présence d’annotations PostConstruct/PreDestroy  Les méthodes de beans gérés marquées avec ces annotations auront des annotations dites traitées.
    mai 11, 2014 5:03:59 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
    Infos: Running on PrimeFaces 3.5
    mai 11, 2014 5:03:59 PM org.apache.catalina.core.StandardContext startInternal
    Grave: Error listenerStart
    mai 11, 2014 5:04:00 PM org.apache.catalina.core.StandardContext startInternal
    Grave: Erreur de démarrage du contexte [/monProjet] suite aux erreurs précédentes
    mai 11, 2014 5:04:00 PM org.apache.catalina.core.ApplicationContext log
    Infos: Closing Spring root WebApplicationContext
    mai 11, 2014 5:04:00 PM org.apache.coyote.AbstractProtocol start
    Infos: Starting ProtocolHandler ["http-bio-5050"]
    mai 11, 2014 5:04:00 PM org.apache.coyote.AbstractProtocol start
    Infos: Starting ProtocolHandler ["ajp-bio-8009"]
    mai 11, 2014 5:04:00 PM org.apache.catalina.startup.Catalina start
    Infos: Server startup in 4527 ms
这是web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener
        </listener-class>
    </listener>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <servlet>
        <description>generated-servlet</description>
        <servlet-name>Final Servlet</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:applicationContext.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
  <!-- Welcome page -->
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <!-- JSF 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>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>facesServlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>

</web-app>

org.springframework.web.context.request.RequestContextListener
org.springframework.web.context.ContextLoaderListener
生成的servlet
最终Servlet
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
classpath*:applicationContext.xml
1.
index.jsp
小脸蛋
javax.faces.webapp.FacesServlet
1.
小脸蛋
*.jsf
小脸蛋
*.xhtml

问题

这不一定是JSF/Spring问题,因为这是一个SLF4J库不兼容问题。警告标志如下:

  • 首先是SLF4J警告:

    SLF4J: Class path contains multiple SLF4J bindings.
    
  • 然后是日志输出,显示冲突LIB的位置:

    SLF4J: Found binding in [jar:file:/C:/Users/Ayman/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/monProjet/WEB-INF/lib/slf4j-jdk14-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/C:/Users/Ayman/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/monProjet/WEB-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    
  • SL4J自动选择一个绑定

    Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
    
  • 然后是破坏一切的警告/错误:

    SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6]
    
  • 然后是上下文加载程序侦听器错误,这是前两个警告的结果:

    Grave: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
    java.lang.AbstractMethodError: org.slf4j.impl.JDK14LoggerAdapter.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    
  • SLF4J绑定的1.5.8版本(
    SLF4J-jdk14-1.5.8.jar
    )与SLF4J api的版本之间存在不兼容


    解决问题

    您需要将SLF4J api的版本降低到1.5.8。或者将绑定的版本更新为1.6