- 浏览: 212529 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
jongde1:
Axure太难学了,分享mockplus工具,有兴趣可以去了解 ...
Axure RP 原型设计工具 -
di1984HIT:
这里面提到了好几种解决办法。
Spring AOP对日志记录、Exception日志记录 -
di1984HIT:
学习一下。
spring struts2 零配置 -
di1984HIT:
不错,不错啊
Struts2防止表单重复提交 -
di1984HIT:
kettle怎么样啊。
Kettle初探
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 3697一、安装JDK 1、安装jdk-7u79-linux-x64. ... -
Centos6 下的 nginx 安装
2014-08-04 15:41 789Centos6 下的 nginx 安装 ... -
搭建Nginx+Java环境(tomcat)
2014-07-30 22:17 10221.搭建Nginx+Java环境 《高性能Linux服务器 ... -
Websphere Community Edition change port 8080 to 80
2013-08-30 21:45 688WebSphere Community Edition Cha ... -
linux下同时启动2个或者多个tomcat的配置方法
2013-06-08 11:58 1462linux下同时启动2个或者多个tomcat的配置方法 1. ... -
Windows 8 下tomcat7配置
2013-06-08 11:44 1255Windows 8 下tomcat7配置 1.下载tomca ... -
The APR based Apache Tomcat Native library
2013-06-05 18:03 983The APR based Apache Tomcat Nat ... -
Forgot password and cannot access WebSphere Application Server administrative co
2013-04-03 10:51 845Forgot password and cannot acce ... -
Websphere8.0安装与配置
2013-04-01 12:34 1373Websphere8.0配置 reference: We ... -
在tomcat中,通过IP访问web系统,不需要端口号的方法
2013-03-08 10:25 991在tomcat中,通过IP访问web系统,不需要端口号的方法 ... -
如何将基于 Struts、Spring 和 Hibernate 的应用从 Tomcat 迁移到 WebSphere Application Server
2012-12-21 10:28 1193引言 现在很多的企业都 ... -
JAAS介绍
2012-03-08 02:06 1229JAAS是对JCE安全框架的重要补充,通过提供认证用户和确定用 ... -
web.xml中<security-constraint>和四种认证类型
2012-03-08 02:07 953<security-constraint> 的子元 ... -
Error 404: SRVE0190E: File not found: /login.action
2012-03-08 02:07 4731发生这样问题有两种情 ... -
关于websphere中配置 j_security_check 的配置
2012-03-07 23:19 1531系统登录的submit提交的action是j_securit ... -
Websphere 优化技巧
2012-03-07 23:15 10691,更改http server的配置 ... -
WebSphere下应用程序更新,安装war,ear包以及添加单独模块
2012-03-07 23:09 2374websphere 中直接修改web.xml: 一般来讲,单 ... -
websphere中的Single Sign-on 单点登录
2012-03-07 22:37 1088... -
LDAP
2012-03-07 02:23 9761. Websphere5.1.x+JAAS+LDAP配置全 ... -
LDAP
2012-03-07 02:23 01. Websphere5.1.x+JAAS+LDAP配置 ...
相关推荐
4. Parent First/Parent Last ClassLoader:Tomcat允许配置是否优先使用父类加载器,这可以通过`useParentDelegation`属性控制。默认情况下,Tomcat采用Parent Last策略,确保Web应用的类优先于全局库加载,防止类...
《Tomcat类加载机制——ClassLoader详解》 在Java Web开发中,Tomcat作为最常用的Servlet容器,其类加载机制对于理解和优化应用性能至关重要。本文将深入探讨Tomcat的ClassLoader是如何工作的,以及它如何影响到...
因此,合理配置类路径,确保正确的加载顺序,是防止此类问题的关键。 #### 结论 Tomcat的类加载机制虽然复杂,但通过明确的加载顺序和层级关系,能够有效地管理各类资源,保障应用程序的正常运行。开发人员在部署...
本篇主要介绍Tomcat的核心组件认知、`server.xml`配置详解以及自动部署脚本的编写,帮助读者理解和优化生产环境中的Tomcat配置。 ### 一、Tomcat各组件认知 1. **Tomcat架构说明** Tomcat基于组件化设计,由一...
理解`Server.xml`、`Context.xml`等配置文件的解析逻辑对定制Tomcat配置至关重要。 6. **安全性**:Tomcat提供了安全功能,如用户认证和授权。源码中的`security`目录包含了相关实现,例如`Realm`接口及其实现,...
“Tomcat.ClassLoader.pdf”这份文档可能详细阐述了这些过程,包括如何配置和调整Tomcat的类加载策略,以及如何处理类冲突和优化加载性能。可能还会讨论到线程上下文类加载器(Thread Context ClassLoader)和自定义...
Tomcat因其轻量级、易于配置和使用等特点,在Java Web开发领域内广受欢迎。此外,Tomcat还支持HTTP、HTTPS等多种协议,并能够作为独立的应用服务器运行,也可以与Apache等其他Web服务器配合使用。 ### 二、Tomcat...
"Tomcat权威指南"通常涵盖Tomcat的安装、配置、安全管理、集群、连接池、日志和性能调优等方面。阅读这本书可以系统地学习Tomcat的全貌,帮助开发者解决实际工作中遇到的问题。 6. **Tomcat性能优化** 优化Tomcat...
当`myApp`启动时,Tomcat会自动创建与`myApp`对应的ClassLoader,并通过`ContextBindings`将`jdbc/myDataSource`与该ClassLoader绑定。然后,在应用中,可以使用以下代码来获取数据源: ```java Context initCtx = ...
【标题】"Tomcat7 负载Jar包" 涉及的知识点主要集中在Tomcat服务器的配置和管理上,特别是如何优化Tomcat以处理大量JAR包的加载。Tomcat是Apache软件基金会的Jakarta项目下的一个开源Java Servlet容器,它广泛用于...
5. **ClassLoader机制**:Tomcat使用自定义的ClassLoader来加载Web应用程序的类,确保不同应用之间的类隔离,防止冲突。 Tomcat 6.0.18版的特性包括: 1. **性能优化**:相对于之前的版本,6.0.18进行了性能调优,...
4. Common ClassLoader:在Tomcat中,它是所有Web应用共享的类加载器,用于加载`common.loader`配置项指定的类路径。 5. WebApp ClassLoader:每个Web应用有自己的类加载器,它加载应用的`WEB-INF/classes`和`WEB-...
- Tomcat使用自定义的类加载器,如`CommonClassLoader`、`CatalinaClassLoader`等,它们按照特定的层次结构加载类。 5. **初始化容器** - `Catalina`类是Tomcat的主要组件,负责管理所有Web应用。在启动过程中,...
《深入剖析Tomcat》这本书是Java开发者们探索Tomcat服务器内部机制的重要参考资料,它带领读者逐步揭开Tomcat的...通过学习和研究Tomcat源码,我们可以提升技术水平,解决实际问题,甚至为Tomcat社区贡献自己的力量。
Bootstrap类加载器完成后,Tomcat会使用系统类加载器(System ClassLoader)加载服务器的全局配置文件,如`server.xml`。这个文件定义了Tomcat的整体架构,包括服务(Service)、连接器(Connector)和引擎(Engine)等组件...
Tomcat使用自定义的ClassLoader来加载Web应用的类,每个Web应用都有自己的独立ClassLoader,这种设计确保了应用间的类隔离,避免了类冲突。 5. **JNDI服务**: Tomcat提供JNDI(Java Naming and Directory ...
5. **ClassLoader机制**:Tomcat的类加载机制允许每个Web应用有自己的类加载器,这有助于隔离不同应用的类,防止类冲突。源码中包含了自定义ClassLoader的实现。 6. **配置文件解析**:Tomcat使用XML配置文件来定义...