开始: - 我是 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>
关于java - 未找到 Servlet-Context : Spring 4 Hibernate 4 Maven JSF PrimeFaces in NetBeans,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32147782/