Hi, On the 17th, Costin added an 'etomcat' target:
> Added a target to build 'embeded' style tomcat, i.e. a single jar containing > everything ( no more lib/container, etc ). It is self-runnable and should start > tomcat with the defaults settings ( no server.xml, etc ) using the current dir > as base. Just add webapps and shake. > This is nice for people who just need a simple jar with no strings attached ( > configs, dir structure, etc ). It looked pretty broken when I tried it. The attached patch gets it compiled, I can now successfully start it by typing 'java -Dtomcat.home=... -jar webserver.jar'. The changes are: - Declare dep on target that creates build/classes - Change nonexistent ${servlet.jar} to ${servlet22.jar} - Exclude all *SSL*, *JSSE*, *TLS* java files unless jsse.present. The the previous approach of explicitly naming each class was not robust enough. I found fully 9 other classes that weren't being excluded. - Add the missing manifest.webserver, which I *guessed* should invoke EmbededTomcat with the classpath crimson.jar and servlet22.jar - Minor javadoc fixes in EmbededTomcat.java. Incidentally, any tips on classloaders and EmbededTomcat? Everything starts fine, but my servlet can't see any classes in WEB-INF/lib *unless* I explicitly use the context classloader. Oh well, that's for another mail. Thanks, --Jeff
? .bash_history ? .cvsrc ? .projrc ? .viminfo ? .vimrc ? etomcat.patch Index: build.xml =================================================================== RCS file: /home/cvspublic/jakarta-tomcat/build.xml,v retrieving revision 1.162 diff -u -r1.162 build.xml --- build.xml 2001/12/17 05:31:45 1.162 +++ build.xml 2001/12/25 14:00:15 @@ -598,7 +598,7 @@ <!-- ==================== Embeded tomcat ======== --> - <target name="etomcat" depends="init"> + <target name="etomcat" depends="init, prepare.dirs"> <javac destdir="${tomcat.build}/classes" debug="${debug}" optimize="${optimize}" @@ -608,28 +608,22 @@ <pathelement location="${jsse.lib}/jsse.jar"/> <pathelement location="${jsse.lib}/jnet.jar"/> <pathelement location="${jsse.lib}/jcert.jar"/> - <pathelement location="${servlet.jar}"/> + <pathelement location="${servlet22.jar}"/> </classpath> <include name="org/apache/**"/> - <exclude name="**/util/net/SSLSocketFactory.java" + <exclude name="**/*SSL*.java" unless="jsse.present"/> - <exclude name="**/util/net/SSLSocketFactory.java" - unless="jdk12.present"/> - <exclude name="**/util/compat/JSSECertCompat.java" + <exclude name="**/*JSSE*.java" unless="jsse.present"/> - <exclude name="**/util/compat/JSSECertCompat.java" - unless="jdk12.present"/> - <exclude name="**/util/compat/Jdk12Support.java" + <exclude name="**/*TLS*.java" + unless="jsse.present"/> + <exclude name="**/util/compat/Jdk12Support.java" unless="jdk12.present"/> <exclude name="**/util/depend/DependClassLoader12.java" unless="jdk12.present"/> <exclude name="**/util/depend/DependClassLoader12.java" - unless="jdk12.present"/> + unless="jdk12.present"/> <exclude name="**/util/compat/Jdk12Support.java" - unless="jdk12.present"/> - <exclude name="**/util/compat/JSSECertCompat.java" - unless="jsse.present"/> - <exclude name="**/util/compat/JSSECertCompat.java" unless="jdk12.present"/> </javac> @@ -657,7 +651,7 @@ <mkdir dir="${etomcat}" /> <copy file="${jaxp.home}/crimson.jar" todir="${etomcat}" /> - <copy file="${servlet.jar}" todir="${etomcat}" /> + <copy file="${servlet22.jar}" todir="${etomcat}" /> <jar jarfile="${etomcat}/webserver.jar" basedir="${tomcat.build}/classes" Index: src/build/manifests/manifest.webserver =================================================================== RCS file: manifest.webserver diff -N manifest.webserver --- /dev/null Tue Dec 25 05:58:21 2001 +++ manifest.webserver Tue Dec 25 06:00:16 2001 @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: org.apache.tomcat.startup.EmbededTomcat +Class-Path: crimson.jar servlet22.jar Index: src/share/org/apache/tomcat/startup/EmbededTomcat.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v retrieving revision 1.61 diff -u -r1.61 EmbededTomcat.java --- src/share/org/apache/tomcat/startup/EmbededTomcat.java 2001/12/17 05:27:05 1.61 +++ src/share/org/apache/tomcat/startup/EmbededTomcat.java 2001/12/25 14:00:29 @@ -31,62 +31,65 @@ * Use this class to embed tomcat in your application. If all you want is to * start/stop tomcat, with minimal customization, you can use Main.main() * - * This class is designed as a java bean, where you set different properties, + * <p>This class is designed as a java bean, where you set different properties, * then call methods to perform actions. The main method is "execute", that - * will start tomcat. Few other methods allow to perform different other tasks. + * will start tomcat. Few other methods allow to perform different other + * tasks.</p> * - * EmbededTomcat is usable as an "ant" task as well, using the TaskAdapter. - * ( see sample - TODO XXX ). + * <p>EmbededTomcat is usable as an "ant" task as well, using the TaskAdapter. + * ( see sample - TODO XXX ).</p> * - * Adding tomcat to your application: + * <p>Adding tomcat to your application:</p> * - * - Create a java class that will act as adapter and start tomcat ( and + * <ul> + * <li>Create a java class that will act as adapter and start tomcat ( and * hold your customization code ). The class and all the files in * TOMCAT_HOME/lib/common must be available in the class loader. * lib/container and lib/apps should _not_ be visible, EmbededTomcat * will handle that. All the application files you want visible from * tomcat must be included as well. - * ADVANCED1. Completely separated classloader + * ADVANCED1. Completely separated classloader</li> * - * - In your adapter, create an instance of EmbededTomcat. + * <li>In your adapter, create an instance of EmbededTomcat.</li> * - * - set properties you want to customize. + * <li>set properties you want to customize.</li> * - * - add all interceptors including your application-specific. That includes - * the connector modules ( shortcuts are provided for common sets of - * modules and for common connector configuration ). + * <li>add all interceptors including your application-specific. That + * includes the connector modules ( shortcuts are provided for common sets of + * modules and for common connector configuration ).</li> * - * - add the root context ( required ) and any other contexts you want. + * <li>add the root context ( required ) and any other contexts you want. * More context can be added at runtime. You can also use existing - * configuration modules that automatically add/deploy Contexts. + * configuration modules that automatically add/deploy Contexts.</li> * - * - call start(). Tomcat will initialize and start. The method returns - * when everything is ready. + * <li>call start(). Tomcat will initialize and start. The method returns + * when everything is ready.</li> * - * - You can add/remove contexts at runtime. + * <li>You can add/remove contexts at runtime.</li> * - * - call stop(). Tomcat will clean up all resources and shutdown ( clean - * shutdown ). All common modules have been tested and shouldn't leave - * any garbage, however it is possible that user code will leave threads - * or other garbage ( i.e. not clean on destroy ). If tomcat is run in - * a sandbox, this shouldn't be a problem ( as untrusted servlets can't - * create threads ). It is your responsiblity to make sure all apps you trust - * or custom modules support clean shutdown. + * <li>call stop(). Tomcat will clean up all resources and shutdown ( clean + * shutdown ). All common modules have been tested and shouldn't leave any + * garbage, however it is possible that user code will leave threads or other + * garbage ( i.e. not clean on destroy ). If tomcat is run in a sandbox, this + * shouldn't be a problem ( as untrusted servlets can't create threads ). It + * is your responsiblity to make sure all apps you trust or custom modules + * support clean shutdown.</li> * - * - ADVANCED2. You can throw away the classloader, and use another one + * <li>ADVANCED2. You can throw away the classloader, and use another one * if you start again. That would take care of all garbage and classes * except threads and associated objects ( there is no way to handle * dangling threads except killing them, assuming you can distinguish - * them from your own threads ). + * them from your own threads ).</li> + * </ul> * - * All file paths _should_ be absolute. If not, you should set "home" and - * make sure you include the "PathSetter" module before anything else. + * <p>All file paths _should_ be absolute. If not, you should set "home" and + * make sure you include the "PathSetter" module before anything else.</p> * * <b>Example1</b> * <pre> // Assume EmbededTomcat and all common jars are in CLASSPATH EmbededTomcat tomcat=new EmbededTomcat(); - tomcat.setInstallDir( installDir ); + tomcat.setInstall( installDir ); // tomcat.setDebug( debug ); // tomcat.setAutoDeploy( false ); // no webapps/ is used Index: src/share/org/apache/tomcat/startup/Main.java =================================================================== RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java,v retrieving revision 1.41 diff -u -r1.41 Main.java --- src/share/org/apache/tomcat/startup/Main.java 2001/09/09 00:46:28 1.41 +++ src/share/org/apache/tomcat/startup/Main.java 2001/12/25 14:00:40 @@ -85,7 +85,7 @@ * a properties file, locate the actual class that will be started. * <p> * It'll then construct a class loader ( common ) from the content of a - * specified directory and/or additionl system property. Based on the first + * specified directory and/or additional system property. Based on the first * argument, it'll instantiate a class ( in the created class loader ), set the * parameters, and call it's execute() method. * @@ -175,6 +175,9 @@ } } + /** + * Sets up the parentL and commonCL properties, using the commonCP list. + */ public void initClassLoader() { if( parentL==null ) parentL=this.getClass().getClassLoader();
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>