首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

webroot路径有关问题?

2013-11-11 
webroot路径问题??bean idpropertyConfigurerclassorg.springframework.beans.factory.config.Prope

webroot路径问题??

<bean id="propertyConfigurer"  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">
            <value>/WEB-INF/classes/jdbc.properties</value>
        </property>
    </bean>


jdbc.properties和applicationContext.xml在同一目录下,怎么读不到??

action层

ApplicationContext ctx = 
new ClassPathXmlApplicationContext("applicationContext.xml");



Caused by: java.io.FileNotFoundException: class path resource [WEB-INF/classes/jdbc.properties] cannot be opened because it does not exist
[解决办法]
你检查过这个位置没有?

/WEB-INF/classes/jdbc.properties
[解决办法]
既然是在classes,实在不行就直接:
<value>classpath:jdbc.properties</value>


[解决办法]
<!-- 数据源的properties配置导入 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
[解决办法]
ApplicationContext ctx =  
new ClassPathXmlApplicationContext("applicationContext.xml");
 可以换种方式

热点排行