tomcat 自定义classpath(亲自测试)
因为一直以来使用tomcat和weblogic作为应用服务器为主,最近在升级新中间件的过程中遇到一个问题,我们的web前端应用现在升级是进行全量包升级的,因为现在的系统架构为前端和后端通过rpc框架交互的,后端使用java service wrapper进行管理,其组织架构允许我们在配置文件中随意设置lib目录(其实,早在三个月之前,笔者是非常不想使用它的),我们将三方类库和公司的框架类库以及应用类库分别放在不同的目录中进行管理,这样就可以仅仅升级应用jar包,框架和应用可以独立解耦的管理。
因为前端要提供视图层,所以还是用tomcat,但是在tomcat 6以及之后的版本中,和5.5以及之前的版本中,其类加载器架构发生了变化,去掉了原来的shared加载器,如下所示:
5.5架构
https://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
6.0以后架构:
https://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
注:https://www.mulesoft.com/tcat/tomcat-classpath和http://blog.csdn.net/andyelvis/article/details/6719996,有提及5.5以及之前的版本,6.0开始并无更新提及。
可见,已经没有了shared类加载器。虽然在catalina.properties中还有shares.folder参数,但该参数经测试并无作用。
#
#
# List of comma-separated paths defining the contents of the "common"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank,the JVM system loader will be used as Catalina's "common"
# loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
# List of comma-separated paths defining the contents of the "shared"
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,
# the "common" loader will be used as Catalina's "shared" loader.
# Examples:
# "foo": Add this folder as a class repository
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
# Please note that for single jars, e.g. bar.jar, you need the URL form
# starting with file:.
shared.loader=${catalina.home}/shared/lib,${catalina.home}/shared/lib/*.jar,${catalina.base}/shared/lib,${catalina.base}/shared/lib/*.jar
上述jar并没有被加载到应用中。
现在看来,如果一定要引用非标目录中的jar,只能加到tomcat/lib中的方式来解决。
PS:也测试过直接修改catalina.sh中的classpath,仍然不能正常的启动和运行应用。
tomcat 自定义classpath(亲自测试)的更多相关文章
- 启动tomcat时报classpath not found
启动tomcat时报classpath not found 原因是缺包,首先查看tomcat安装地址,然后找到webapps目录下,找到该项目,看lib下是否缺包,不能单纯的看项目下是否缺包.
- linux下libnet编程 亲自测试可用
linux下libnet编程 亲自测试可用 亲自测试 如果build包的时候 只要把类型改了 就能改成相应的协议. 0x0800 ip 0x0806 arp 0x86DD IPv6 0x86e ...
- Maxim-可自定义的Monkey测试工具(Android)
Maxim 基于monkey做的二次开发,相比原始monkey,新增如下功能 多种随机测试模式:dfs(深度遍历) mix模式(monkey随机测试+控件识别) troy模式(按照控件选择器进行遍历) ...
- Tomcat环境配置部署测试环境及架构
Tomcat环境配置已经在前面介绍过了,这边就为童鞋们介绍下对于Tomcat的架构是怎么样的! Tomcat的架构包含(bin.conf.lib.logs.temp.wenapps.work)等文件夹 ...
- Vagrant搭建Ubuntu-JavaEE开发环境——Tomcat+JDK+MySQL+dubbo+测试
Vagrant搭建(Tomcat8+JDK7+MySQL5+dubbo) JDK 1.下载jdk 2.解压JDK tar -xzvf jdk-7u79-linux-x64.tar.gz 3.设置环境变 ...
- centos solr4.5 tomcat 简单安装[已测试ok]
一.环境准备: 1.jdk安装 2.tomcat安装 这两个基本环境的安装在这里就不说了 二.下载solr-4.5.0.tgz 三.安装solr 1.解压solr tar -zxvf /opt/sol ...
- vivado设计四:自定义IP核测试
在vivado设计三中:http://blog.chinaaet.com/detail/37177已经建立了vivado工程和封装好了自定义IP核. 那么接下来,我们对这个自定义IP核进行测试了:我们 ...
- Tomcat 自定义默认网站目录
上面访问的网址为http://192.168.0.108:8080/memtest/meminfo.jsp 需求: 现在我想访问格式为http://192.168.0.108:8080/meminfo ...
- Tomcat自定义classLoader加密解密
class很好反编译,所以需要对class文件先进行加密,然后使用自己的classloader进行解密并加载. [步骤] 大概分两步: 1.对class文件进行加密 2.写解密class文件并加载的c ...
随机推荐
- Cygwin/babun install telnet
最近一直在用一个windows下模拟linux的集成环境babun,特点是安装方便,使用简单,而且大部分linux程序都可以找到. 下面说一下telnet的安装: pact install inetu ...
- 循序渐进,了解Hive是什么!
一直想抽个时间整理下最近的所学,断断续续接触hive也有半个多月了,大体上了解了很多Hive相关的知识.那么,一般对陌生事物的认知都会经历下面几个阶段: 为什么会出现?解决了什么问题? 如何搭建?如何 ...
- Android 6.0 权限申请辅助 ----PermissionsHelper
Android 6.0 权限申请辅助 ----PermissionsHelper 项目地址:https://github.com/didikee/PermissionsHelper Android 的 ...
- 基于zipkin分布式链路追踪系统预研第一篇
本文为博主原创文章,未经博主允许不得转载. 分布式服务追踪系统起源于Google的论文“Dapper, a Large-Scale Distributed Systems Tracing Infras ...
- 2013 duilib入门简明教程 -- 自绘标题栏(5)
如果大家有做过标题栏的自绘,肯定会感慨各种不容易,并且现有的一些资料虽然完美的实现了功能,但是代码比较乱,需要自行整理.如果用duilib,就是小case啦. duilib其实并没有区 ...
- 搭建LNAMP环境(六)- PHP7源码安装MongoDB和MongoDB拓展
上一篇:搭建LNAMP环境(五)- PHP7源码安装Redis和Redis拓展 一.安装MongoDB 1.创建mongodb用户组和用户 groupadd mongodb useradd -r -g ...
- HTML5_02之视频、音频、Canvas
1.HTML5新特性之视频播放--video: ①例:<video src=""></video> ②video标签默认为300*150的inline-bl ...
- invalidate()和postInvalidate() 的区别及使用
Android提供了Invalidate方法实现界面刷新,但是Invalidate不能直接在线程中调用,因为他是违背了单线程模型:Android UI操作并不是线程安全的,并且这些操作必须在UI线程中 ...
- codeforces C. Vanya and Scales
C. Vanya and Scales Vanya has a scales for weighing loads and weights of masses w0, w1, w2, ..., w10 ...
- iOS开发之窥探UICollectionViewController(三) --使用UICollectionView自定义瀑布流
上篇博客的实例是自带的UICollectionViewDelegateFlowLayout布局基础上来做的Demo, 详情请看<iOS开发之窥探UICollectionViewControlle ...