Re: Tomcat 8 : Shared loader

2016-06-15 Thread Amit Pande
Thank you Mark for your valuable inputs. They are indeed a great help.

Thanks,
Amit

On 15/06/16 7:00 pm, "Mark Thomas"  wrote:

>On 15/06/2016 12:03, Amit Pande wrote:
>> 
>> 
>> On 15/06/16 4:06 pm, "Mark Thomas"  wrote:
>> 
>>> On 15/06/2016 11:00, Amit Pande wrote:
 We develop multiple web application which happen to share the same
 stack (Spring, Hibernate,etc).

 Thinking of sharing these third party libraries instead of duplicating
 in each web app war.
>>>
>>> Why?
>> To avoid jar duplication and improve memory footprint
>
>Is memory footprint really that much of an issue?
>
 IIUC, putting those in Tomcat (8)'s lib folder might cause issues
since
 the classes in there are loaded by a common loader.
>>>
>>> What issues?
>> Since loaded by a common class loader , the jars put in here will be
>> available to tomcat internal classes,even if not required , also need be
>> to thread safe.
>
>What is the harm in these classes being visible to Tomcat?
>
>I fail to see what thread-safety has to do with this.
>
>You do need to think about memory leaks though.
>
 And sharing such libraries using the shared loader seems a better
 approach.
>>>
>>> Why?
>> As loaded by shared loader which seems to be meant for sharing
>> libraries across web apps ŠI guess here also the thread safely concern
>> exists , need to validate though.
>
>As above, thread-safety is not a relevant concern.
>
 Is my understanding correct ?
>>>
>>> No idea. You have not explained your understanding yet.
>> Hope it is explained now.
>
>It has. And your understanding, particularly around thread safety is not
>correct.
>
 Does it have any further issues ?
>>>
>>> Further issues compared to what?
>> It was a general awareness question to get to know if people ran into
>> some issues after putting jars in tomcat¹s shared loader's path.
>
>It increases the risk of issues due to:
>- memory leaks since few libraries are written with a multi-class loader
>environment in mind
>- upgrades are harder since you have to take Tomcat down to upgrade any
>shared library
>- dependency management is harder since all webapps have to use the same
>set of dependencies
>
 That said, I don't see much documentation around using shared loader.
 Any documentation/help in this regard is highly appreciated.
>>>
>>> There isn't much call for the shared loader. You need to go back to the
>>> 5.5.x documentation for a diagram that includes the shared loader.
>>>
>>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
>> 
>> Thanks for this. In absence of clear documentation in recent release, I
>> was doubtful if it was deprecated.
>
>Not deprecated. Just rarely useful so disabled by default.
>
>Generally, it causes more problems than it solves so unless you are
>really under memory pressure it isn't worth the trouble.
>
>Mark
>
>
>-
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>



RE: How to cancel download on the server side

2016-06-15 Thread Bill Miller
Do you have the ability to have multiple client-server connections open? You 
could have a second channel to the server that can communicate the status to 
the client and when/if there is a problem indicate through that status channel 
that the download has been truncated. Not the greatest idea because it will 
require multiple connections to the server which could overload your server AND 
it may not be cluster friendly if that matters.

Bill

-Original Message-
From: Steffen Heil (Mailinglisten) [mailto:li...@steffen-heil.de] 
Sent: Wednesday, June 01, 2016 5:28 PM
To: Tomcat Users List
Subject: AW: How to cancel download on the server side

Hi


> I believe that, while the HTTP specification supports what you want to do, 
> neither servers nor clients support it. For example, you can
> use "trailers" (headers end the end of the response) to tell the client what 
> happened, but I suspect that no client will actually read
> them or act on them.

I did not even know such things exist.
A quick google check seems to indicate that you are right: No real client 
supports them in a way usable for me.


> You can always force a disconnect by simply closing the response stream. 
> Usually, the client will either tell the user that the download
> failed (connection closed before response - or chunk of response - 
> completed), more likely just shows the user a blank page or saves
> an incomplete file.

That's another story.
I tried that. And the internet explorer as well as curl report an error, if the 
download stops without the ending 0\r\n.

But I had to set "Connection: close" and "Transfer-Encoding: chunked" myself 
and encode the chunk headers myself.
If I leave these two headers out, tomcat managed the transfer-encoding (as I 
set no Content-Length header) which I would prefer.
However then I find no way to close the connection. If I call "close()" on the 
OutputStream tomcat sends 0\r\n.
Even if I throw an exception, tomcat "correctly" closes the stream.
I did not find any way to close it without that.

