You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Carles Franquesa <ca...@algorismes.cat> on 2020/08/29 19:13:53 UTC

shared.loader classpaths

Hi all,

Is anybody out there that could explain to me the way to know which
classpath is being used by shared.loader. Or better, for any loader.

My problem is the tomcat does not find a class that certainly is in
WEB-INF/classes.

I tried to set explicitly in all loaders by editing catalina.properties. My
last test has been giving the folders to the common.loader, this way:



*common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.base}/aprenonline/WEB-INF/classes/lib","${catalina.base}/aprenonline/WEB-INF/classes/model","${catalina.base}/aprenonline/WEB-INF/classes/servlets","${catalina.base}/aprenonline/WEB-INF/lib/*.jar"*

But no way. Tomcat keeps on failing when JSP files try to make use of those
classes.

In all Tomcat manuals say that webapp's classes should be placed in
WEB-INF/classes when the WAR file is build. And certainly, they are. But
error continues. I also found some people that had this problem in the
past, and by then, it was resolved updating to new versions. I tried with
Tomcat 8 and 9.

Already spent four days in this, and I am totally stuck.

Please help.


Carles

Re: shared.loader classpaths

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Carles,

On 8/31/20 12:45, Carles Franquesa wrote:
> Thank you Chris, for keeping on the problem. I don't know if you
> saw the last mail sent by me to the list.
>
> The thing was resolved by placing all the JSP referencing those
> classes at the web root folder. I did that, and it worked. That's
> why I hung my solution in the list.

Moving the JSPs will not have had any effect on being able to locate the
.class files. You must have changed something else.

> Nevertheless, Mark Thomas told me I was wrong. What I supposed that
>  was the problem, and the solution was wrong. He told me JSPs may
> go everywhere in the folder structure. And asked me for giving a
> simple example of my error.
Only if you want to actually solve your real problem.

> Anyway, by then my app worked already, so I put off to make the
> example until today. And certainly, I can't reproduce it. Mark is
> right, of course. I am new in all this. Now, my last chance to
> have the example is starting from a new copy of what is now going
> on, recover the old hierarchy of JSP ant try to reproduce the
> error. I am in> Thanks again for you help, Chris.

You are welcome, any time. It wasn't clear to me that your more recent
post was in reference to this one.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9NXv0ACgkQHPApP6U8
pFjY+Q/9HUHitx0LWtW5w85qdGk9WksWXHXH5DWo4Mjx9uqsWoYeKqUDmaqDIMDh
2e1P4C2OBKli1toYU3mc9WWrtJmJV+b3ADiJGdaWjaPdHABFoTWQhFofH3WGi9+B
D3hxNBTlVY8dHnnDH0gvADFRsgJ7j1p4nTTM3krnDJW1KVH558CYE1G/9d3WcJV7
J66O3GAvyNG6LLQ7liUsr8dr+b7mVvpci/0b4I6LWmALQUqPGuCLKoZEkpZWOpA8
2b5Eq4cEGcYLCjv9LcZ3xocelTXHwxPNQDjZpFWXYqw7wYP9VnLLPwrkXlN4aRh5
O/1/aNALVLr6neDi4XCoCDFkMfPJpL2zwGHlrDfSqgtyQpQ0Gw1Xyh7dHoLM+RrK
n4WMbKXdCpB0QiFBw2inwk+pSWnN5aINUnK2V0w73pXTwVqKSOTzpFlwXlxP3DDp
OgcC+JYgkdcHYLUZFblrMesU/wEN8sQiV3dTTn8RsX3OGy3vfIPM2gc0/Z+JPSny
8b9+AkS/trv8FQRq8vXMQINesDoyFxjJZLCxb+/psCj6obePzl4QE/N3OHFZUxjM
6Y+TVXj3E9ogOnT3sOyapmaZfjySdhjXUw7AFKtDy4SABzNnL9rJEPUkt+9Zdjm6
fJE8FPnNquYxtr3IoznWCN47EJd1rImGW3WwOIRI9/QLe8r2uk8=
=8jqr
-----END PGP SIGNATURE-----

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


Re: shared.loader classpaths

Posted by Carles Franquesa <ca...@algorismes.cat>.
Thank you Chris, for keeping on the problem. I don't know if you saw the
last mail sent by me to the list.

The thing was resolved by placing all the JSP referencing those classes at
the web root folder. I did that, and it worked. That's why I hung my
solution in the list.

Nevertheless, Mark Thomas told me I was wrong. What I supposed that was the
problem, and the solution was wrong. He told me JSPs may go everywhere in
the folder structure. And asked me for giving a simple example of my error.

Anyway, by then my app worked already, so I put off to make the example
until today. And certainly, I can't reproduce it. Mark is right, of course.
I am new in all this. Now, my last chance to have the example is starting
from a new copy of what is now going on, recover the old hierarchy of JSP
ant try to reproduce the error. I am in

Thanks again for you help, Chris.

Carles







Missatge de Christopher Schultz <ch...@christopherschultz.net> del dia dl.,
31 d’ag. 2020 a les 17:29:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Carles,
>
> On 8/29/20 15:13, Carles Franquesa wrote:
> > Is anybody out there that could explain to me the way to know
> > which classpath is being used by shared.loader. Or better, for any
> > loader.
>
> http://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.htmlv
>
> > My problem is the tomcat does not find a class that certainly is
> > in WEB-INF/classes.
>
> What is the path of the file in WEB-INF/classes?
>
> What is the name of the package+class of the class?
>
> > I tried to set explicitly in all loaders by editing
> > catalina.properties.
>
> Do not do that. It's almost never necessary.
>
> > My last test has been giving the folders to the common.loader,
> > this way:
> >
> >
> > *common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${
> catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.base}/apren
> online/WEB-INF/classes/lib","${catalina.base}/aprenonline/WEB-INF/classe
> s/model","${catalina.base}/aprenonline/WEB-INF/classes/servlets","${cata
> lina.base}/aprenonline/WEB-INF/lib/*.jar"*
>
> This
> >
> will cause endless problems if you try to deploy more than one
> application at a time. It will probably also cause weird problems even
> with a single application deployed.
>
> > But no way. Tomcat keeps on failing when JSP files try to make use
> > of those classes.
>
> Please post the <%...@page> directive from a sample JSP file.
>
> > In all Tomcat manuals say that webapp's classes should be placed
> > in WEB-INF/classes when the WAR file is build.
>
> This is the correct way to do things.
>
> > And certainly, they are.
>
> Either the class files are not in the right place, or you are not
> referencing them correctly.
>
> > But error continues. I also found some people that had this
> > problem in the past, and by then, it was resolved updating to new
> > versions. I tried with Tomcat 8 and 9.
> I don't know of any version of Tomcat where the ClassLoaders didn't work
> .
>
> > Already spent four days in this, and I am totally stuck.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9NF3MACgkQHPApP6U8
> pFisnA/+Ly+r1R1HrHkKA1YHZVC72H8SS15AXJ+Twly/dH3QJ4HbMyX2tdBnSXOS
> DKC0fsmKDUG7fLg1yKPAKYbnbQHoZEo6yfboMTuVrIG5sshVvdTqX/xfjN3V29D3
> jYr1CIb/4esLCBg2Wq2DIck6mrJtg7ko95WYQnaMXODMJYf/KjZu8c/hoPSn70B7
> +qYr+9GNO5qo6dTXcbaSFql4uex+c8NYyDMLZNDPml7Ub76aDAWJ2YOpxozzpftF
> KYnGWdwhCXWtGOKrmhJ6WwEmK36unlJyq3BY12t+0hHP4aLg1ObcqiUtiiUrcO/D
> saK5yF/JmSa5N6d+RpfNPvXe/zNUpnOm8/HlOZyWm23szWfNHLH27VMQfN8vPoSP
> IjyXe/+eMSoRil5pnfeMKmTlU6ic9Om+abL0Wjva/v/MxS6HTbf1tJxAPxFkLpY5
> dkI3R1YiqZwHpVPNlWiRpMgm39MSzphEy3vRpAxyEw/MWese4ZA/VS1CoZHK9fc8
> jGigahmx5XS8X0c5y7AndwoD3iQ+mhQjOkNkexDqc9tTbzIcyg1hRJyHxsSV1iBk
> Fdv8JrLORRyCymN6j2WIdDDbESeHTSDnHTKGc8C2/489eFVcsFip8EKW0oxbhqQp
> nfHqrHvfPaGy9cNSRzWFis7OWvnBQpf78VIbYjxmi4o3Mu36ioQ=
> =6UY2
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: shared.loader classpaths

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Carles,

On 8/29/20 15:13, Carles Franquesa wrote:
> Is anybody out there that could explain to me the way to know
> which classpath is being used by shared.loader. Or better, for any
> loader.

http://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.htmlv

> My problem is the tomcat does not find a class that certainly is
> in WEB-INF/classes.

What is the path of the file in WEB-INF/classes?

What is the name of the package+class of the class?

> I tried to set explicitly in all loaders by editing
> catalina.properties.

Do not do that. It's almost never necessary.

> My last test has been giving the folders to the common.loader,
> this way:
>
>
> *common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${
catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.base}/apren
online/WEB-INF/classes/lib","${catalina.base}/aprenonline/WEB-INF/classe
s/model","${catalina.base}/aprenonline/WEB-INF/classes/servlets","${cata
lina.base}/aprenonline/WEB-INF/lib/*.jar"*

This
>
will cause endless problems if you try to deploy more than one
application at a time. It will probably also cause weird problems even
with a single application deployed.

> But no way. Tomcat keeps on failing when JSP files try to make use
> of those classes.

Please post the <%...@page> directive from a sample JSP file.

> In all Tomcat manuals say that webapp's classes should be placed
> in WEB-INF/classes when the WAR file is build.

This is the correct way to do things.

> And certainly, they are.

Either the class files are not in the right place, or you are not
referencing them correctly.

> But error continues. I also found some people that had this
> problem in the past, and by then, it was resolved updating to new
> versions. I tried with Tomcat 8 and 9.
I don't know of any version of Tomcat where the ClassLoaders didn't work
.

> Already spent four days in this, and I am totally stuck.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9NF3MACgkQHPApP6U8
pFisnA/+Ly+r1R1HrHkKA1YHZVC72H8SS15AXJ+Twly/dH3QJ4HbMyX2tdBnSXOS
DKC0fsmKDUG7fLg1yKPAKYbnbQHoZEo6yfboMTuVrIG5sshVvdTqX/xfjN3V29D3
jYr1CIb/4esLCBg2Wq2DIck6mrJtg7ko95WYQnaMXODMJYf/KjZu8c/hoPSn70B7
+qYr+9GNO5qo6dTXcbaSFql4uex+c8NYyDMLZNDPml7Ub76aDAWJ2YOpxozzpftF
KYnGWdwhCXWtGOKrmhJ6WwEmK36unlJyq3BY12t+0hHP4aLg1ObcqiUtiiUrcO/D
saK5yF/JmSa5N6d+RpfNPvXe/zNUpnOm8/HlOZyWm23szWfNHLH27VMQfN8vPoSP
IjyXe/+eMSoRil5pnfeMKmTlU6ic9Om+abL0Wjva/v/MxS6HTbf1tJxAPxFkLpY5
dkI3R1YiqZwHpVPNlWiRpMgm39MSzphEy3vRpAxyEw/MWese4ZA/VS1CoZHK9fc8
jGigahmx5XS8X0c5y7AndwoD3iQ+mhQjOkNkexDqc9tTbzIcyg1hRJyHxsSV1iBk
Fdv8JrLORRyCymN6j2WIdDDbESeHTSDnHTKGc8C2/489eFVcsFip8EKW0oxbhqQp
nfHqrHvfPaGy9cNSRzWFis7OWvnBQpf78VIbYjxmi4o3Mu36ioQ=
=6UY2
-----END PGP SIGNATURE-----

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