簡體   English   中英

找不到Servlet上下文:NetBeans中的Spring 4 Hibernate 4 Maven JSF PrimeFaces

[英]Servlet-Context not found : Spring 4 Hibernate 4 Maven JSF PrimeFaces in NetBeans

首先:-我是J2e的非常初學者,並且這種組合對於功能強大的應用程序幾乎是完美的,但對於打擊J2e入門者也非常理想。 -我搜索了很多答案,沒有,沒有一個人糾正了這個問題。

就這么簡單:-我在Netbeans 8和Eclipse Mars之間重復創建了8次該應用程序,我有很多經驗。 問題出在Servlet-Context上。 Tomcat引發FileNotFound錯誤,一旦刪除此錯誤:

    <listener>
   <listener-class>
           org.springframework.web.context.ContextLoaderListener
   </listener-class>
 </listener>
 <listener>
   <listener-class>
           org.springframework.web.context.request.RequestContextListener
   </listener-class>
</listener>

它可以正常工作,但不會顯示數據庫中的數據,(我現在的整個應用程序是在數據庫上顯示id = 1的用戶id。)

Tomcat中的錯誤:

    org.apache.catalina.core.StandardContext.listenerStart 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
 org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

誰能幫忙嗎?

嘗試將contextConfigLocation添加到web.xml中,以便它可以找到applicationContext.xml文件。

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
</context-param>
     <listener>
   <listener-class>
           org.springframework.web.context.request.RequestContextListener
   </listener-class>
</listener>

刪除此功能即可。 春季4問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM