🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.programmer
Article #181

Re: accessing a servlet from with a jar file

#181
From: Chris Smith
Date: Fri, 18 May 2001 12:16
32 lines
3054 bytes
Watch the cross-posting.  Followups set.

"Hugo Bouckaert" <hugo@fractalgraphics.com.au> wrote ...
> Is it possible to run a servlet that is zipped up in a jar file,
> directly from the browser?

Servlets never get run from browsers.  They get run directly in servlet
containers, which are either built into or a plugin to the web server.

Are you asking if you can run a servlet from a JAR file without extracting
it?  The answer is yes; it's a very common thing to do.  The servlet
container might extract it internally, but if it does it can generally watch
to see if you update the JAR file, and re-extract if you do.

> If so, what do I need to do to make it work on the server side?
> I am running Apache with JServ.

I'm sure this is possible with Apache/JServ.  However, *why* are you using
JServ?  Is there a good reason?  It will make your life miserable compared
to using a 2.2-compliant container such as Tomcat, Jetty, or Resin.

For example, if you were using Tomcat, you'd need to create your archive
file (include a WEB-INF/web.xml that includes all necessary configuration in
the archive itself, and put your classes under the WEB-INF/classes
directory), name the file something.war, and put it under
TOMCAT_HOME/webapps -- it should just work.  No configuration required.

For Resin, you'd put the file under RESIN_HOME/webapps; I'm sure something
similar exists for Jetty.  In any case, you don't need to change the actual
code.

Chris Smith
Technical Details
Message-ID: <9e33tm$or4$0@dosa.alt.net>
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.alt.net!usenet
References: <3B04D87D.EAE9034C@fractalgraphics.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d6b,1a1991afb9c88f20,start
X-Google-Attributes: gid111d6b,public
X-Google-Thread: 101d18,1a1991afb9c88f20,start
X-Google-Attributes: gid101d18,public
X-Google-Thread: f8b34,1a1991afb9c88f20,start
X-Google-Attributes: gidf8b34,public
X-Google-Thread: 10a146,1a1991afb9c88f20,start
X-Google-Attributes: gid10a146,public
X-Google-Thread: 10d6db,1a1991afb9c88f20,start
X-Google-Attributes: gid10d6db,public
X-Google-Thread: 113ae9,1a1991afb9c88f20,start
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 107d55,1a1991afb9c88f20,start
X-Google-Attributes: gid107d55,public
X-Google-ArrivalTime: 2001-05-18 05:17:59 PST
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.alt.net!usenet
From: "Chris Smith" <cdsmith@twu.net>
Newsgroups: comp.lang.java.programmer,comp.lang.java.help,comp.lang.java.misc,aus.computers.java,comp.infosystems.www.servers.unix,comp.lang.java.tech,microsoft.public.inetexplorer.ieak5.general
Subject: Re: accessing a servlet from with a jar file
Followup-To: comp.lang.java.programmer, comp.lang.java.help
Date: Fri, 18 May 2001 06:16:12 -0600
Organization: Altopia Corp. - Usenet Access - http://www.altopia.com
Lines: 35
Message-ID: <9e33tm$or4$0@dosa.alt.net>
References: <3B04D87D.EAE9034C@fractalgraphics.com.au>
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200