`

Devloader.zip

阅读更多
  1. Installation:

    The classes in the zip "devloader.zip" must be extracted into "TOMCAT_HOME/server/classes".

  2. Requirements:

    "DevLoader" works with Tomcat 4.x and Tomcat 5.x

  3. Use :

    Activate and configure DevLoader for a project in project properties->Tomcat->DevLoader classpath

  4. ClassLoaders

    Classloaders are primarly responsible for loading Java class files and for initializing the corresponding java.lang.Class object.

    Different Classloader implementations already exist in Java2.
    e.g. The systemclassloader is responsible for searching and loading java class files from the jar, zip and directories as defined in the CLASSPATH systemproperty and the RMIClassLoader loads classes through the HTTP protocol.

    Classloaders may be nested.
    From the JAVA SDK Documentation:

    The ClassLoader class uses a delegation model to search for classes and resources. Each instance of ClassLoader has an associated parent class loader. When called upon to find a class or resource, a ClassLoader instance will delegate the search for the class or resource to its parent class loader before attempting to find the class or resource itself.
    The parent classloader is unable to access any resources (classes) of it's child classloaders.

     

  5. Webapplication Classloader

    Simplified a Java Webapplication in Tomcat uses two different Classloader instances. The Systemclassloader (SCL) and the Webapplication-Classloader (WCL). The parent classloader of the WCL is the SCL.

    Each deployed Webapplication has it's own WCL in Tomat. All WCL share the same (one and only) SCL.
    So as defined by the Java SDK Documentation all classes which are loaded by the Systemclassloader are visible to all Webapplications.
    Classes which are loaded by one WCL are not visible to other WCLs !
    The WCL loads classes from the WEB-INF/classes directory and the from JAR (!) files in the WEB-INF/lib directory only.

    As defined in the Java SDK Documentation the WCL should work as following:
    Before a WCL loads a class he must ask the parent classloader (SCL) if he already knows the class. If the SCL does not know the class the WCL tries to load it.
    This feature makes it possible to deploy two web-applications which use a different version of class A (as long as class A is not loadable through the SCL).

    The exception:
    The final servlet 2.3 specification defines the exception to the common rule.
    From Servlet 2.3 Specification SRV.9.7.2 - WebApplication Classloader:

    It is recommended also that the application class loader be implemented so that classes and resources packaged within the WAR are loaded in preference to classes and resources residing in container-wide library JARs.
    Tomcat supports this recommendation through a property which may be set in the server.xml configuration. Default setting is to act as defined in the Servlet specification.
    See also the actual documentation of the Tomcat project.

     

  6. Web-Projects in Eclipse
  7. With the TomcatPlugin it's easy to define a new webproject and to launch tomcat within the IDE.
    Eclipse makes it very easy to divide a big project into some subprojects. e.g. utility classes which will be used by many projects resist in a project named "utils" and the concrete projects are referencing the "utils" project.

    Unfortunatly the classes of the "utils" project are not automatically visible to Tomcat during runtime.

    There are two possibilities:
  8. Load the classes of the "utils" project through the Systemclassloader.
    This can be done by adding the "utils" project to the Systemclasspath of Tomcat (Window->Preferences->Tomcat).
    Why is this a bad idea ?
    Typically your webproject class files (including those of the "utils" project) will resist in WEB-INF/classes or WEB-INF/lib of the WAR file for production mode.
    So if you add some classes to the systemclassloader for development you will have a different classloading mechanism in production mode - this may lead to strange errors !
    Additionaly some code does not work if you load the classes in the systemclassloader.
    e.g. if the following class will resist in the "utils" project and you want to use this code to load a property file which resists in your webapplication (WEB-INF/classes) it is unable to load the resource because the systemclassloader is not allowed to access resources of the webappclassloader.
    public class ResourceLoader { public Properties load(String resourceName) { ClassLoader cl = ResourceLoader.class.getClassLoader(); InputStream in = cl.getResourceAsStream(resourceName); ... } }  
  9. Load the classes of the "utils" project through the Webclassloader.
    To load the classes through the Webclassloader the classes of the "utils" project must be put into the WEB-INF/classes or packaged as JAR into WEB-INF/lib directory.
    This may be done by hand or through some ANT build scripts - but unfortunatly each time you change code in the "utils" project :(
  10.  
  11. The Development-Webapp-Classloader

    There's a simple solution for making things easier. It works the following way:

    • A special Tomcat Webappclassloader implementation extends the mechanism of loading classes not only from WEB-INF/classes and WEB-INF/lib but also from locations which are specified in a special configuration file.
    • Through the TomcatPlugin you specify for each Tomcat project which classes shall be loaded through the Webclassloader - yust point and click.
      The TomcatPlugin writes the configuration file and the correct tomcat configuration (into server.xml).
    NOTE: Use the Development-Webapp-Classloader yust during development - It's not recommended to use it for production systems !!
分享到:
评论

相关推荐

    DevLoader.jar

    DevLoader.jar

    Eclipse插件大全

    花了几个小时在国外网站下的Eclipse插件(国外的网站打开很慢),包括13个插件,有的插件下了好几个版本,怕和用的Eclipse不合。。插件有:tomcat3.2/strutsIDE/XMLBuddy/Colorer Take/sqlexplorer/Fat Jar/AdvanQas/...

    tomcat类加载器

    这个"DevLoader.zip"文件可能包含与Tomcat自定义类加载器相关的资料,特别是名为"DevLoader"的类加载器,这可能是Tomcat为开发者提供的一种特殊加载器。 首先,我们来理解一下类加载器的基本概念。在Java中,类加载...

    DevloaderTomcat8

    tomcatPlugin不支持tomcat 8.x?么事,我来搞定,你用就行!

    devLoaderTomcat8.jar

    让Eclipse的TomcatPlugin支持Tomcat 8.x,亲测有效。 使用步骤: 1、先在Eclipse Markplace安装TomcatPlugin 2、复制devLoaderTomcat8.jar到tomcat8/lib/目录 3、在eclipse中启动tomcat

    校园广播驱动

    HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,UMSS.SYS ; Indicate that the device uses the C/B/I protocol [cbi.addreg.HW] HKR,,DeviceProtocol,0x10001,00 ; Indicate that the device uses the C/B protocol ...

    硬盘和光驱USB驱动

    HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,geneuide.sys HKR,,GeneUsbStorTag,,1 HKLM, "Software\Microsoft\Windows\CurrentVersion\RunOnce","USBIDRV",,"%\delentry.exe" [UsbStor.AddReg.Uninstall] HKLM,...

    手机连接电脑上网的教程.pdf

    HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,usbser.sys HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" [Reader.NT.Services] AddService = usbser, 0x00000002, Service_Inst [Service_...

    支持Maven工程自动计算依赖的TomcatPlugin,免费放送,全网唯一原创(版本2)

    它主要的功能亮点在于与Maven工程的集成,能自动计算并处理Maven项目的依赖关系,从而省去了开发者手动在DevLoader中选择jar包的繁琐步骤,极大地提高了开发和调试的效率。 【描述】:“修改自官方最新的3.3.1版本...

    INF文件详解simple[归类].pdf

    HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,BULKUSB.sys HKLM,"System\Currentcontrolset\Services\BulkUsb\Parameters","MaximumTransferSize",0x10001,4096 ``` **1. 版本信息**:`[Version]`段定义了INF文件的...

    监控驱动及软件

    HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,hvDriver.sys HKR,,PageOutWhenUnopened,3,01 HKR,Settings,VideoFormatLocked,3,09,0,0,0 ; VideoFormatLocked HKLM,"System\CurrentControlSet\Services\HV6000Drv\...

    在Eclipse 中配置Tomcat项目

    6. **配置DevLoader**:切换到“Devloader classpath”选项卡,并按照需要选择所需的类路径条目,以便为项目提供正确的类路径配置。 #### 四、在Eclipse中为tomcat的server.xml文件添加项目启动代码 最后一步是在...

    点击eclipse中的小猫启动项目

    - 如果你不打算手动构建WAR文件,并且希望Eclipse在每次修改代码后自动部署到Tomcat,可以保持DevLoader classPath的默认设置。 - “Export to WAR settings”关乎是否在部署时将项目打包成WAR文件。如果你选择不...

    联想旭日420AXP系统声卡驱动

    ;Windows 2000/XP WDM Modem Setup File ;... 2004-2006 ;Manufacturer: Motorola Inc [Version] Signature = "$Windows NT$" Class = Modem ClassGUID = {4D36E96D-E325-11CE-BFC1-08002BE10318} ...

    旭日420AXP系统调制解调器驱动

    ;Windows 2000/XP WDM Modem Setup File ;... 2004-2006 ;Manufacturer: Motorola Inc [Version] Signature = "$Windows NT$" Class = Modem ClassGUID = {4D36E96D-E325-11CE-BFC1-08002BE10318} ...

    DevloaderTomcat

    DevloaderTomcat.jar 启动jar包

    支持Maven工程自动计算依赖的TomcatPlugin,免费放送,全网唯一原创

    传统的做法往往需要开发者在`DevLoader`中手动勾选所需的jar包,但使用`TomcatPlugin`后,这一繁琐步骤将被自动化处理。 **TomcatPlugin介绍** `TomcatPlugin`是一款针对Apache Tomcat服务器的Eclipse插件,它极大...

Global site tag (gtag.js) - Google Analytics