Is there any way to do so?


Regards,
  Steffen



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



Re: Tomcat 8 : Shared loader

2016-06-15 Thread Mark Thomas
On 15/06/2016 12:03, Amit Pande wrote:
> 
> 
> On 15/06/16 4:06 pm, "Mark Thomas"  wrote:
> 
>> On 15/06/2016 11:00, Amit Pande wrote:
>>> We develop multiple web application which happen to share the same
>>> stack (Spring, Hibernate,etc).
>>>
>>> Thinking of sharing these third party libraries instead of duplicating
>>> in each web app war.
>>
>> Why?
> To avoid jar duplication and improve memory footprint

Is memory footprint really that much of an issue?

>>> IIUC, putting those in Tomcat (8)'s lib folder might cause issues since
>>> the classes in there are loaded by a common loader.
>>
>> What issues?
> Since loaded by a common class loader , the jars put in here will be
> available to tomcat internal classes,even if not required , also need be
> to thread safe.

What is the harm in these classes being visible to Tomcat?

I fail to see what thread-safety has to do with this.

You do need to think about memory leaks though.

>>> And sharing such libraries using the shared loader seems a better
>>> approach.
>>
>> Why?
> As loaded by shared loader which seems to be meant for sharing
> libraries across web apps ŠI guess here also the thread safely concern
> exists , need to validate though.

As above, thread-safety is not a relevant concern.

>>> Is my understanding correct ?
>>
>> No idea. You have not explained your understanding yet.
> Hope it is explained now.

It has. And your understanding, particularly around thread safety is not
correct.

>>> Does it have any further issues ?
>>
>> Further issues compared to what?
> It was a general awareness question to get to know if people ran into
> some issues after putting jars in tomcat¹s shared loader's path.

It increases the risk of issues due to:
- memory leaks since few libraries are written with a multi-class loader
environment in mind
- upgrades are harder since you have to take Tomcat down to upgrade any
shared library
- dependency management is harder since all webapps have to use the same
set of dependencies

>>> That said, I don't see much documentation around using shared loader.
>>> Any documentation/help in this regard is highly appreciated.
>>
>> There isn't much call for the shared loader. You need to go back to the
>> 5.5.x documentation for a diagram that includes the shared loader.
>>
>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
> 
> Thanks for this. In absence of clear documentation in recent release, I
> was doubtful if it was deprecated.

Not deprecated. Just rarely useful so disabled by default.

Generally, it causes more problems than it solves so unless you are
really under memory pressure it isn't worth the trouble.

Mark


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



RE: Tomcat 8 : Shared loader

2016-06-15 Thread Lulseged Zerfu
No issues except that you may need to update jarsToSkip if not already in that 
list.
BRLulseged

> From: amit.pa...@veritas.com
> To: users@tomcat.apache.org
> Subject: Re: Tomcat 8 : Shared loader
> Date: Wed, 15 Jun 2016 12:46:40 +
> 
> Thanks a lot, Lulseged for your inputs.
> 
> With this approach, did you see any apparent issues / precautions that we
> should be aware of ?
> 
> Thanks,
> Amit
> 
> On 15/06/16 3:54 pm, "Lulseged Zerfu"  wrote:
> 
> >It should be shared.loader:
> >shared.loader="${catalina.base}/shared"
> >
> >> From: zlulse...@hotmail.com
> >> To: users@tomcat.apache.org
> >> Subject: RE: Tomcat 8 : Shared loader
> >> Date: Wed, 15 Jun 2016 10:21:39 +
> >> 
> >> Hi
> >> I have also same problem and have solved it by using shared folder.
> >> Look at the catalina.properties file under $CATALINA_HOME/conf
> >> You can look in to the common.loader an server.loader how to define
> >>loaders. 
> >> You should add loaders in the same way in the shared.loader.
> >> I have created $CATALINA_HOME/shared and added my libraries here.
> >> server.loader="${catalina.base}/shared"
> >> Hope it helps.
> >> Lulseged Zerfu
> >> 
> >> > From: amit.pa...@veritas.com
> >> > To: users@tomcat.apache.org
> >> > Subject: Tomcat 8 : Shared loader
> >> > Date: Wed, 15 Jun 2016 10:00:51 +
> >> > 
> >> > We develop multiple web application which happen to share the same
> >>stack (Spring, Hibernate,etc).
> >> > 
> >> > Thinking of sharing these third party libraries instead of
> >>duplicating in each web app war.
> >> > 
> >> > IIUC, putting those in Tomcat (8)'s lib folder might cause issues
> >>since the classes in there are loaded by a common loader.
> >> > 
> >> > And sharing such libraries using the shared loader seems a better
> >>approach.  Is my understanding correct ? Does it have any further issues
> >>?
> >> > 
> >> > That said, I don't see much documentation around using shared loader.
> >>Any documentation/help in this regard is highly appreciated.
> >> > 
> >> > Thanks,
> >> > Amit
> >> > 
> >>  
> >   
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

