Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

spring applicationContext.xml文件中 引用db.properties 文件,找不到对应属性

我在springMVC项目中,applicationContext.xml文件中配置dataSource 的bean ,想要引用上面的db.properties文件里面配置的内容,但是报错:

控制台内容:

 Converted JNDI name [java:comp/env/jdbc.driver] not found - trying original name [jdbc.driver]. javax.naming.NameNotFoundException: 名称[jdbc.driver]未在此上下文中绑定。找不到[jdbc.driver]。
DEBUG [localhost-startStop-1] - Looking up JNDI object with name [jdbc.driver]
DEBUG [localhost-startStop-1] - JNDI lookup for name [jdbc.driver] threw NamingException with message: 名称[jdbc.driver]未在此上下文中绑定。找不到[jdbc.driver]。. Returning null.
DEBUG [localhost-startStop-1] - Found key 'jdbc.driver' in PropertySource 'localProperties' with value of type String
DEBUG [localhost-startStop-1] - Looking up JNDI object with name [java:comp/env/jdbc.url]
DEBUG [localhost-startStop-1] - Converted JNDI name [java:comp/env/jdbc.url] not found - trying original name [jdbc.url]. javax.naming.NameNotFoundException: 名称[jdbc.url]未在此上下文中绑定。找不到[jdbc.url]。
DEBUG [localhost-startStop-1] - Looking up JNDI object with name [jdbc.url]
DEBUG [localhost-startStop-1] - JNDI lookup for name [jdbc.url] threw NamingException with message: 名称[jdbc.url]未在此上下文中绑定。找不到[jdbc.url]。. Returning null.
DEBUG [localhost-startStop-1] - Found key 'jdbc.url' in PropertySource 'localProperties' with value of type String

applicatioContext.xml内容:

image.png

db.properties 内容:

image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...