tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <paul_t...@fastmail.fm>
Subject Re: Where can I store data files in a tomcat war
Date Thu, 03 Jul 2014 19:21:28 GMT
On 03/07/2014 16:03, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Paul,
>
> On 7/2/14, 4:28 PM, Paul Taylor wrote:
>> On 02/07/2014 16:34, Christopher Schultz wrote:
>>> The solution is that the web application, packaged in a WAR
>>> file, needs to unpack the Lucene indexes onto the disk when it
>>> starts up. You can do this with a ServletContextListener.
>> So I do within init() method of my servlet, but EB doesnt wait for
>> the init() method to finish before declaring the application ready,
>> do you think it would wait for code using a ServletContextListener
>> or fail in the same way it does for init() ?
> Which init() are you talking about?

GenericServlet.init(), is this method not designed for what I was doing

> If EB marks the cluster node as
> available before the webapp has completed deploying, that sounds like
> a big problem. If you are using servlet.init() without any
> load-on-startup for that servlet, then I would expect the bad behavior
> you describe.
I dont understand what you are getting at here when you say 
'load-on-startup'
> I think you'll have better luck with
> ServletContextListener, because the servlet spec guarantees those to
> be complete before the webapp can receive requests.
Okay, well the good news is that I now have it working with AWS 
ebextensions and it wasn't so difficult in the end.

> You want to manage the streams yourself: hook a gzip reader up to a
> tar reader and then read files from the tar reader:
>
> GzipInputStream gzin = new GzipInputStream(tgzFile);
> TarInputStream tin = new TarInputStream(gzin);
>
> InputStream fin;
>
> while(fin = tin.getNextFile())
>     copy(fin, new File(localFilename));
>
> That's oversimplified, but essentially what you want to do. There is
> no need to completely expand the gzip archive before reading files out
> of it.
Ok, thanks good to know

thanks for your help

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message