1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878
|
<HTML><HEAD><TITLE>Cocoon Installation Case</TITLE><LINK href="resources/simple.css" rel="stylesheet" title="Simple Style" type="text/css"></HEAD><BODY><P class="legal">Cocoon Documentation</P><H1 class="title">Cocoon Installation Case</H1><DOCUMENT>
<BODY>
<H1>Introduction - Cocoon Installation Case (Windows 2000)</H1><DIV id="s1">
<P>
I have successfully been able to get <STRONG>Cocoon V1.7.4</STRONG> to work with the following combination
of software :
</P>
<UL>
<LI><STRONG>Jakarta-Tomcat V3.1</STRONG></LI>
<LI><STRONG>Apache Web Server V1.3.12</STRONG></LI>
<LI><STRONG>Sun Java SDK SE V1.3</STRONG></LI>
<LI><STRONG>Windows 2000 Professional</STRONG></LI>
<LI><STRONG>Microsoft Internet Explorer V5.50.4134.0600</STRONG></LI>
</UL>
<P>
This information could be added to the <STRONG>Working Systems</STRONG> table within the
Cocoon installation document at <CODE>http://xml.apache.org/cocoon/install.html</CODE>.
</P>
<P>
What follows is some step by step info on how I got it all working. I am submitting this
for two reasons: one, as a reference for me for installations on other machines at a later
date and two, to provide some help to poor (hardware) engineers like myself who expect install
instructions to include <STRONG>every</STRONG> step to actually get the product working !!
</P>
<P>
Hope this is useful to someone.
</P>
</DIV>
<H1>How to do it !</H1><DIV id="s1">
<P>
I followed the standard Cocoon install instructions but without success. (Most of it is
there but it could be a bit clearer.)
</P>
<P>
I have listed below the <STRONG>key</STRONG> steps that actually got the combination shown
above to work.
</P>
<P>
I have included sections on installing Java SDK, Apache and Jakarta-Tomcat to avoid
any possible ambiguity. So, there may be more detail than is actually required - but
why not - as long as it all works in the end !
</P>
<P>
The relevant sections of the modified files mentioned have been partially listed.
</P>
<P>
The steps listed below mention my own machine name and my own specific paths. Substitute
your own naturally. I thought it was better to leave them in to avoid the "path to your..."
directives which can sometimes be ambiguous when it comes to how paths are specified within
the Windows environment i.e forward ("/") and backward slashes ("\") etc ..
</P>
<P class="note">
Warning : This is long and verbose ! The steps and file listings should be read in the order given i.e top
down to bottom.
</P>
<P class="note">
Before I started this setup on my machine, I did not have any pre-existing
Java SDK, Apache Web Server, Jakarta-Tomcat, Cocoon, or even anything in the
<CODE>CLASSPATH </CODE> env variable. It was a completely new install on a fresh Windows
2000 Professional machine.
</P>
<P>
OK lets go....
</P>
</DIV>
<H1>Java SDK SE V1.3</H1><DIV id="s1">
<UL>
<LI>Install Sun Java SDK SE V1.3 via the standard install procedure i.e execute the <CODE>.exe</CODE> file.</LI>
<LI>I chose to install at path <CODE>C:\Program_Files\jdk1.3</CODE> - Note the underscore in <CODE>Program_Files</CODE>.</LI>
<LI>No worries !</LI>
</UL>
</DIV>
<H1>Apache V1.3.12 HTTP Server</H1><DIV id="s1">
<UL>
<LI>Install Apache V1.3.12 via the standard install procedure i.e execute the <CODE>.exe</CODE> file.</LI>
<LI>I chose to install at path <CODE>C:\Program_Files\Apache Group</CODE></LI>
<LI>Modify the <CODE>C:\Program_Files\Apache Group\Apache\conf\httpd.conf</CODE> file to
include your machine DNS name. See code segment below.</LI>
<LI><STRONG>Note:</STRONG> Your system may already have a number of <CODE>http</CODE> servers running. This
is OK as long as there isn't a port clash. Ensure other httpd servers are <STRONG>not</STRONG>
also using port <CODE>80</CODE>.</LI>
<LI>Run the <STRONG>Install Apache as a Service</STRONG> program from the <STRONG>Apache Web Server</STRONG> menu of the
Windows 2000 Start Menu.</LI>
<LI>Ensure Apache is actually running by opening up the Windows 2000 <STRONG>Control panel</STRONG>,
double-left-clicking on <STRONG>Administrative Tools</STRONG> and through the <STRONG>Services</STRONG> program,
highlight the <STRONG>Apache</STRONG> service and menu select <CODE>Action|Start</CODE> i.e start Apache.</LI>
<LI>Try and access <CODE>http://shaggy.blimp.au</CODE>. You should get the
standard <STRONG>"If you can see this, it means that the installation of the Apache
web server software on this system was successful"</STRONG> page.</LI>
<LI>No worries!</LI>
</UL>
<P><CODE>C:\Program_Files\Apache Group\Apache\conf\httpd.conf</CODE></P>
<PRE>
....................
#
# ServerName allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e., use
# "www" instead of the host's real name).
#
# Note: You cannot just invent host names and hope they work. The name you
# define here must be a valid DNS name for your host. If you don't understand
# this, ask your network administrator.
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address (e.g., http://123.45.67.89/)
# anyway, and this will make redirections work in a sensible way.
#
ServerName shaggy.blimp.au
....................
#
# Port: The port to which the standalone server listens. For
# ports < 1023, you will need httpd to be run as root initially.
#
Port 80
....................
</PRE>
</DIV>
<H1>Jakarta-Tomcat V3.1</H1><DIV id="s1">
<UL>
<LI>Install Jakarta-Tomcat via the standard install procedure.</LI>
<LI>I chose to install (i.e unpack the zip) at path <CODE>C:\Program_Files\jakarta-tomcat</CODE> - Note
the underscore in <CODE>Program_Files</CODE>.</LI>
<LI>Go back to the Apache web site and grab the <CODE>ApacheModuleJServ.dll</CODE> file within the
<CODE>http://jakarta.apache.org/builds/tomcat/release/v3.1/bin/win32/i386/</CODE> directory.</LI>
<LI>Copy this file into the <CODE>C:\Program_Files\Apache Group\Apache\modules</CODE> directory.</LI>
<LI>Modify the Apache <CODE>httpd.conf</CODE> file to add the line "<CODE>include C:/Program_Files/jakarta-tomcat/conf/tomcat-apache.conf</CODE>"
to the end of <CODE>httpd.conf</CODE>. See code segment below. Note the forward "<CODE>/</CODE>" slashes in the path name. Note that the
<CODE>tomcat-apache</CODE> file is automatically created when Jakarta-Tomcat starts.</LI>
<LI>Modify <CODE>C:\Program_Files\jakarta-tomcat\bin\tomcat.bat</CODE> to add env variables <CODE>TOMCAT_HOME</CODE>
and <CODE>JAVA_HOME</CODE>. See code segment below.</LI>
<LI>Open up the Windows 2000 <STRONG>Control Panel</STRONG>, double-left-click <STRONG>Administrative Tools</STRONG>
and execute the <STRONG>Services</STRONG> program.</LI>
<LI>Kill Apache - highlight the <STRONG>Apache</STRONG> service and menu select <CODE>Action|Stop</CODE> i.e stop Apache.</LI>
<LI>Now open up a Windows 2000 <STRONG>Command Prompt</STRONG> and cd to directory - <CODE>C:\Program_Files\jakarta-tomcat\bin</CODE></LI>
<LI>Type <CODE>tomcat start</CODE>. Jakarta-Tomcat should start up in another Command Prompt window.</LI>
<LI>Go back to the Windows 2000 <STRONG>Services</STRONG> program and start the <STRONG>Apache</STRONG> service i.e <CODE>Action|Start</CODE>.</LI>
<LI>Start Internet Explorer.</LI>
<LI>Try and access the Jakarta-Tomcat <EM>JSP</EM> test page <CODE>http://shaggy.blimp.au:8080/examples/jsp/</CODE>
- Note the <CODE>8080</CODE> port in the address.</LI>
<LI>Click on any of the JSP examples to test.</LI>
<LI>Try and access the Jakarta-Tomcat <EM>Servlet</EM> test page <CODE>http://shaggy.blimp.au:8080/examples/servlets/</CODE>
- Note the <CODE>8080</CODE> port in the address.</LI>
<LI>Click on any of the servlet examples to test.</LI>
<LI>Note: You <STRONG>don't</STRONG> have to copy the Jakarta-Tomcat <CODE>C:\Program_Files\jakarta-tomcat\webapps\examples</CODE> directory to the
Apache <CODE>C:\Program_Files\Apache Group\Apache\htdocs</CODE> directory. Due to the <CODE>8080</CODE> port in the
web addresses shown above, the files in directory <CODE>C:\Program_Files\jakarta-tomcat\webapps\examples</CODE>
are actually referenced automatically by Jakarta-Tomcat.</LI>
<LI>No worries !</LI>
</UL>
<P><CODE>C:\Program_Files\Apache Group\Apache\conf\httpd.conf</CODE></P>
<PRE>
...........
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
#
#<VirtualHost ip.address.of.host.some_domain.com>
# ServerAdmin webmaster@host.some_domain.com
# DocumentRoot /www/docs/host.some_domain.com
# ServerName host.some_domain.com
# ErrorLog logs/host.some_domain.com-error_log
# CustomLog logs/host.some_domain.com-access_log common
#</VirtualHost>
#<VirtualHost _default_:*>
#</VirtualHost>
include C:/Program_Files/jakarta-tomcat/conf/tomcat-apache.conf
</PRE>
<P><CODE>C:\Program_Files\jakarta-tomcat\bin\tomcat.bat</CODE></P>
<PRE>
@echo off
rem A batch file to start/stop tomcat server.
rem This batch file written and tested under Windows NT
rem Improvements to this file are welcome
rem Guess TOMCAT_HOME if it is not present
set TOMCAT_HOME=C:\Program_Files\jakarta-tomcat
set JAVA_HOME=C:\Program_Files\jdk1.3
.........
</PRE>
</DIV>
<H1>Cocoon V1.7.4</H1><DIV id="s1">
<UL>
<LI>Install Cocoon via the standard install procedure.</LI>
<LI>I chose to install (i.e unpack the zip) at path <CODE>C:\Program_Files\cocoon-1.7.4</CODE> - Note
the underscore in <CODE>Program_Files.</CODE><EM>(Actually the important files in the Cocoon
distribution all end up being copied into the working Jakarta-Tomcat directories, so the unzipped
Cocoon can be either deleted or left where it is after the files have been copied.)</EM></LI>
<LI>Copy the <CODE>xerces_1_0_3.jar</CODE>, <CODE>xalan_1_0_1.jar</CODE>, <CODE>fop_0_12_1.jar</CODE> and <CODE>servlet_2_2.jar</CODE>
files, found in the <CODE>C:\Program_Files\cocoon-1.7.4\lib</CODE> to the
<CODE>C:\Program_Files\jakarta-tomcat\lib</CODE> directory.</LI>
<LI>Copy the <CODE>C:\Program_Files\cocoon-1.7.4\bin\cocoon.jar</CODE> file to the
<CODE>C:\Program_Files\jakarta-tomcat\lib</CODE> directory.</LI>
<LI>Modify <CODE>C:\Program_Files\jakarta-tomcat\bin\tomcat.bat</CODE> to add the five Cocoon <CODE>.jar</CODE>
files to the Jakarta-Tomcat <CODE>CLASSPATH</CODE> env variable. See code segment below.</LI>
<LI>Note the "<CODE>remed</CODE>" out <CODE>set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar</CODE> line.</LI>
<LI>Modify the <CODE>C:\Program_Files\jakarta-tomcat\conf\web.xml</CODE> file to add the Cocoon
specific configuration directives. See code segment below.</LI>
<LI>And now for the <STRONG>really really</STRONG> important step, copy the
<CODE>C:\Program_Files\cocoon-1.7.4\conf\cocoon.properties</CODE> file to the
<CODE>C:\Program_Files\jakarta-tomcat\webapps\ROOT</CODE> directory.</LI>
<LI>Now, if everything has been performed as specified above and if the gods
are smiling on you today, then (and you'll hate me if it doesn't) it should
all work now.</LI>
<LI>OK. To test it all, do the following :</LI>
<LI>If Jakarta-Tomcat is still running, then kill it by typing <CODE>tomcat stop</CODE> in a
Windows 2000 <STRONG>Command Prompt</STRONG> window which has been cded to <CODE>C:\Program_Files\jakarta-tomcat\bin</CODE>.</LI>
<LI>If Apache is still running, then kill it by menu selecting <CODE>Action|Stop</CODE>
through the Windows 2000 <STRONG>Services</STRONG> program.</LI>
<LI>Now, start up Jakarta-Tomcat as detailed in the <STRONG>Jakarta-Tomcat V3.1</STRONG> section shown above.</LI>
<LI>Now, start up Apache as detailed in the <STRONG>Apache V1.3.12 HTTP Server</STRONG> section shown above.</LI>
<LI>Start Internet Explorer.</LI>
<LI>The big test - try and access <CODE>http://shaggy.blimp.au:8080/Cocoon.xml</CODE> - You
should see the Cocoon V1.7.4 status page containing all of the internal configuration
information and settings specific to Cocoon. Note the <CODE>8080</CODE> port number.</LI>
<LI>Note the uppercase "<CODE>C</CODE>" in <CODE>Cocoon.xml</CODE>. Also, you won't find this file on the
hard disk, it is an internal page and its name is set in the <CODE>cocoon.properties</CODE>
file.</LI>
<LI>OK, if the internal Cocoon status page is working then you can try and access the
Cocoon examples as follows :</LI>
<LI>Copy the <CODE>C:\Program_Files\cocoon-1.7.4\samples</CODE> directory to the
<CODE>C:\Program_Files\jakarta-tomcat\webapps</CODE> directory.</LI>
<LI>Copy the <CODE>cocoon.properties</CODE> file to the new <CODE>C:\Program_Files\jakarta-tomcat\webapps\samples</CODE>
directory - again this is a <STRONG>really</STRONG> important step.</LI>
<LI>Kill Jakarta-Tomcat.</LI>
<LI>Kill Apache.</LI>
<LI>Restart Jakarta-Tomcat.</LI>
<LI>Restart Apache.</LI>
<LI>Try and access <CODE>http://shaggy.blimp.au:8080/samples/index.xml</CODE>. Note the <CODE>8080</CODE> port number.</LI>
<LI>You should see the Cocoon samples page.</LI>
<LI>Thats it.</LI>
<LI>Again, note that no files were copied into the <CODE>C:\Program_Files\Apache Group\Apache\htdocs</CODE>
directory. The Cocoon samples are found via Jakarta-Tomcat and port <CODE>8080</CODE>.</LI>
<LI>One last thing to try. Create a directory called <CODE>C:\Program_Files\jakarta-tomcat\webapps\gogo</CODE>.</LI>
<LI>Copy the Cocoon <CODE>hello-page.xml</CODE> and <CODE>hello-page-html.xsl</CODE> files found in the
<CODE>C:\Program_Files\cocoon-1.7.4\samples\hello</CODE> directory into the new <CODE>gogo</CODE> directory.</LI>
<LI>And again the <STRONG>really</STRONG> important step, copy the <CODE>cocoon.properties</CODE> file into the
new <CODE>gogo</CODE> directory.</LI>
<LI>Kill Jakarta-Tomcat.</LI>
<LI>Kill Apache.</LI>
<LI>Restart Jakarta-Tomcat.</LI>
<LI>Restart Apache.</LI>
<LI>Start Internet Explorer.</LI>
<LI>Try and access <CODE>http://shaggy.blimp.au:8080/gogo/hello.xml</CODE>.</LI>
<LI>You should see the Hello Page.</LI>
<LI>The purpose of the last few steps was to show how a new auto context can be
setup in the Jakarta-Tomcat <CODE>webapps</CODE> directory.
As I see it, put your own custom XML/XSL files in a directory that lives within the Jakarta-Tomcat
<CODE>webapps</CODE> directory. Make sure <CODE>cocoon.properites</CODE> is also in there.</LI>
<LI>You could also put your custom XML/XSL work into just the Jakarta-Tomcat <CODE>webapps/ROOT</CODE> directory and
as long as <CODE>cocoon.properties</CODE> is also in there (which it should be or else you won't be able
to see the internal <CODE>Cocoon.xml</CODE> status page) then it should all work from that <CODE>ROOT</CODE> directory.</LI>
<LI>In order to avoid Jakarta-Tomcat having to serve up everything on port <CODE>8080</CODE>, the
<CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache.conf</CODE> file can be modified by adding
the lines "<CODE>AddType text/xml .xml</CODE>" and "<CODE>AddHandler jserv-servlet .xml</CODE>". (Refer to the start of the listing for
<CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache-cocoon.conf</CODE> below to see where the line should be.)</LI>
<LI>After starting/stopping Jakarta-Tomcat and Apache in the same manner as described above you should now
be able to access XML files without specifying port <CODE>8080</CODE>. e.g <CODE>http://shaggy.blimp.au/samples/index.xml</CODE>.
<STRONG>Note :</STRONG> If your browser cannot find the file then make sure your <CODE>C:\Program_Files\jakarta-tomcat\conf\server.xml</CODE>
file has alias directives for the <CODE>samples</CODE> directory or follow the procedure in the next few steps.</LI>
<LI><STRONG>Note :</STRONG> You must be careful when making modifications to <CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache.conf</CODE>
because this file is automatically generated each time Jakarta-Tomcat starts and will therefore overwrite any
modifications you have made. To complicate matters, the contents of <CODE>C:\Program_Files\jakarta-tomcat\conf\server.xml</CODE>,
where you might specify some context "AutoSetup actions", determines some of the content of
<CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache.conf</CODE>, so simply making a once off copy of
<CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache.conf</CODE> and adding the "<CODE>AddHandler jserv-servlet .xml</CODE>"
line and referencing the copied <CODE>.conf</CODE> file with the <CODE>include</CODE> statement in
<CODE>C:\Program_Files\Apache Group\Apache\conf\httpd.conf</CODE> may also lead to problems.</LI>
<LI>My solution was to eliminate all context AutoSetup actions in <CODE>C:\Program_Files\jakarta-tomcat\conf\server.xml</CODE>, then copy
a freshly generated version of <CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache.conf</CODE> to <CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache-cocoon.conf</CODE>, then
add the line "<CODE>AddHandler jserv-servlet .xml</CODE>" to <CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache-cocoon.conf</CODE>, then
modify the include statement in <CODE>C:\Program_Files\Apache Group\Apache\conf\httpd.conf</CODE> to read
"<CODE>include C:/Program_Files/jakarta-tomcat/conf/tomcat-apache-cocoon.conf</CODE>". This method places the onus on the webmaster
to make sure the copied and modified version of <CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache-cocoon.conf</CODE> is always
up to date. See code segment below.</LI>
<LI>I have listed my simplified <CODE>C:\Program_Files\jakarta-tomcat\conf\server.xml</CODE> file. Note the references to my test <CODE>gogo</CODE>
directory in file <CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache-cocoon.conf</CODE> which are needed in order to get the
<CODE>hello-page.xml</CODE> example working without using port <CODE>8080</CODE> in the address. See code segment below.</LI>
<LI>Well, thats how I got it to work.</LI>
<LI>Works for me and I hope for you too.</LI>
<LI>Sorry for all the completely specfied file and directory paths, but it should at least be unambiguous. No worries !</LI>
</UL>
<P><CODE>C:\Program_Files\jakarta-tomcat\bin\tomcat.bat</CODE></P>
<PRE>
.................
set cp=%CLASSPATH%
set CLASSPATH=.
set CLASSPATH=%TOMCAT_HOME%\classes
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xerces_1_0_3.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xalan_1_0_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\fop_0_12_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet_2_2.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\cocoon.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
rem set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
.................
</PRE>
<P><CODE>C:\Program_Files\jakarta-tomcat\conf\web.xml</CODE></P>
<PRE>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>
default
</servlet-name>
<servlet-class>
org.apache.tomcat.servlets.DefaultServlet
</servlet-class>
<load-on-startup>
-2147483646
</load-on-startup>
</servlet>
<servlet>
<servlet-name>
invoker
</servlet-name>
<!--
org.apache.tomcat.servlets.NoInvokerServlet
-->
<servlet-class>
org.apache.tomcat.servlets.InvokerServlet
</servlet-class>
</servlet>
<servlet>
<servlet-name>
jsp
</servlet-name>
<servlet-class>
org.apache.jasper.runtime.JspServlet
</servlet-class>
<!-- uncomment the following to use Jikes for JSP compilation
<init-param>
<param-name>jspCompilerPlugin</param-name>
<param-value>org.apache.jasper.compiler.JikesJavaCompiler</param-value>
</init-param>
-->
<load-on-startup>
-2147483646
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
invoker
</servlet-name>
<url-pattern>
/servlet/*
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
jsp
</servlet-name>
<url-pattern>
*.jsp
</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<!-- Start Cocoon Section -->
<servlet>
<servlet-name>org.apache.cocoon.Cocoon</servlet-name>
<servlet-class>org.apache.cocoon.Cocoon</servlet-class>
<init-param>
<param-name>properties</param-name>
<param-value>
cocoon.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.cocoon.Cocoon</servlet-name>
<url-pattern>*.xml</url-pattern>
</servlet-mapping>
<!-- End Cocoon Section -->
<mime-mapping>
<extension>
txt
</extension>
<mime-type>
text/plain
</mime-type>
</mime-mapping>
..........
</PRE>
<P><CODE>C:\Program_Files\jakarta-tomcat\conf\tomcat-apache-cocoon.conf</CODE></P>
<PRE>
LoadModule jserv_module modules/ApacheModuleJServ.dll
ApJServManual on
ApJServDefaultProtocol ajpv12
ApJServSecretKey DISABLED
ApJServMountCopy on
ApJServLogLevel notice
ApJServDefaultPort 8007
AddType text/xml .xml
AddHandler jserv-servlet .xml
AddType test/jsp .jsp
AddHandler jserv-servlet .jsp
Alias /examples C:\Program_Files\jakarta-tomcat\webapps\examples
<Directory "C:\Program_Files\jakarta-tomcat\webapps\examples">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /examples/servlet /examples
<Location /examples/WEB-INF/ >
AllowOverride None
deny from all
</Location>
Alias /test C:\Program_Files\jakarta-tomcat\webapps\test
<Directory "C:\Program_Files\jakarta-tomcat\webapps\test">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /test/servlet /test
<Location /test/WEB-INF/ >
AllowOverride None
deny from all
</Location>
Alias /admin C:\Program_Files\jakarta-tomcat\webapps\admin
<Directory "C:\Program_Files\jakarta-tomcat\webapps\admin">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /admin/servlet /admin
<Location /admin/WEB-INF/ >
AllowOverride None
deny from all
</Location>
Alias /samples C:\Program_Files\jakarta-tomcat\webapps\samples
<Directory "C:\Program_Files\jakarta-tomcat\webapps\samples">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /samples/servlet /samples
<Location /samples/WEB-INF/ >
AllowOverride None
deny from all
</Location>
Alias /gogo C:\Program_Files\jakarta-tomcat\webapps\gogo
<Directory "C:\Program_Files\jakarta-tomcat\webapps\gogo">
Options Indexes FollowSymLinks
</Directory>
ApJServMount /gogo/servlet /gogo
<Location /gogo/WEB-INF/ >
AllowOverride None
deny from all
</Location>
ApJServMount /servlet /ROOT
</PRE>
<P><CODE>C:\Program_Files\jakarta-tomcat\conf\server.xml</CODE></P>
<PRE>
<?xml version="1.0" encoding="ISO-8859-1"?>
<Server>
<!-- Debug low-level events in XmlMapper startup -->
<xmlmapper:debug level="0" />
<!-- This is quite flexible; we can either have a log file per
module in Tomcat (example: ContextManager) or we can have
one for Servlets and one for Jasper, or we can just have
one tomcat.log for both Servlet and Jasper.
If you omit "path" there, then stderr should be used.
verbosityLevel values can be:
FATAL
ERROR
WARNING
INFORMATION
DEBUG
-->
<Logger name="tc_log"
path="logs/tomcat.log"
customOutput="yes" />
<Logger name="servlet_log"
path="logs/servlet.log"
customOutput="yes" />
<Logger name="JASPER_LOG"
path="logs/jasper.log"
verbosityLevel = "INFORMATION" />
<!-- Add "home" attribute if you want tomcat to be based on a
different directory
"home" is used to create work and to read webapps, but not
for libs or CLASSPATH.
Note that TOMCAT_HOME is where tomcat is installed, while
ContextManager home is the
base directory for contexts, webapps/ and work/
-->
<ContextManager debug="0" workDir="work" >
<!-- ContextInterceptor className="org.apache.tomcat.context.LogEvents" / -->
<ContextInterceptor className="org.apache.tomcat.context.AutoSetup" />
<ContextInterceptor className="org.apache.tomcat.context.DefaultCMSetter" />
<ContextInterceptor className="org.apache.tomcat.context.WorkDirInterceptor" />
<ContextInterceptor className="org.apache.tomcat.context.WebXmlReader" />
<ContextInterceptor className="org.apache.tomcat.context.LoadOnStartupInterceptor" />
<!-- Request processing -->
<RequestInterceptor className="org.apache.tomcat.request.SimpleMapper"
debug="0" />
<RequestInterceptor className="org.apache.tomcat.request.SessionInterceptor" />
<RequestInterceptor className="org.apache.tomcat.request.SecurityCheck" />
<RequestInterceptor className="org.apache.tomcat.request.FixHeaders" />
<Connector className="org.apache.tomcat.service.SimpleTcpConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
<Parameter name="port" value="8080"/>
</Connector>
<Connector className="org.apache.tomcat.service.SimpleTcpConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
<Parameter name="port" value="8007"/>
</Connector>
</ContextManager>
</Server>
</PRE>
<P><CODE>C:\Program_Files\Apache Group\Apache\conf\httpd.conf</CODE></P>
<PRE>
...........
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
#
#<VirtualHost ip.address.of.host.some_domain.com>
# ServerAdmin webmaster@host.some_domain.com
# DocumentRoot /www/docs/host.some_domain.com
# ServerName host.some_domain.com
# ErrorLog logs/host.some_domain.com-error_log
# CustomLog logs/host.some_domain.com-access_log common
#</VirtualHost>
#<VirtualHost _default_:*>
#</VirtualHost>
include C:/Program_Files/jakarta-tomcat/conf/tomcat-apache-cocoon.conf
</PRE>
</DIV>
<H1>Hints and Tips</H1><DIV id="s1">
<P>Being bit of a XML/XSL/JAVA etc novice, here are some hints that I now know but it would have
made life a lot easier if I knew them before I attempted Cocoon/Jakarta-Tomcat/Apache etc..</P>
<UL>
<LI>Don't be fooled...use the refresh button on the web browser when fiddling about. The cache is
your enemy in the early days !</LI>
<LI>Always stop/start Jakarta-Tomcat and Apache if you are adding/deleting files from the Jakarta-Tomcat <CODE>webapps</CODE> directory.</LI>
<LI>Understanding how Cocoon finds the <CODE>cocoon.properties</CODE> file is the key.</LI>
<LI>In order to make the starting and stopping of Apache/Jakarta-Tomcat/Cocoon a bit easier on my Windows 2000 Professional machine, I created two
Command Prompt shortcuts on my main desktop. One is called "Start Tomcat", the other is called "Stop Tomcat". These two shorcuts
both call <CODE>C:\Program_Files\jakarta-tomcat\bin\tomcat.bat</CODE> but with different arguments i.e for "Start Tomcat" I use
<CODE>%SystemRoot%\system32\cmd.exe /c "c:\program_files\jakarta-tomcat\bin\tomcat start"</CODE> and for "Stop Tomcat" I use
<CODE>%SystemRoot%\system32\cmd.exe /c "c:\program_files\jakarta-tomcat\bin\tomcat stop"</CODE>. The complete file listing for
<CODE>C:\Program_Files\jakarta-tomcat\bin\tomcat.bat</CODE> is shown below. I find these two shortcuts quite useful since they start and
stop the Apache service and Jakarta-Tomcat in the correct order and generally just makes life a little easier.</LI>
</UL>
<P>Regards - mark.evans@dsto.defence.gov.au</P>
<P><CODE>C:\Program_Files\jakarta-tomcat\bin\tomcat.bat</CODE></P>
<P class="note">Indented lines are meant to be part of the previous line. This formatting
is done for legibility.</P>
<PRE>
@echo off
rem A batch file to start/stop tomcat server.
rem This batch file written and tested under Windows NT
rem Improvements to this file are welcome
rem Guess TOMCAT_HOME if it is not present
set TOMCAT_HOME=c:\program_files\jakarta-tomcat
set JAVA_HOME=c:\program_files\jdk1.3
if not "%TOMCAT_HOME%" == "" goto gothome
SET TOMCAT_HOME=.
if exist %TOMCAT_HOME%\bin\tomcat.bat goto gothome
SET TOMCAT_HOME=..
if exist %TOMCAT_HOME%\bin\tomcat.bat goto gothome
SET TOMCAT_HOME=
echo Unable to determine the value of TOMCAT_HOME.
goto eof
:gothome
rem Set up the CLASSPATH that we need
set cp=%CLASSPATH%
rem set CLASSPATH=.
set CLASSPATH=%TOMCAT_HOME%\classes
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xerces_1_0_3.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xalan_1_0_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\fop_0_12_1.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet_2_2.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\cocoon.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\webserver.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\xml.jar
rem set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar
if "%cp%" == "" goto next
rem else
set CLASSPATH=%CLASSPATH%;%cp%
:next
if "%1" == "start" goto startServer
if "%1" == "stop" goto stopServer
if "%1" == "run" goto runServer
if "%1" == "env" goto setupEnv
if "%1" == "ant" goto runAnt
if "%1" == "jspc" goto runJspc
echo Usage:
echo tomcat (start^|run^|env^|stop)
echo start - start tomcat in a separate window
echo run - start tomcat in the current window
echo env - setup the environment for tomcat
echo stop - stop tomcat
echo ant - run ant with tomcat context
echo jspc - run jsp pre compiler
goto cleanup
:startServer
echo __________________________
echo Stopping Apache Web Server
echo __________________________
net stop apache
rem echo Using classpath: %CLASSPATH%
echo _______________________________________
echo Starting JAKARTA-TOMCAT in a new window
echo _______________________________________
start "TOMCAT is RUNNING" /min java %TOMCAT_OPTS%
-Dtomcat.home="%TOMCAT_HOME%" org.apache.tomcat.startup.Tomcat
%2 %3 %4 %5 %6 %7 %8 %9
echo __________________________
echo Starting Apache Web Server
echo __________________________
net start apache
goto cleanup
:runServer
rem Start the Tomcat Server
echo Using classpath: %CLASSPATH%
java %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup
:stopServer
rem Stop the Tomcat Server
rem echo Using classpath: %CLASSPATH%
echo ______________________
echo Sopping JAKARTA-TOMCAT
echo ______________________
java %TOMCAT_OPTS% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat -stop %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup
:runAnt
rem Run ant
set CLASSPATH=%CLASSPATH%;%TOMCAT_HOME%\lib\ant.jar
echo Using classpath: %CLASSPATH%
java %ANT_OPTS% -Dant.home="%TOMCAT_HOME%"
-Dtomcat.home="%TOMCAT_HOME%" org.apache.tools.ant.Main
%2 %3 %4 %5 %6 %7 %8 %9
goto cleanup
:runJspc
rem Run ant
echo Using classpath: %CLASSPATH%
java %JSPC_OPTS% -Dtomcat.home="%TOMCAT_HOME%" org.apache.jasper.JspC
%2 %3 %4 %5 %6 %7 %8 %9
goto cleanup
:setupEnv
set cp=%CLASSPATH%
:cleanup
rem clean up
set CLASSPATH=%cp%
set port=
set host=
set test=
set jsdkJars=
set jspJars=
set beanJars=
set miscJars=
set appJars=
set appClassPath=
set cp=
rem pause
:eof
</PRE>
</DIV>
</BODY>
</DOCUMENT><P class="legal">Copyright © 1999-2000 The Apache Software Foundation.<BR>All rights reserved.</P></BODY></HTML>
|