You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chew Kok Hoor <ko...@gmail.com> on 2021/12/27 23:36:43 UTC
ClassFileTransformer in Tomcat 10 common classloader
Hi,
We're using the old javax.servlet namespace for compatibility reasons.
Some of our jar files are re-used by different web-apps, therefore we
placed them in the common classloader.
Is it possible to convert them dynamically, just like how we do it for
servlets in the per app WEB-INF folder, by using the following in the
context file:
<Loader jakartaConverter="TOMCAT" />
Thanks.
Regards,
Kok Hoor
Re: ClassFileTransformer in Tomcat 10 common classloader
Posted by Chew Kok Hoor <ko...@gmail.com>.
Sure Chris, thanks for advice!
Have a great day!
Regards,
Kok Hoor
On Tue, Dec 28, 2021 at 8:23 AM Christopher Schultz <
chris@christopherschultz.net> wrote:
> Kok Hoor,
>
> On 12/27/21 19:08, Chew Kok Hoor wrote:
> > Thanks for prompt response. We have like maybe 50 webapps, and they
> are
> > common (except that they have different database connection or maybe some
> > html file changes). Which is why we prefer sharing libraries for ease of
> > deployment and updates.
>
> See, I see this in the exact opposite way: deployment seems easier (to
> me) if everything is self-contained. I suppose "update shared libraries,
> bounce Tomcat" is pretty easy, but so should "update individual
> application dependencies, bounce individual application".
>
> I value being able to update each application separately, too, in case
> of incompatibility, etc.
>
> > But I do agree, sharing libraries have their own shortcomings. Just
> > wondering if there are any workarounds at the moment for shared jar
> files.
>
> You should take a look at the offline web app conversion tool:
> https://tomcat.apache.org/download-migration.cgi
>
> You could probably take your web application, copy all of the shared
> libraries into it, run the offline converter, then copy the resulting
> (converted) libraries into your shared directory.
>
> -chris
>
> > On Tue, Dec 28, 2021 at 8:05 AM Christopher Schultz <
> > chris@christopherschultz.net> wrote:
> >
> >> Kok Hoor,
> >>
> >> On 12/27/21 18:36, Chew Kok Hoor wrote:
> >>> Hi,
> >>>
> >>> We're using the old javax.servlet namespace for compatibility
> >> reasons.
> >>>
> >>> Some of our jar files are re-used by different web-apps,
> therefore
> >> we
> >>> placed them in the common classloader.
> >>>
> >>> Is it possible to convert them dynamically, just like how we do
> it
> >> for
> >>> servlets in the per app WEB-INF folder, by using the following in the
> >>> context file:
> >>>
> >>> <Loader jakartaConverter="TOMCAT" />
> >>
> >> Any reason not to simply *stop* using the shared ClassLoader and instead
> >> bundle everything with each web application?
> >>
> >> How many web apps are running in the same container? How many libraries
> >> are you sharing?
> >>
> >> I've never seen a good argument for sharing libraries like this. RAM is
> >> cheap and plentiful, and code is very small.
> >>
> >> -chris
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: ClassFileTransformer in Tomcat 10 common classloader
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Kok Hoor,
On 12/27/21 19:08, Chew Kok Hoor wrote:
> Thanks for prompt response. We have like maybe 50 webapps, and they are
> common (except that they have different database connection or maybe some
> html file changes). Which is why we prefer sharing libraries for ease of
> deployment and updates.
See, I see this in the exact opposite way: deployment seems easier (to
me) if everything is self-contained. I suppose "update shared libraries,
bounce Tomcat" is pretty easy, but so should "update individual
application dependencies, bounce individual application".
I value being able to update each application separately, too, in case
of incompatibility, etc.
> But I do agree, sharing libraries have their own shortcomings. Just
> wondering if there are any workarounds at the moment for shared jar files.
You should take a look at the offline web app conversion tool:
https://tomcat.apache.org/download-migration.cgi
You could probably take your web application, copy all of the shared
libraries into it, run the offline converter, then copy the resulting
(converted) libraries into your shared directory.
-chris
> On Tue, Dec 28, 2021 at 8:05 AM Christopher Schultz <
> chris@christopherschultz.net> wrote:
>
>> Kok Hoor,
>>
>> On 12/27/21 18:36, Chew Kok Hoor wrote:
>>> Hi,
>>>
>>> We're using the old javax.servlet namespace for compatibility
>> reasons.
>>>
>>> Some of our jar files are re-used by different web-apps, therefore
>> we
>>> placed them in the common classloader.
>>>
>>> Is it possible to convert them dynamically, just like how we do it
>> for
>>> servlets in the per app WEB-INF folder, by using the following in the
>>> context file:
>>>
>>> <Loader jakartaConverter="TOMCAT" />
>>
>> Any reason not to simply *stop* using the shared ClassLoader and instead
>> bundle everything with each web application?
>>
>> How many web apps are running in the same container? How many libraries
>> are you sharing?
>>
>> I've never seen a good argument for sharing libraries like this. RAM is
>> cheap and plentiful, and code is very small.
>>
>> -chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassFileTransformer in Tomcat 10 common classloader
Posted by Chew Kok Hoor <ko...@gmail.com>.
Hi Chris,
Thanks for prompt response. We have like maybe 50 webapps, and they are
common (except that they have different database connection or maybe some
html file changes). Which is why we prefer sharing libraries for ease of
deployment and updates.
But I do agree, sharing libraries have their own shortcomings. Just
wondering if there are any workarounds at the moment for shared jar files.
Thanks.
Regards,
Kok Hoor
On Tue, Dec 28, 2021 at 8:05 AM Christopher Schultz <
chris@christopherschultz.net> wrote:
> Kok Hoor,
>
> On 12/27/21 18:36, Chew Kok Hoor wrote:
> > Hi,
> >
> > We're using the old javax.servlet namespace for compatibility
> reasons.
> >
> > Some of our jar files are re-used by different web-apps, therefore
> we
> > placed them in the common classloader.
> >
> > Is it possible to convert them dynamically, just like how we do it
> for
> > servlets in the per app WEB-INF folder, by using the following in the
> > context file:
> >
> > <Loader jakartaConverter="TOMCAT" />
>
> Any reason not to simply *stop* using the shared ClassLoader and instead
> bundle everything with each web application?
>
> How many web apps are running in the same container? How many libraries
> are you sharing?
>
> I've never seen a good argument for sharing libraries like this. RAM is
> cheap and plentiful, and code is very small.
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: ClassFileTransformer in Tomcat 10 common classloader
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Kok Hoor,
On 12/27/21 18:36, Chew Kok Hoor wrote:
> Hi,
>
> We're using the old javax.servlet namespace for compatibility reasons.
>
> Some of our jar files are re-used by different web-apps, therefore we
> placed them in the common classloader.
>
> Is it possible to convert them dynamically, just like how we do it for
> servlets in the per app WEB-INF folder, by using the following in the
> context file:
>
> <Loader jakartaConverter="TOMCAT" />
Any reason not to simply *stop* using the shared ClassLoader and instead
bundle everything with each web application?
How many web apps are running in the same container? How many libraries
are you sharing?
I've never seen a good argument for sharing libraries like this. RAM is
cheap and plentiful, and code is very small.
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: ClassFileTransformer in Tomcat 10 common classloader
Posted by Olaf Kock <to...@olafkock.de>.
On 28.12.21 00:36, Chew Kok Hoor wrote:
> We're using the old javax.servlet namespace for compatibility reasons.
>
> Some of our jar files are re-used by different web-apps, therefore we
> placed them in the common classloader.
>
> Is it possible to convert them dynamically, just like how we do it for
> servlets in the per app WEB-INF folder, by using the following in the
> context file:
>
> <Loader jakartaConverter="TOMCAT" />
On top of what's already discussed:
You're not giving any indication that you need jakarta-ee at all, so if
you use javax.servlet: Just do it, and deploy on Tomcat 9 - that's a
very good choice that won't go away any time soon. If there's no need
for Tomcat 10, save yourself the hassle - at least for now.
Later on, you might want to divide your webapps into two groups: Those
that don't require any compatibility handling, because they're fully
migrated (or automatically migratable) to jakarta-ee, and those that
don't. Easy setup with a reverse proxy sending the traffic to either of
the two (or multiple) backends.
Olaf
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org