tomcat - 严重 : Exception sending context initialized event to listener

标签 tomcat netbeans

我在 netbeans 中添加了 Apache tomcat 服务器,当我尝试运行该服务器时,日志中显示以下错误。

Jun 05, 2013 11:38:52 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jun 05, 2013 11:39:15 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: \opt\tej2\resources\config\db.properties (The system cannot find the path specified)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:638)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:530)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1471)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

...
...

Caused by: java.io.FileNotFoundException: \opt\tej2\resources\config\db.properties (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:124)
at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:181)
at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
... 46 more

我不知道该怎么办。请帮帮我。

更新:这里是 pom.xml 中的 Spring 依赖项

<!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>org.springframework.spring-library</artifactId>
        <type>libd</type>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- SPRING SECURITY -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-acl</artifactId>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>2.2</version>
    </dependency>

最佳答案

Tomcat 服务器上可能部署了一些使用Spring 框架的Web 应用程序。在这个 Spring 框架的配置中引用了属性文件:

\opt\tej2\resources\config\db.properties

但此文件可能丢失,因此 Spring 框架无法初始化。

尽管如此,Tomcat 服务器应该运行正常。只有带有spring框架的特定Web应用启动失败。

关于tomcat - 严重 : Exception sending context initialized event to listener,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16934660/

相关文章:

tomcat - Windows下的Apache Tomcat : Changing webapps default directory

java - Jhipster apache tomcat 安装

tomcat - 在 tomcat 外部服务器中部署 spring boot restful api 时出错

java - 使用 JPA、Maven 和 Tomcat,但出现 java.lang.NoClassDefFoundError : javax/persistence/Persistence

java - [修复和改进]通过按钮操作替换文件中的行

eclipse - Eclipse 上未显示 Tomcat

netbeans - 在Netbeans 8.2编辑器中查找下一个和上一个错误的键盘快捷方式是什么?

java - 我如何更改机器生成的代码

netbeans - 如何在 NetBeans IDE 中使用 Go 语言?

java - JDBC 部署错误 - NoClassDefFounderror