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 ...
随机推荐
- openfire build
1. build path: a) source folder:包括openfire和各插件的代码. b) libraries:build/lib下jar包和插件下jar包,jdk/lib/tools ...
- 什么是Grunt
Grunt,简而言之,就是运行在Node.js上面的任务管理器(task runner),其可以在任何语言和项目中自动化指定的任务.我们可通过npm来安装Grunt和Grunt插件 为什么使用Grun ...
- 安装.NET Core 3.0预览版后VS项目目标框架中不显示的解决方法
下载了微软在GitHub上的cSharpSamples项目后发现其中一些项目使用框架为.NET Core3.0,就下载了.NET Core3.0,但发现项目依然不可用,编译时提示如下 当前 .net ...
- listen 59
Different Brain Regions Handle Different Music Types (Vivaldi) versus (the Beatles) . Both great. Bu ...
- 「LOJ#10042」「一本通 2.1 练习 8」收集雪花 (map
题目描述 不同的雪花往往有不同的形状.在北方的同学想将雪花收集起来,作为礼物送给在南方的同学们.一共有 n 个时刻,给出每个时刻下落雪花的形状,用不同的整数表示不同的形状.在收集的过程中,同学们不希望 ...
- Codeforces Round #394 (Div. 2) 颓废记
昨天晚上(今天凌晨),又忍不住去打CF.(本蒟弱到只能打Div.2)... 我觉得我可以用一个词概括我这次的CF: 呵呵 刚一开赛,我就codeforces访问失败.. 后来好不容易能上了,两三分钟才 ...
- 【C++基础】形参实参
c++规定:一个函数的默认实参既可以在定义中,也可在声明中指定,但在一个文件(准确的说,是一个作用域)中只能为一个形参指定默认实参一次
- Set_ML
参考资料:斯坦福(http://cs231n.github.io/linear-classify/:http://cs231n.stanford.edu/slides/2017/) Mastering ...
- Hive操作笔记
hive库清表,删除数据 insert overwrite table lorry.bigdata select * from lorry.bigdata where 1=0 hive的simple模 ...
- BZOJ3165:[HEOI2013]Segment
浅谈标记永久化:https://www.cnblogs.com/AKMer/p/10137227.html 题目传送门:https://www.lydsy.com/JudgeOnline/proble ...