Re: Tomcat 8 : Shared loader

2016-06-15 Thread Amit Pande
Thanks a lot, Lulseged for your inputs.

With this approach, did you see any apparent issues / precautions that we
should be aware of ?

Thanks,
Amit

On 15/06/16 3:54 pm, "Lulseged Zerfu"  wrote:

>It should be shared.loader:
>shared.loader="${catalina.base}/shared"
>
>> From: zlulse...@hotmail.com
>> To: users@tomcat.apache.org
>> Subject: RE: Tomcat 8 : Shared loader
>> Date: Wed, 15 Jun 2016 10:21:39 +
>> 
>> Hi
>> I have also same problem and have solved it by using shared folder.
>> Look at the catalina.properties file under $CATALINA_HOME/conf
>> You can look in to the common.loader an server.loader how to define
>>loaders. 
>> You should add loaders in the same way in the shared.loader.
>> I have created $CATALINA_HOME/shared and added my libraries here.
>> server.loader="${catalina.base}/shared"
>> Hope it helps.
>> Lulseged Zerfu
>> 
>> > From: amit.pa...@veritas.com
>> > To: users@tomcat.apache.org
>> > Subject: Tomcat 8 : Shared loader
>> > Date: Wed, 15 Jun 2016 10:00:51 +
>> > 
>> > We develop multiple web application which happen to share the same
>>stack (Spring, Hibernate,etc).
>> > 
>> > Thinking of sharing these third party libraries instead of
>>duplicating in each web app war.
>> > 
>> > IIUC, putting those in Tomcat (8)'s lib folder might cause issues
>>since the classes in there are loaded by a common loader.
>> > 
>> > And sharing such libraries using the shared loader seems a better
>>approach.  Is my understanding correct ? Does it have any further issues
>>?
>> > 
>> > That said, I don't see much documentation around using shared loader.
>>Any documentation/help in this regard is highly appreciated.
>> > 
>> > Thanks,
>> > Amit
>> > 
>>
> 


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



Re: Tomcat 8 : Shared loader

2016-06-15 Thread Amit Pande


On 15/06/16 4:06 pm, "Mark Thomas"  wrote:

>On 15/06/2016 11:00, Amit Pande wrote:
>> We develop multiple web application which happen to share the same
>>stack (Spring, Hibernate,etc).
>> 
>> Thinking of sharing these third party libraries instead of duplicating
>>in each web app war.
>
>Why?
>> To avoid jar duplication and improve memory footprint
>
>> IIUC, putting those in Tomcat (8)'s lib folder might cause issues since
>>the classes in there are loaded by a common loader.
>
>What issues?
>> Since loaded by a common class loader , the jars put in here will be
>>available to tomcat internal classes,even if not required , also need be
>>to thread safe.
>
>> And sharing such libraries using the shared loader seems a better
>>approach.
>
>Why?
>> As loaded by shared loader which seems to be meant for sharing
>>libraries across web apps ŠI guess here also the thread safely concern
>>exists , need to validate though.
>
>> Is my understanding correct ?
>
>No idea. You have not explained your understanding yet.
>> Hope it is explained now.
>
>> Does it have any further issues ?
>
>Further issues compared to what?
>> It was a general awareness question to get to know if people ran into
>>some issues after putting jars in tomcat¹s shared loader's path.
>
>> That said, I don't see much documentation around using shared loader.
>>Any documentation/help in this regard is highly appreciated.
>
>There isn't much call for the shared loader. You need to go back to the
>5.5.x documentation for a diagram that includes the shared loader.
>
>http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

>> Thanks for this. In absence of clear documentation in recent release, I
>>was doubtful if it was deprecated.
>
>Mark
>
>-
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>


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



