- 浏览: 205282 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
jongde1:
Axure太难学了,分享mockplus工具,有兴趣可以去了解 ...
Axure RP 原型设计工具 -
di1984HIT:
这里面提到了好几种解决办法。
Spring AOP对日志记录、Exception日志记录 -
di1984HIT:
学习一下。
spring struts2 零配置 -
di1984HIT:
不错,不错啊
Struts2防止表单重复提交 -
di1984HIT:
kettle怎么样啊。
Kettle初探
Tomcat配置自己的Classloader
- 博客分类:
- WebSphere/Tomcat/Nginx
Tomcat配置自己的Classloader
http://www.52webpro.cn/archives/view-15079-1.html
http://segmentfault.com/q/1010000000155690
http://bbs.csdn.net/topics/190167594
http://yuan-xulong.iteye.com/blog/1056820
http://space.itpub.net/?uid-23071790-action-viewspace-itemid-702545
Linux操作系统下/etc/hosts文件配置方法
http://space.itpub.net/21639366/viewspace-604530
手动创建Oracle 11g数据库
http://blog.csdn.net/carlwu/article/details/2978130
WebSphere Application Server Community Edition V2.0 中的新特性
http://www.ibm.com/developerworks/cn/websphere/library/techarticles/0709_jain/0709_jain.html?s_cmp=techccid&s_tact=105agx52
http://publib.boulder.ibm.com/wasce/V2.0.0/zh_CN/shutdown.html
http://publib.boulder.ibm.com/wasce/V2.1.0/en/quick-start.html
http://stackoverflow.com/questions/11246598/how-to-make-tomcat-work-with-tomcatinstrumentableclassloader-defined-in-meta-inf
http://www.oschina.net/question/68887_26014
http://swingboat.iteye.com/blog/528022
jar 命令 打包详解
http://boris-song.iteye.com/blog/234822
http://quicker.iteye.com/blog/838323
http://shashankmjain.blogspot.com/2009/08/instrumenting-class-with-custom-tomcat.html
http://zhidao.baidu.com/question/290837823.html
--
Instrumenting a class with custom Tomcat Class loader
I have been experimenting with the idea of runtime instrumentation of java classes for quite some time.
Java 5 provides a mechanism using a java agent to intercept the classloading process but here I am going to look into creating a custom Class loader for Tomcat and changing the class bytes on the fly using the javassist library.
Create a web project using Eclipse or any IDE of your choice.
Create a context.xml file in the META-INF directory of the web app. The content will be similar to
loaderClass="com.test.SampleLoader"
useSystemClassLoaderAsParent="false"
delegate="false"/>
After doing this we need to implement the SampleLoader class
The class should be a subclass of WebappClassLoader from Tomcat. We will override the
protected Class findClassInternal(String name) throws ClassNotFoundException method.
The method can be copied from the Tomcat WebappClassLoader class.
Under the if (entry.loadedClass == null) {
method we will change the byte stream of the class using javassist something like this
byte[] b =entry.binaryContent;
String name1 ="com.sample.Test";
pool.insertClassPath(new ByteArrayClassPath(name1, b));
if(name.equals(name1))
{
CtClass cc = pool.get(name);
cc.getConstructors()[0].insertBefore("{System.out.println(\"Before Instantiaition\");}");
cc.getConstructors()[0].insertAfter("{System.out.println(\"After Instantiation\");}");
System.out.println("After classworking "+cc.toBytecode().length);
entry.binaryContent=cc.toBytecode();
}
The same can be extended to intercept any method call.
The class is defined by the classloader after the byte array stream is modified. So the modified class is loaded into the jvm by the custom classloader.
Also the classes can be loaded from an alternate source rather then the web-inf/lib and classes directory
This can be useful when we want to write interceptors to the method calls or create proxies on the fly.
The Custom classloader can be packaged and the jar needs to be placed in CATALINA_HOME/lib directory alongside the javassist libs..
POSTED BY SHASHANK JAIN AT 5:59 AM
LABELS: BYTE CODE INSTRUMENTATION, CUSTOM TOMCAT CLASSLOADER
--
http://www.sf-express.com/cn/sc/delivery_step/waybill_track/track.html
117326721579
Oracle创建用户、表空间、导入导出、...命令
http://www.cnblogs.com/cloudwalf/archive/2008/09/04/1284033.html
读取目录及子目录下指定文件名的路径
http://amulin.iteye.com/blog/1643202
http://blog.csdn.net/chfzhb/article/details/2859973
在tomcat中如何装载加密后的class文件
http://blog.163.com/tim_plenty/blog/static/567106462007316113420/
利用自定义Classloader保护加密class文件的方式,能否在tomcat等容器中实现?
http://www.iteye.com/problems/5406
Spring对属性文件加密解密应用
http://voole.iteye.com/blog/632885
web项目加解密
http://xphwv.iteye.com/blog/1779031
tomcat中如何装载加密后的class文件
http://www.blogjava.net/jspark/archive/2006/07/25/59968.html
java源程序加密解决方案(基于Classloader解密) **
http://cjnetwork.iteye.com/blog/851544#comments
http://www.ibm.com/developerworks/cn/java/l-secureclass/
http://blog.csdn.net/aesop_wubo/article/details/7582266
Encrypted classloader tomcat
http://www.coderanch.com/t/497275/Tomcat/Encrypted-files-classes-Tomcat
http://publib.boulder.ibm.com/infocenter/javasdk/v1r4m2/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.142%2Fhtml%2Fid1100.html
http://www.52webpro.cn/archives/view-15079-1.html
http://segmentfault.com/q/1010000000155690
http://bbs.csdn.net/topics/190167594
http://yuan-xulong.iteye.com/blog/1056820
http://space.itpub.net/?uid-23071790-action-viewspace-itemid-702545
Linux操作系统下/etc/hosts文件配置方法
http://space.itpub.net/21639366/viewspace-604530
手动创建Oracle 11g数据库
http://blog.csdn.net/carlwu/article/details/2978130
WebSphere Application Server Community Edition V2.0 中的新特性
http://www.ibm.com/developerworks/cn/websphere/library/techarticles/0709_jain/0709_jain.html?s_cmp=techccid&s_tact=105agx52
http://publib.boulder.ibm.com/wasce/V2.0.0/zh_CN/shutdown.html
http://publib.boulder.ibm.com/wasce/V2.1.0/en/quick-start.html
http://stackoverflow.com/questions/11246598/how-to-make-tomcat-work-with-tomcatinstrumentableclassloader-defined-in-meta-inf
http://www.oschina.net/question/68887_26014
http://swingboat.iteye.com/blog/528022
jar 命令 打包详解
http://boris-song.iteye.com/blog/234822
http://quicker.iteye.com/blog/838323
http://shashankmjain.blogspot.com/2009/08/instrumenting-class-with-custom-tomcat.html
http://zhidao.baidu.com/question/290837823.html
--
Instrumenting a class with custom Tomcat Class loader
I have been experimenting with the idea of runtime instrumentation of java classes for quite some time.
Java 5 provides a mechanism using a java agent to intercept the classloading process but here I am going to look into creating a custom Class loader for Tomcat and changing the class bytes on the fly using the javassist library.
Create a web project using Eclipse or any IDE of your choice.
Create a context.xml file in the META-INF directory of the web app. The content will be similar to
loaderClass="com.test.SampleLoader"
useSystemClassLoaderAsParent="false"
delegate="false"/>
After doing this we need to implement the SampleLoader class
The class should be a subclass of WebappClassLoader from Tomcat. We will override the
protected Class findClassInternal(String name) throws ClassNotFoundException method.
The method can be copied from the Tomcat WebappClassLoader class.
Under the if (entry.loadedClass == null) {
method we will change the byte stream of the class using javassist something like this
byte[] b =entry.binaryContent;
String name1 ="com.sample.Test";
pool.insertClassPath(new ByteArrayClassPath(name1, b));
if(name.equals(name1))
{
CtClass cc = pool.get(name);
cc.getConstructors()[0].insertBefore("{System.out.println(\"Before Instantiaition\");}");
cc.getConstructors()[0].insertAfter("{System.out.println(\"After Instantiation\");}");
System.out.println("After classworking "+cc.toBytecode().length);
entry.binaryContent=cc.toBytecode();
}
The same can be extended to intercept any method call.
The class is defined by the classloader after the byte array stream is modified. So the modified class is loaded into the jvm by the custom classloader.
Also the classes can be loaded from an alternate source rather then the web-inf/lib and classes directory
This can be useful when we want to write interceptors to the method calls or create proxies on the fly.
The Custom classloader can be packaged and the jar needs to be placed in CATALINA_HOME/lib directory alongside the javassist libs..
POSTED BY SHASHANK JAIN AT 5:59 AM
LABELS: BYTE CODE INSTRUMENTATION, CUSTOM TOMCAT CLASSLOADER
--
http://www.sf-express.com/cn/sc/delivery_step/waybill_track/track.html
117326721579
Oracle创建用户、表空间、导入导出、...命令
http://www.cnblogs.com/cloudwalf/archive/2008/09/04/1284033.html
读取目录及子目录下指定文件名的路径
http://amulin.iteye.com/blog/1643202
http://blog.csdn.net/chfzhb/article/details/2859973
在tomcat中如何装载加密后的class文件
http://blog.163.com/tim_plenty/blog/static/567106462007316113420/
利用自定义Classloader保护加密class文件的方式,能否在tomcat等容器中实现?
http://www.iteye.com/problems/5406
Spring对属性文件加密解密应用
http://voole.iteye.com/blog/632885
web项目加解密
http://xphwv.iteye.com/blog/1779031
tomcat中如何装载加密后的class文件
http://www.blogjava.net/jspark/archive/2006/07/25/59968.html
java源程序加密解决方案(基于Classloader解密) **
http://cjnetwork.iteye.com/blog/851544#comments
http://www.ibm.com/developerworks/cn/java/l-secureclass/
http://blog.csdn.net/aesop_wubo/article/details/7582266
Encrypted classloader tomcat
http://www.coderanch.com/t/497275/Tomcat/Encrypted-files-classes-Tomcat
http://publib.boulder.ibm.com/infocenter/javasdk/v1r4m2/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.142%2Fhtml%2Fid1100.html
发表评论
-
Linux下部署多个Tomcat多个域名
2015-12-12 19:02 3651一、安装JDK 1、安装jdk-7u79-linux-x64. ... -
Centos6 下的 nginx 安装
2014-08-04 15:41 750Centos6 下的 nginx 安装 ... -
搭建Nginx+Java环境(tomcat)
2014-07-30 22:17 9501.搭建Nginx+Java环境 《高性能Linux服务器 ... -
Websphere Community Edition change port 8080 to 80
2013-08-30 21:45 649WebSphere Community Edition Cha ... -
linux下同时启动2个或者多个tomcat的配置方法
2013-06-08 11:58 1416linux下同时启动2个或者多个tomcat的配置方法 1. ... -
Windows 8 下tomcat7配置
2013-06-08 11:44 1206Windows 8 下tomcat7配置 1.下载tomca ... -
The APR based Apache Tomcat Native library
2013-06-05 18:03 931The APR based Apache Tomcat Nat ... -
Forgot password and cannot access WebSphere Application Server administrative co
2013-04-03 10:51 803Forgot password and cannot acce ... -
Websphere8.0安装与配置
2013-04-01 12:34 1320Websphere8.0配置 reference: We ... -
在tomcat中,通过IP访问web系统,不需要端口号的方法
2013-03-08 10:25 939在tomcat中,通过IP访问web系统,不需要端口号的方法 ... -
如何将基于 Struts、Spring 和 Hibernate 的应用从 Tomcat 迁移到 WebSphere Application Server
2012-12-21 10:28 1144引言 现在很多的企业都 ... -
JAAS介绍
2012-03-08 02:06 1136JAAS是对JCE安全框架的重要补充,通过提供认证用户和确定用 ... -
web.xml中<security-constraint>和四种认证类型
2012-03-08 02:07 909<security-constraint> 的子元 ... -
Error 404: SRVE0190E: File not found: /login.action
2012-03-08 02:07 4661发生这样问题有两种情 ... -
关于websphere中配置 j_security_check 的配置
2012-03-07 23:19 1475系统登录的submit提交的action是j_securit ... -
Websphere 优化技巧
2012-03-07 23:15 10361,更改http server的配置 ... -
WebSphere下应用程序更新,安装war,ear包以及添加单独模块
2012-03-07 23:09 2316websphere 中直接修改web.xml: 一般来讲,单 ... -
websphere中的Single Sign-on 单点登录
2012-03-07 22:37 1049... -
LDAP
2012-03-07 02:23 9431. Websphere5.1.x+JAAS+LDAP配置全 ... -
LDAP
2012-03-07 02:23 01. Websphere5.1.x+JAAS+LDAP配置 ...
相关推荐
Tomcat自带的日志实现是tomcat-juli.jar,它是对默认的JDK日志java.util.logging进行...但是tomcat-juli可以针对不同的classloader来使用不同的配置文件,使得tomcat下不同的Web应用程序可以使用各自独立的日志文件。
Tomcat、Jboss等Java application server修改启动脚本, 把执行java的命令行后面加上参数-agentlib:<动态链接库文件所在路径>\classloader 适应环境: 操作系统:所有操作系统,Windows系统、Linux/Unix,只是运行...
配置Tomcat vii. 64.7. 启用Tomcat的多连接器(Multiple Connectors) viii. 64.8. 在前端代理服务器后使用Tomcat ix. 64.9. 使用Jetty替代Tomcat x. 64.10. 配置Jetty xi. 64.11. 使用Undertow替代Tomcat xii. 64....
Tomcat、Jboss等Java application server修改启动脚本, 把执行java的命令行后面加上参数-agentlib:<动态链接库文件所在路径>\classloader 适应环境: 操作系统:所有操作系统,Windows系统、Linux/Unix,只是运行...
Tomcat、Jboss等Java application server修改启动脚本, 把执行java的命令行后面加上参数-agentlib:<动态链接库文件所在路径>\classloader 适应环境: 操作系统:所有操作系统,Windows系统、Linux/Unix,只是...
Tomcat、Jboss等Java application server修改启动脚本, 把执行java的命令行后面加上参数-agentlib:<动态链接库文件所在路径>\classloader 适应环境: 操作系统:所有操作系统,Windows系统、Linux/Unix,只是运行...
Tomcat、Jboss等Java application server修改启动脚本,把执行java的命令行后面加上参数-agentlib:<动态链接库文件所在路径>\classloader 适应环境: 操作系统:所有操作系统,Windows系统、Linux/Unix,只是运行...
9. 增加tomcat的内存 6 10.JAVA获取系统当前的用户 7 11.javascript获取客户端网卡MAC地址和IP地址和计算机名 7 12.JAVA反射 8 13. 自定义ClassLoader 13 14. double保留两位数的两个方案 18 16. 用户输入输出,文件...
c3p0连接mysql8.0.11需要外加mchange-commons-java-0.2.15.jar,maven的pom.xml 中配置了,但是项目中报找不到mchange-commons-java-0.2.15.jar这个文件,可以把此文件下载后,然后解压后把对应的jar包放到maven 库...
7.10.3 在Tomcat下的配置 7.10.4 在其他Web应用服务器下的配置 7.11 小结 第3篇 数据访问 第8章 Spring对DAO的支持 8.1 Spring的DAO理念 8.2 统一的异常体系 8.2.1 Spring的DAO异常体系 8.2.2 JDBC的异常转换器 ...
7.10.3 在Tomcat下的配置 7.10.4 在其他Web应用服务器下的配置 7.11 小结 第3篇 数据访问 第8章 Spring对DAO的支持 8.1 Spring的DAO理念 8.2 统一的异常体系 8.2.1 Spring的DAO异常体系 8.2.2 JDBC的异常转换器 ...
但通常情况下,由于Java Bean是被容器所创建(如Tomcat)的,所以Java Bean应具有一个无参的构造器,另外,通常Java Bean还要实现Serializable接口用于实现Bean的持久性。Java Bean实际上相当于微软COM模型中的本地...
但通常情况下,由于Java Bean是被容器所创建(如Tomcat)的,所以Java Bean应具有一个无参的构造器,另外,通常Java Bean还要实现Serializable接口用于实现Bean的持久性。Java Bean实际上相当于微软COM模型中的本地...
【反射】反射中,Class.forName和classloader的区别 42 【JVM】JAVA编译原理和JVM原理 42 【JVM】Java内存模型 44 【JVM】jvm内存模型 45 主内存与工作内存 45 内存间交互操作 46 重排序 48 【JVM】内存泄漏 49 ...
1. 目录 1. 2. 目录 .........................................................................................................................................................1 JVM ........................