`
honley
  • 浏览: 117201 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

 
阅读更多

如上错误,原因可能是在context.xml配置数据源后,需要在web.xml里添加引用。

context.xml里的配置是

<Resource name="jdbc/security" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" 

        username="test" password="test" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1:3306/test" /> 

 

web.xml需要加上:

  <resource-ref>

      <description>My DataSource Reference</description>

      <res-ref-name>jdbc/security</res-ref-name>

      <res-type>javax.sql.DataSource</res-type>

      <res-auth>Container</res-auth>

      <res-sharing-scope>Shareable</res-sharing-scope>

  </resource-ref>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics