You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Franklin Russell <fr...@yahoo.com> on 2000/02/14 19:23:03 UTC

JServ and Tomcat

I am confused about where the line is drawn between JServ and Tomcat. 
I've successfully run Apache w/ JServ and used servlets effectively.  
I've also used Tomcat by itself (no Apache or anything else) as a web
server, servlet engine, and JSP engine.  But I'm guessing no one uses
Tomcat stand alone for commercial applications.  Do most people run
Apache and then point all the .jsp files at the Tomcat?  (I haven't
been able to make that work right.)  Is that how Apache plans on
leaving it or is JSP support ever going to be built right into JServ? 
If so when is that going to happen?

Thanks,
Franklin Russell
franklin_russell@yahoo.com

  

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: XML File format

Posted by Laird Nelson <lj...@unix.amherst.edu>.
Brill Pappin wrote:
> I mean, why use this format:
> <init-param>
>               <param-name>file</param-name>
>               <param-value>/usr/local/etc/jsp/jsp.properties</param-value>
> </init-param>
> 
> rather than this format?:
> <init-param name="file" value="/usr/local/etc/jsp/jsp.properties"/>

The second does not permit multiple param-values, for one.

Cheers,
Laird

XML File format

Posted by Brill Pappin <br...@jmonkey.com>.
Quick question:
Why was the XML file set up the way it was?

I mean, why use this format:
<init-param>
              <param-name>file</param-name>
              <param-value>/usr/local/etc/jsp/jsp.properties</param-value>
</init-param>

rather than this format?:
<init-param name="file" value="/usr/local/etc/jsp/jsp.properties"/>

The second seems much cleaner to me... and is clearer to read when perusing
the file.


- Brill Pappin
  www.jmonkey.com


Re: How to init a JSP

Posted by Gunther Schadow <gu...@aurora.rg.iupui.edu>.
your init-param thing seems fine to me, however, you may encounter
a whitespace problem here, I'm not sure.

To remember:

(1) the init-param element repeats for each parameter

(2) try this instead

         <init-param>
             <param-name>file</param-name>
             <param-value>/usr/local/etc/jsp/jsp.properties</param-value>
         </init-param>

(3) However, I have no idea why/how you can use the snoop.jsp file
as a servlet. Why do you need init parameters for a jsp page? I
don't understand this, but it doesn't mean it's wrong.

(4) If you have a real servlet, you should have something like

      <servlet>
        <servlet-name>myservlet</servlet-name>
        <servlet-class>org.myorg.mypack.MyServlet</servlet-class>
	<!-- init parameters here -->
      </servlet>

      <servlet-mapping>
	 <servlet-name>myservlet</servlet-name>
	 <url-pattern>/myservlet</url-pattern>
      </servlet-mapping>

The servlet mapping element turned out to be important for me so that
the servlet would be activated through

	URL: http://myhost.org/myservlet

of course you have to make sure that the apache.conf and the server.xml
files also know about your web-app context.

regards
-Gunther


Antonio Merighi wrote:
> 
> I would like to know how to set init parameters to a JSP.
> I saw that for servlets there is the web.xml  in WEB-INF,
> but I don't know how to use it for a jsp that it isn't under
> WEB-INF, but it's in jsp directory, like the snoop.jsp in
> "example" context.
> I tried to write a web.xml file like:
> 
> <web-app>
>     <servlet>
>         <servlet-name>
>             snoop.jsp
>         </servlet-name>
>         <jsp-file>
>             /examples/jsp/snoop.jsp
>         </jsp-file>
>         <init-param>
>             <param-name>
>                 file
>             </param-name>
>             <param-value>
>                 /usr/local/etc/jsp/jsp.properties
>            </param-value>
>         </init-param>
>     </servlet>
> </web-app>
> 
> but it seems it didn't like it.
> Where are my mistakes?
> Thanks.
> Antonio
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org

How to init a JSP

Posted by Antonio Merighi <me...@mail.eng.it>.
I would like to know how to set init parameters to a JSP.
I saw that for servlets there is the web.xml  in WEB-INF,
but I don't know how to use it for a jsp that it isn't under
WEB-INF, but it's in jsp directory, like the snoop.jsp in
"example" context.
I tried to write a web.xml file like:

<web-app>
    <servlet>
        <servlet-name>
            snoop.jsp
        </servlet-name>
        <jsp-file>
            /examples/jsp/snoop.jsp
        </jsp-file>
        <init-param>
            <param-name>
                file
            </param-name>
            <param-value>
                /usr/local/etc/jsp/jsp.properties
           </param-value>
        </init-param>
    </servlet>
</web-app>

but it seems it didn't like it.
Where are my mistakes?
Thanks.
Antonio


Re: JServ and Tomcat

Posted by Gunther Schadow <gu...@aurora.rg.iupui.edu>.
Franklin Russell wrote:
> 
> I am confused about where the line is drawn between JServ and Tomcat.
> I've successfully run Apache w/ JServ and used servlets effectively.
> I've also used Tomcat by itself (no Apache or anything else) as a web
> server, servlet engine, and JSP engine.  But I'm guessing no one uses
> Tomcat stand alone for commercial applications.  Do most people run
> Apache and then point all the .jsp files at the Tomcat?  (I haven't
> been able to make that work right.)  Is that how Apache plans on
> leaving it or is JSP support ever going to be built right into JServ?
> If so when is that going to happen?

Franklin, 

I have just installed Tomcat with Apache and I also ported an old
style ApacheJServ Servlet to using Tomcat now. It seems like straight
forward (if you know how.) This is what I recall:

1 Configuration

Pretty much all of the configuration stuff has changed. Where
JServ used these jserv.properties and zone.properties, tomcat uses
XML files $TOMCAT_HOME/service.xml and $APP_HOME/WEB-INF/web.xml.

This is all badly documented, but from the examples and the DTDs you
can find out about some of this (and still you don't know whether 
it's actually supported by the implementation.)  I suggest using 
the example and shrink it down more and more until you understand
every bit of the configuration of that example.

The Apache configuration for mod_jserv is similar, however, you have
less options. You can't do autostart.

2 General architecture

You have to manually launch tomcat, but in $TOMCAT_HOME/server.xml
you configure that it will only serve ajp12 at port 8007. For a
serious use I would turn off the tomcat HTTP server at 8080. Just
delete the unused stuff from the server.xml file and you see more
clearly what it does.

So now you have the following components:

(1) Apache with mod_jserv (and mod_ssl and other mods if you like)
  apache.conf section on mod_jserv having
     ...Manual on
  and use AJP12 on localhost port 8007

forget about jserv.properties and zone.properties (however,
jserv.properties is still read by mod_jserv, so you can try
hacking on it if you want to make autostart work. I tried but
gave up.

(2) JVM running tomcat's AJP12 only.

This very much resembles the old ApacheJServ way of life.


3 Conbfiguring Contexts (was "Zones")

This has all changed.  Every web application now lives in one subdirectory.
That subdirectory contains at least the following (suppose your app is "myapp")

myapp/		       - put HTML and JSP pages in here
myapp/WEB-INF
myapp/WEB-INF/web.xml  - the configuration, was "zone.properties"
myapp/WEB-INF/classes  - a directory with the class files of your Servlets
myapp/WEB-INF/lib      - a directory with JAR files to load, 
			 however, this lib-thing seems to not work!

You can read the JSP specification document on more of this. The lib
JAR autoloading seems to not work with my tomcat. So I either add these
jars into the CLASSPATH used to start tomcat or I unjarr them in the
WEB-INF/classes directory.

You now have to configure Apache to redirect requests to myapp to tomcat
and you have to configure tomcat server.xml to understand that myapp is
one of its "contexts" and where to find it on your file system. Then
you configure in web.xml what your servlets are, what init papameter
you want. Note that a servlet will usually need the <servlet> XML 
element and the servlet map XML element.

Start with the examples.

Don't worry what /root means and the / context. I don't know what it
is, but it seems to not hurt you if you do not try to mess with it.

hope this helps,
good luck
-Gunther