Re: Tomcat 8 : Shared loader

2016-06-15 Thread Mark Thomas
On 15/06/2016 11:00, Amit Pande wrote:
> We develop multiple web application which happen to share the same stack 
> (Spring, Hibernate,etc).
> 
> Thinking of sharing these third party libraries instead of duplicating in 
> each web app war.

Why?

> IIUC, putting those in Tomcat (8)'s lib folder might cause issues since the 
> classes in there are loaded by a common loader.

What issues?

> And sharing such libraries using the shared loader seems a better approach.

Why?

> Is my understanding correct ?

No idea. You have not explained your understanding yet.

> Does it have any further issues ?

Further issues compared to what?

> That said, I don't see much documentation around using shared loader. Any 
> documentation/help in this regard is highly appreciated.

There isn't much call for the shared loader. You need to go back to the
5.5.x documentation for a diagram that includes the shared loader.

http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

Mark

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



RE: Tomcat 8 : Shared loader

2016-06-15 Thread Lulseged Zerfu
It should be shared.loader:
shared.loader="${catalina.base}/shared"

> From: zlulse...@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: Tomcat 8 : Shared loader
> Date: Wed, 15 Jun 2016 10:21:39 +
> 
> Hi
> I have also same problem and have solved it by using shared folder.
> Look at the catalina.properties file under $CATALINA_HOME/conf
> You can look in to the common.loader an server.loader how to define loaders. 
> You should add loaders in the same way in the shared.loader.
> I have created $CATALINA_HOME/shared and added my libraries here.
> server.loader="${catalina.base}/shared"
> Hope it helps.
> Lulseged Zerfu
> 
> > From: amit.pa...@veritas.com
> > To: users@tomcat.apache.org
> > Subject: Tomcat 8 : Shared loader 
> > Date: Wed, 15 Jun 2016 10:00:51 +
> > 
> > We develop multiple web application which happen to share the same stack 
> > (Spring, Hibernate,etc).
> > 
> > Thinking of sharing these third party libraries instead of duplicating in 
> > each web app war.
> > 
> > IIUC, putting those in Tomcat (8)'s lib folder might cause issues since the 
> > classes in there are loaded by a common loader.
> > 
> > And sharing such libraries using the shared loader seems a better approach. 
> >  Is my understanding correct ? Does it have any further issues ?
> > 
> > That said, I don't see much documentation around using shared loader. Any 
> > documentation/help in this regard is highly appreciated.
> > 
> > Thanks,
> > Amit
> > 
> 
  

RE: Tomcat 8 : Shared loader

2016-06-15 Thread Lulseged Zerfu
Hi
I have also same problem and have solved it by using shared folder.
Look at the catalina.properties file under $CATALINA_HOME/conf
You can look in to the common.loader an server.loader how to define loaders. 
You should add loaders in the same way in the shared.loader.
I have created $CATALINA_HOME/shared and added my libraries here.
server.loader="${catalina.base}/shared"
Hope it helps.
Lulseged Zerfu

> From: amit.pa...@veritas.com
> To: users@tomcat.apache.org
> Subject: Tomcat 8 : Shared loader 
> Date: Wed, 15 Jun 2016 10:00:51 +
> 
> We develop multiple web application which happen to share the same stack 
> (Spring, Hibernate,etc).
> 
> Thinking of sharing these third party libraries instead of duplicating in 
> each web app war.
> 
> IIUC, putting those in Tomcat (8)'s lib folder might cause issues since the 
> classes in there are loaded by a common loader.
> 
> And sharing such libraries using the shared loader seems a better approach.  
> Is my understanding correct ? Does it have any further issues ?
> 
> That said, I don't see much documentation around using shared loader. Any 
> documentation/help in this regard is highly appreciated.
> 
> Thanks,
> Amit
> 
  

Tomcat 8 : Shared loader

2016-06-15 Thread Amit Pande
We develop multiple web application which happen to share the same stack 
(Spring, Hibernate,etc).

Thinking of sharing these third party libraries instead of duplicating in each 
web app war.

IIUC, putting those in Tomcat (8)'s lib folder might cause issues since the 
classes in there are loaded by a common loader.

And sharing such libraries using the shared loader seems a better approach.  Is 
my understanding correct ? Does it have any further issues ?

That said, I don't see much documentation around using shared loader. Any 
documentation/help in this regard is highly appreciated.

Thanks,
Amit