Tomcat 6 部署工程总结,使用JNDI数据源配置
<Resource name="ipeerDs" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="ipeer_new" password="passw0rd!" driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@1.1.1.1:1555:dbname"/>
</Context>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="localhost_oracle" transaction-type="JTA">
<description>generated-persistence-unit</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!-- jboss need -->
<!-- <jta-data-source>java:/ipeerDs</jta-data-source> -->
<class>com.iproject.core.domain.Authorities</class>
<class>com.iproject.core.domain.Users</class>
<class>com.iproject.core.domain.TSysFunction</class>
<class>com.iproject.core.domain.TSysLog</class>
<class>com.iproject.core.domain.TSysSeriano</class>
<class>com.iproject.core.domain.TBicAgtPrmInfo</class>
<class>com.iproject.core.domain.TBicFinChargebill</class>
<class>com.iproject.core.domain.TSysDept</class>
<class>com.iproject.core.domain.Domain</class>
<class>com.iproject.core.domain.DomainValue</class>
<class>com.iproject.core.domain.TBicPrdTyp</class>
<class>com.iproject.core.domain.TBicCancelInfo</class>
<class>com.iproject.core.domain.SynchronizationTask</class>
<class>com.iproject.core.domain.ProcessDefinition</class>
<class>com.iproject.core.domain.ProcessInstance</class>
<class>com.iproject.core.domain.TBicPrmPlyRel</class>
<class>com.iproject.core.domain.TBicPrmPlyRelId</class>
<class>com.iproject.core.domain.TBicResConfig</class>
<class>com.iproject.core.domain.TBicLog</class>
<class>com.iproject.core.domain.TBicEmp</class>
<class>com.iproject.core.domain.TBasTrdCode</class>
<class>com.iproject.core.domain.PlyuploadLob</class>
<class>com.iproject.core.domain.TBicPlyMain</class>
<class>com.iproject.core.domain.TBicPrdTypCvrgRel</class>
<class>com.iproject.core.domain.TBicPrdTypRel</class>
<class>com.iproject.core.domain.TBicPrmCompute</class>
<class>com.iproject.core.domain.TBicPrmComputeSet</class>
<class>com.iproject.core.domain.TBicEmpCombo</class>
<class>com.iproject.core.domain.TBicVariflightComm</class>
<class>com.iproject.core.domain.TSrcProdSpecRel</class>
<class>com.iproject.core.domain.TBicRateSetSpl</class>
<class>com.iproject.core.domain.TBicElecAir</class>
<class>com.iproject.core.domain.TBicPacketLog</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
</persistence>
<?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.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- The request dumper valve dumps useful debugging information about
the request and response data received and sent by Tomcat.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
<!--
<Context path="/peerv6_test" docBase="G:\workspace\peerv6_test\WebRoot" reloadable="false"/>
-->
<Context path="/ipeer-interface" docBase="G:\workspace\ipeer-interface\WebRoot" reloadable="false">
<Resource name="ipeerDs" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="ipeer_new" password="passw0rd!" driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@1.1.1.1:1555:dbname"/>
</Context>
<!--
<Context path="/ipeer-task" docBase="G:\workspace\ipeer-task\WebRoot" reloadable="false"/>
-->
<!--
<Context path="/ipeer" docBase="G:\workspace\ipeer\WebRoot" reloadable="false"/>
-->
</Host>
</Engine>
</Service>
</Server>
spring-dao-context.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<!-- ******************************************************************** -->
<!-- Scan for service layer annotated beans -->
<!-- ******************************************************************** -->
<context:component-scan base-package="com.iproject.core.dao" scoped-proxy="interfaces" />
<!-- ******************************************************************** -->
<!-- PropertyConfigurer for the DAO -->
<!-- ******************************************************************** -->
<context:property-placeholder location="classpath:standard-dao.properties" />
<!-- ******************************************************************** -->
<!-- Setup the transaction manager -->
<!-- ******************************************************************** -->
<!-- Using Atomikos Transaction Manager -->
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" init-method="init" destroy-method="close">
<property name="forceShutdown" value="true" />
<property name="startupTransactionService" value="true" />
<property name="transactionTimeout" value="60" />
</bean>
<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp" />
<!-- Configure the Spring framework to use JTA transactions from Atomikos -->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="atomikosTransactionManager" />
<property name="userTransaction" ref="atomikosUserTransaction" />
<!-- <property name="transactionSynchronizationName" value="SYNCHRONIZATION_ON_ACTUAL_TRANSACTION" /> -->
</bean>
<!-- 启动注解功能 -->
<tx:annotation-driven transaction-manager="transactionManager" />
<!-- ******************************************************************** -->
<!-- Setup a data source -->
<!-- ******************************************************************** -->
<bean name="localhost_oracleDS,springSecurityDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" scope="singleton">
<!-- jboss format -->
<!-- <property name="jndiName" value="java:/ipeerDs"/>-->
<!-- tomcat format -->
<property name="jndiName" value="java:comp/env/ipeerDs"/>
</bean>
<!-- Using Apache DBCP Data Sources -->
<!-- <bean class="org.apache.commons.dbcp.BasicDataSource"-->
<!-- destroy-method="close" name="localhost_oracleDS,springSecurityDataSource">-->
<!-- <property name="driverClassName" value="${localhost_oracle.connection.driver_class}" />-->
<!-- <property name="username" value="${localhost_oracle.connection.username}" />-->
<!-- <property name="password" value="${localhost_oracle.connection.password}" />-->
<!-- <property name="url" value="${localhost_oracle.connection.url}" />-->
<!-- <property name="maxIdle" value="${localhost_oracle.minPoolSize}" />-->
<!-- <property name="maxActive" value="${localhost_oracle.maxPoolSize}" />-->
<!-- </bean>-->
<!-- ******************************************************************** -->
<!-- Setup each persistence unit -->
<!-- ******************************************************************** -->
<!-- Configure a JPA vendor adapter -->
<bean id="localhost_oracleJPAVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="${localhost_oracle.show_sql}" />
<property name="generateDdl" value="${localhost_oracle.generateDdl}" />
<property name="databasePlatform" value="${localhost_oracle.dialect}" />
</bean>
<!-- EntityManager Factory that brings together the persistence unit, datasource,
and JPA Vendor -->
<bean
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
id="localhost_oracle">
<property name="dataSource" ref="localhost_oracleDS" />
<property name="persistenceUnitName" value="localhost_oracle" />
<property name="jpaVendorAdapter" ref="localhost_oracleJPAVendorAdapter" />
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.transaction.manager_lookup_class"
value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" />
<entry key="hibernate.connection.release_mode" value="on_close" />
</map>
</property>
</bean>
<bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
<property name="entityManagerFactory" ref="localhost_oracle" />
</bean>
<bean id="commonDAO" class="com.iproject.core.dao.CommonDAO">
<property name="entityManagerFactory" ref="localhost_oracle" />
</bean>
</beans>
web.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>ipeer-interface</display-name>
<description>永诚银保通接口平台</description>
<!-- JNDI数据源,tomcat6可以不需要 -->
<!-- <resource-ref>-->
<!-- <res-ref-name>ipeerDs</res-ref-name>-->
<!-- <res-type>javax.sql.DataSource</res-type>-->
<!-- <res-auth>Container</res-auth>-->
<!-- </resource-ref>-->
<context-param>
<description></description>
<param-name>EAPConfig</param-name>
<param-value>/WEB-INF/EAPConfig.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Spring刷新Interceptor防止内存泄漏 -->
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<!-- 启动Socket服务 -->
<listener>
<listener-class>com.iproject.core.restful.SocketServiceInit</listener-class>
</listener>
<filter>
<description>generated-persistence-filter</description>
<filter-name>localhost_oracleFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
<init-param>
<param-name>entityManagerFactoryBeanName</param-name>
<param-value>localhost_oracle</param-value>
</init-param>
</filter>
<!-- Character Encoding filter -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>localhost_oracleFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>InitParameterServlet</servlet-name>
<servlet-class>com.iproject.core.fwk.web.servlet.InitParameterServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet>
<servlet-name>EAPConfigServlet</servlet-name>
<servlet-class>com.iproject.core.fwk.web.servlet.EAPConfigServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- webservice -->
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/pages/login.jsp</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/pages/error.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/pages/error.jsp</location>
</error-page>
</web-app>
Tomcat 6 部署工程总结,使用JNDI数据源配置相关推荐
- Hibernate Tomcat JNDI数据源配置(转)
简述: 配置JNDI 查找Tomcat 中server.xml中定义的数据源 步骤: 1. 修改elipse的数据源server.xml 主要修改如下, 1. 添加下面这段Context文本 其中St ...
- JNDI数据源配置注意事项
假设是在原有project上改动 1,applicationContext.xml中改动当中的value值 <bean id="dataSource" class=" ...
- 在Tomcat配置JNDI数据源的三种方式
转载自 在Tomcat配置JNDI数据源的三种方式 在我过去工作的过程中,开发用服务器一般都是Tomcat,数据源的配置往往都是在applicationContext.xml中配置一个dataSo ...
- Hibernate Tomcat JNDI数据源示例教程
Welcome to the Hibernate Tomcat JNDI DataSource example tutorial. We have already seen how to use Hi ...
- JNDI数据源的配置
一.数据源的由来 在Java开发中,使用JDBC操作数据库的四个步骤如下: ①加载数据库驱动程序(Class.forName("数据库驱动类");) ②连接数据库(Conne ...
- JNDI学习总结(2)——JNDI数据源的配置
一.数据源的由来 在Java开发中,使用JDBC操作数据库的四个步骤如下: ①加载数据库驱动程序(Class.forName("数据库驱动类");) ②连接数据库(Conne ...
- JNDI学习总结(一)——JNDI数据源的配置(转)
一.数据源的由来 在Java开发中,使用JDBC操作数据库的四个步骤如下: ①加载数据库驱动程序(Class.forName("数据库驱动类");) ②连接数据库(Conne ...
- tomcat 热部署
场景介绍: 频繁更新项目代码但不能重启服务的时候,就可以使用到 tomcat热部署. 步骤: 1.配置好JDK和tomcat的环境变量 2.将 war 包解压后的项目文件放在某个位置,比如:D\pro ...
- 在Tomcat中部署seam工程
在Tomcat中部署seam工程 众所周知,Tomcat.Resin是servlet的容器,反应迅速,启动时间快,配置简单(Resin反应应该更迅速一些),但如果用到EJB工程的的话,它们就不能胜任了 ...
最新文章
- 原来书中说的JVM默认垃圾回收器是错的!
- 取给定正整数的指定bit位開始的指定长度的数据
- 每个开发阶段对应的最流行的Java工具
- Android文件存储方式之openFileOutput与获取数据openFileInput
- 中国联通辟谣“不支持华为”:恶意诽谤 将通过法律手段维护权益
- AcWing 1969. 品种邻近(滑动窗口+枚举)
- 猿取向的规划设计模式 ——GoF《设计模式》阅读摘要(零)
- 使用 Travis 自动部署 Hexo 到 Github 与 自己的服务器
- 中级工程师基础SQL试题
- 中英文停用词(stop word)列表
- IDEA技巧:如何根据注释生成swagger注解
- mongodb类型转换
- 爱班级电脑端下载|二维码签到
- 网站备案和域名实名认证的重要性
- 花飞花落花飘谢,红绡香断有谁怜!
- 简易版购物车案例(vue)
- Matlab——图形绘制——三维立体图形 剔透玲珑球 动态图——彗星状轨迹图
- ​LeetCode刷题实战276:栅栏涂色
- linux驱动程序设计21 Linux设备驱动的调试
- 水果店圈子:水果店日常朋友圈文案,水果店发朋友圈文案
热门文章
- 假如我拥有字节工牌......
- 大跌眼镜!杭州一程序员年薪 30 万,竟靠偷车厘子缓解压力?
- 汇聚开发者星星之火,华为鸿蒙系统有希望成为国产之光?
- 配置免密码登录Linux服务器
- NSURLProtectionSpace 证书认证的上下文
- 开源 java CMS - FreeCMS2.8 数据对象 question
- 你有没有想过: 为什么Java中String是不可变的?
- 使用 git.oschina 码云 来托管 Hexo 搭建的博客
- http连接过程遇到的各种性能瓶颈
- 【WPF】鼠标拖拽功能DragOver和Drop