tomcat jndi 数据源
web.xml
<!-- ================================================================================ -->
<!-- jndi configure -->
<!-- ================================================================================ -->
<resource-ref> <!-- adapt weblogic server -->
<res-ref-name>jndi_base</res-ref-name>
<res-auth>Container</res-auth>
<mapped-name>jndi_wmsc</mapped-name>
</resource-ref>
webapp文件夹下META-INF文件夹下context.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context> <!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
--> <!-- Uncomment this to enable Comet connection tacking (provides events
on session expiration as well as webapp lifecycle) -->
<!--
<Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
-->
<!--测试环境YD_SERVER数据库连接地址 -->
<Resource name="jndi_wmsc" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="ggs" password="mxDUF6IgMjEq3ClI" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://10.19.105.234:3306/wmsc?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull" />
</Context>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd"> <mvc:annotation-driven />
<tx:annotation-driven transaction-manager="transactionManager" />
<aop:aspectj-autoproxy proxy-target-class="true"/> <!-- JNDI数据源-->
<jee:jndi-lookup id="dataSource" jndi-name="jndi_wmsc" resource-ref="true"/> <!-- SPRING JDBC -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
<constructor-arg ref="dataSource"/>
</bean> <!-- SPRING 事务管理-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean> </beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd"> <import resource="spring-quartz.xml"/> <mvc:annotation-driven />
<tx:annotation-driven transaction-manager="transactionManager" />
<task:annotation-driven/>
<aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 加载配置文件-->
<!-- <context:property-placeholder location="classpath:config.properties"/> --> <!-- JNDI数据源-->
<jee:jndi-lookup id="dataSource" jndi-name="jndi_wmsc" resource-ref="true"/> <!-- SPRING JDBC -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
<constructor-arg ref="dataSource"/>
</bean> <!-- SPRING 事务管理-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean> <!-- 应用上线文初始化Bean-->
<bean class="com.yd.common.runtime.CIPRuntimeContextInitializer" /> <!-- dao,service,controller,component scan -->
<!-- <context:component-scan base-package="com.yd.wmsc" />
<context:component-scan base-package="com.yd.common.function" />
<context:component-scan base-package="com.yd.common.auth" /> --> <context:component-scan base-package="com.yd.wmsc,com.yd.common.function,com.yd.common.auth" >
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller"/>
</context:component-scan> </beans>
tomcat jndi 数据源的更多相关文章
- Linux - tomcat -jndi数据源配置
Linux - tomcat -jndi数据源配置 tomcat/conf/context .xml 文件中修改如下 <Resource name="/jdbc/--" au ...
- Hibernate Tomcat JNDI数据源配置(转)
简述: 配置JNDI 查找Tomcat 中server.xml中定义的数据源 步骤: 1. 修改elipse的数据源server.xml 主要修改如下, 1. 添加下面这段Context文本 其中St ...
- 配置Tomcat JNDI数据源
原文地址:http://my.oschina.net/xiaomaoandhong/blog/74584 先记录在此,按照博文未配置成功
- Spring+Tomcat的JNDI数据源连接池简单配置
使用Tomcat JNDI数据源与Spring一起使用步骤如下: 1.将数据库驱动复制到Tomcat的lib文件夹下面 2.配置Tomcat的server.xml配置文件,在GlobalNamingR ...
- Tomcat下使用c3p0配置jndi数据源
下载c3p0包: 下载地址:https://sourceforge.net/projects/c3p0/files/?source=navbar 解压后得到包:c3p0-0.9.2.jar,mchan ...
- 为tomcat动态添加jndi数据源信息
我们在开发项目的时候,总要和数据库打交道,如何获取数据源,以什么样的方式来获取,成为了我们即简单又熟悉而且不得不注意的一个问题. 那么在这里我说三种获取数据源的常用方式: 一.通过配置文件来获取 首先 ...
- Tomcat 6 JNDI数据源详解
数据库连接池这个概念应该都不陌生,在Java中连接池也就是数据库的连接池,它是一种采用连接复用的思想避免多次连接造成资源的浪费机制. 最常见的连接池就是DBCP和C30P了,在tomcat中默认使用的 ...
- JNDI学习总结(三)——Tomcat下使用Druid配置JNDI数据源
com.alibaba.druid.pool.DruidDataSourceFactory实现了javax.naming.spi.ObjectFactory,可以作为JNDI数据源来配置. 一.下载D ...
- Tomcat中配置JNDI数据源
准备工作: Tomcat版本:tomcat6.0以上 下例中均使用MySQL数据库 将对应数据源的jar包和MySQL的驱动包拷贝至tomcat的lib文件夹下 一.全局数据源 1步骤一:配置 在to ...
随机推荐
- html5--1.3 元素的概念与3个常用标签
html5--1.3 元素的概念与3个常用标签 学习要点 1.元素的概念 2.3个常用的标签 HTML 元素指的是从开始标签到结束标签的所有代码. 开始标签 元素内容 结束标签 <h1> ...
- 开机时遇到grub rescue无法进入系统的解决方法
装双系统(win10和elementary os),elementary os是ubuntu的一个分支.在win10中合并了一块空白磁盘分区,再开机的时候出问题了. 遇到filesystem unkn ...
- [Android Studio] Android Studio快速定位当前打开的文件在哪个目录(package)下
转载自:http://blog.csdn.net/hyr83960944/article/details/38067499 在Eclipse中有一个很好的功能,就是比如我打开一个AActivity,左 ...
- Web 攻击之 XSS 攻击及防御策略
XSS 攻击 介绍 XSS 攻击,从最初 netscap 推出 javascript 时,就已经察觉到了危险. 我们常常需要面临跨域的解决方案,其实同源策略是保护我们的网站.糟糕的跨域会带来危险,虽然 ...
- SpringBoot 版本升级后报错 Cannot instantiate interface org.springframework.context.ApplicationContextInitializer
本篇博客纯粹讲我遇到这个问题的解决以及思考,如果你想知道解决方法,可以直接看正确解决方案部分.因为是前端写的,所以可能有些明显的内容很容易就看出来了. 首先:升级后更新其他依赖,以及Applicati ...
- ACM学习历程——UVA10112 Myacm Triangles(计算几何,多边形与点的包含关系)
Description Problem B: Myacm Triangles Problem B: Myacm Triangles Source file: triangle.{c, cpp, j ...
- 【Lintcode】011.Search Range in Binary Search Tree
题目: Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Find a ...
- TTS API 使用
#define SPCAT_VOICES L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices" ...
- requests.session保持会话
原文地址:https://blog.csdn.net/jyh_jack/article/details/82457953 如何使用requests后登录网站后,保持Session继续实现浏览.下载等效 ...
- git repo