AW: PooledConnection#connectUsingDriver, Thread.currentThread().getContextClassLoader() is null

2019-07-25 Thread Clemens Wyss DEV
Note: I have moved this "issue" over to the tomcat-dev mailinglist ...

-Ursprüngliche Nachricht-
Von: Clemens Wyss DEV  
Gesendet: Mittwoch, 24. Juli 2019 11:07
An: 'Tomcat Users List' 
Betreff: PooledConnection#connectUsingDriver, 
Thread.currentThread().getContextClassLoader() is null

Context:
Debian GNU/Linux 9 \n \l
java version 1.8.0_162
Tomcat 8.5.35

From time to time we are facing the follwing exception (call stack):
...
Caused by: java.sql.SQLException: Unable to load class: org.mariadb.jdbc.Driver 
from ClassLoader:java.net.URLClassLoader@4c873330;ClassLoader:null
at 
org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:292)
at 
org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212)
at 
org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:736)
at 
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:668)
at 
org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:198)
at 
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:132)
at org.apache.torque.Torque.getConnection(Torque.java:924)
... 53 common frames omitted
Caused by: java.lang.ClassNotFoundException: Unable to load class: 
org.mariadb.jdbc.Driver from 
ClassLoader:java.net.URLClassLoader@4c873330;ClassLoader:null
at 
org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)
at 
org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280)
... 59 common frames omitted
Caused by: java.lang.ClassNotFoundException: Classloader is null
at 
org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:40)
... 60 common frames omitted

According to the code (in PooledConnection# connectUsingDriver) 
Thread.currentThread().getContextClassLoader() returns null

Googling for " Thread.currentThread().getContextClassLoader() is null" the 
common demoniator seems to be `getContextClassLoader can be null`. If this is 
true there should be
a) a null-check in PooledConnection# connectUsingDriver
b) if null, then there should be a fallback-Classloader (the system class 
laoder?)

WDYT ?

Or any ideas why the given exception pops up from time to time

Thx
Clemens
B�CB��[��X��ܚX�KK[XZ[
�\�\��][��X��ܚX�P�X�]
�\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[
�\�\��Z[�X�]
�\X�K�ܙ�B�

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



Re: PooledConnection#connectUsingDriver, Thread.currentThread().getContextClassLoader() is null

2019-07-25 Thread Thomas Meyer
Am 25. Juli 2019 08:07:18 MESZ schrieb Clemens Wyss DEV :
>Note: I have moved this "issue" over to the tomcat-dev mailinglist ...
>
>-Ursprüngliche Nachricht-
>Von: Clemens Wyss DEV  
>Gesendet: Mittwoch, 24. Juli 2019 11:07
>An: 'Tomcat Users List' 
>Betreff: PooledConnection#connectUsingDriver,
>Thread.currentThread().getContextClassLoader() is null
>
>Context:
>Debian GNU/Linux 9 \n \l
>java version 1.8.0_162
>Tomcat 8.5.35
>
>From time to time we are facing the follwing exception (call stack):
>...
>Caused by: java.sql.SQLException: Unable to load class:
>org.mariadb.jdbc.Driver from
>ClassLoader:java.net.URLClassLoader@4c873330;ClassLoader:null
>at
>org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:292)
>at
>org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212)
>at
>org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:736)
>at
>org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:668)
>at
>org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:198)
>at
>org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:132)
>at org.apache.torque.Torque.getConnection(Torque.java:924)
>... 53 common frames omitted
>Caused by: java.lang.ClassNotFoundException: Unable to load class:
>org.mariadb.jdbc.Driver from
>ClassLoader:java.net.URLClassLoader@4c873330;ClassLoader:null
>at
>org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)
>at
>org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280)
>... 59 common frames omitted
>Caused by: java.lang.ClassNotFoundException: Classloader is null
>at
>org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:40)
>... 60 common frames omitted
>
>According to the code (in PooledConnection# connectUsingDriver)
>Thread.currentThread().getContextClassLoader() returns null
>
>Googling for " Thread.currentThread().getContextClassLoader() is null"
>the common demoniator seems to be `getContextClassLoader can be null`.
>If this is true there should be
>a) a null-check in PooledConnection# connectUsingDriver
>b) if null, then there should be a fallback-Classloader (the system
>class laoder?)
>
>WDYT ?
>
>Or any ideas why the given exception pops up from time to time
>
>Thx
>Clemens
>B�CB��[��X��ܚX�KK[XZ[
>�\�\��][��X��ܚX�P�X�]
>�\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[
>�\�\��Z[�X�]
>�\X�K�ܙ�B�
>
>-
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>>

Hi,

Is the driver part of the web app or installed in tomcat's lib directory?

Does the error happen after startup of tomcat or after running for some time?

With kind regards
Thomas
-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

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



Re: Password is not working properly

2019-07-25 Thread Mark Thomas
On 25/07/2019 15:23, Support wrote:
> Hi Sir,
> 
> I am using tomcat 9 for my application. For my admin page, I have a
> username and password in conf/tomcat-user.xml.
> Using digest.sh, I encrypted my password(sha-256).
> 
> password: Password
> encrypted: 5er5akakfkd556546adnfjbkklndkfgbjdb
> 
> Now, I am using my password its not working, if I give the encrypted it is
> working fine. but it is working normaly in tomcat 7 perfectly without any
> error.

You need to configure the appropriate Realm to use digested passwords.

Mark


> 
> 
> Logs:
> 
> 23 Jul 2019 14:44:56,742 TRACE ConsoleDataRetriever
> [https-jsse-nio-9443-exec-7] request parameters:q:HOME
> 23 Jul 2019 14:44:56,743 TRACE ConsoleDataRetriever
> [https-jsse-nio-9443-exec-7] request
> attributes:org.apache.tomcat.util.net.secure_protocol_version:TLSv1.2
> javax.servlet.request.key_size:128
> javax.servlet.request.ssl_session_mgr:org.apache.tomcat.util.net.jsse.JSSESupport@23c2d7e5
> javax.servlet.request.cipher_suite:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
> javax.servlet.request.ssl_session_id:5d371d2118d18dbbe825330d236a3d7ea0f090f12385c0ca9b4146afe2e5700d
> 23 Jul 2019 14:44:56,743 DEBUG ConsoleDataRetriever
> [https-jsse-nio-9443-exec-7] Checking for existing messages, if none -
> create a new message map
> 23 Jul 2019 14:44:56,743 TRACE CaptorAdminUtil [https-jsse-nio-9443-exec-7]
> No status messages were found in the request, created a new map. Message
> Map:{}
> 23 Jul 2019 14:44:56,744 DEBUG ConsoleDataRetriever
> [https-jsse-nio-9443-exec-7] Currently the view is set to: /error500.jsp
> 23 Jul 2019 14:44:56,750 DEBUG ConsoleDataRetriever
> [https-jsse-nio-9443-exec-7] query received in request:HOME
> 23 Jul 2019 14:44:56,750 DEBUG ConsoleDataRetriever
> [https-jsse-nio-9443-exec-7] request for retrieving Dashboard data
> 
> Regards,
> Sandeep Raghav
> 
> Customer Support Engineer
> supp...@xcaptor.com
> Captivate. Engage.
> 


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



Re: Password is not working properly

2019-07-25 Thread Support
Hi sir,

if I am using memory realm tomcat 9 is not working while restarting tomcat.



Regards,
Sandeep Raghav

Customer Support Engineer
supp...@xcaptor.com
Captivate. Engage.


On Thu, Jul 25, 2019 at 8:11 PM Mark Thomas  wrote:

> On 25/07/2019 15:23, Support wrote:
> > Hi Sir,
> >
> > I am using tomcat 9 for my application. For my admin page, I have a
> > username and password in conf/tomcat-user.xml.
> > Using digest.sh, I encrypted my password(sha-256).
> >
> > password: Password
> > encrypted: 5er5akakfkd556546adnfjbkklndkfgbjdb
> >
> > Now, I am using my password its not working, if I give the encrypted it
> is
> > working fine. but it is working normaly in tomcat 7 perfectly without any
> > error.
>
> You need to configure the appropriate Realm to use digested passwords.
>
> Mark
>
>
> >
> >
> > Logs:
> >
> > 23 Jul 2019 14:44:56,742 TRACE ConsoleDataRetriever
> > [https-jsse-nio-9443-exec-7] request parameters:q:HOME
> > 23 Jul 2019 14:44:56,743 TRACE ConsoleDataRetriever
> > [https-jsse-nio-9443-exec-7] request
> > attributes:org.apache.tomcat.util.net.secure_protocol_version:TLSv1.2
> > javax.servlet.request.key_size:128
> >
> javax.servlet.request.ssl_session_mgr:org.apache.tomcat.util.net.jsse.JSSESupport@23c2d7e5
> > javax.servlet.request.cipher_suite:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
> >
> javax.servlet.request.ssl_session_id:5d371d2118d18dbbe825330d236a3d7ea0f090f12385c0ca9b4146afe2e5700d
> > 23 Jul 2019 14:44:56,743 DEBUG ConsoleDataRetriever
> > [https-jsse-nio-9443-exec-7] Checking for existing messages, if none -
> > create a new message map
> > 23 Jul 2019 14:44:56,743 TRACE CaptorAdminUtil
> [https-jsse-nio-9443-exec-7]
> > No status messages were found in the request, created a new map. Message
> > Map:{}
> > 23 Jul 2019 14:44:56,744 DEBUG ConsoleDataRetriever
> > [https-jsse-nio-9443-exec-7] Currently the view is set to: /error500.jsp
> > 23 Jul 2019 14:44:56,750 DEBUG ConsoleDataRetriever
> > [https-jsse-nio-9443-exec-7] query received in request:HOME
> > 23 Jul 2019 14:44:56,750 DEBUG ConsoleDataRetriever
> > [https-jsse-nio-9443-exec-7] request for retrieving Dashboard data
> >
> > Regards,
> > Sandeep Raghav
> >
> > Customer Support Engineer
> > supp...@xcaptor.com
> > Captivate. Engage.
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: confusions with conf/tomcat-users.xml setup

2019-07-25 Thread Hu, Zhiliang [AN S]
Thank you for the hint.  I got it to work.  __ZL


On 07/24/2019, 11:12 PM,  wrote:

I would recommend reading the role settings from here first:

https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

Also, if everything is okay for you try using comma-separated roles e.g.
roles=“manager-gui,admin”. Even better, try to create new roles and assign
them correctly.

See if that works for you.

Thanks,


On Thu, 25 Jul 2019 at 12:35, Hu, Zhiliang [AN S]  wrote:

> I have Apache Tomcat/7.0.94 installed and running.  However I had a hard
> time to get to the ManagerApp and Host Manager to work properly.  Briefly:
>
> If I set up "conf/tomcat-users.xml" as in:
> 
> 
> 
> 
> -- The "/manager/html/" can get connected and "/host-manager/html" gets
> "404 Access Denied";
>
> If I set up "conf/tomcat-users.xml" as in:
> 
> 
> 
> 
> -- The "/manager/html/" gets "404 Access Denied" and "/host-manager/html"
> can get connected;
>
> If I set up "conf/tomcat-users.xml" as in:
> 
> 
> 
>
> 
> 
> 
> -- The "/manager/html/" can get connected and "/host-manager/html" gets
> "404 Access Denied" -- obviously the second "rolename" overrides the first
> one.
>
> How can I get both to work?
>
> Thanks in advance,
>
> ZL
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>



Password is not working properly

2019-07-25 Thread Support
Hi Sir,

I am using tomcat 9 for my application. For my admin page, I have a
username and password in conf/tomcat-user.xml.
Using digest.sh, I encrypted my password(sha-256).

password: Password
encrypted: 5er5akakfkd556546adnfjbkklndkfgbjdb

Now, I am using my password its not working, if I give the encrypted it is
working fine. but it is working normaly in tomcat 7 perfectly without any
error.


Logs:

23 Jul 2019 14:44:56,742 TRACE ConsoleDataRetriever
[https-jsse-nio-9443-exec-7] request parameters:q:HOME
23 Jul 2019 14:44:56,743 TRACE ConsoleDataRetriever
[https-jsse-nio-9443-exec-7] request
attributes:org.apache.tomcat.util.net.secure_protocol_version:TLSv1.2
javax.servlet.request.key_size:128
javax.servlet.request.ssl_session_mgr:org.apache.tomcat.util.net.jsse.JSSESupport@23c2d7e5
javax.servlet.request.cipher_suite:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
javax.servlet.request.ssl_session_id:5d371d2118d18dbbe825330d236a3d7ea0f090f12385c0ca9b4146afe2e5700d
23 Jul 2019 14:44:56,743 DEBUG ConsoleDataRetriever
[https-jsse-nio-9443-exec-7] Checking for existing messages, if none -
create a new message map
23 Jul 2019 14:44:56,743 TRACE CaptorAdminUtil [https-jsse-nio-9443-exec-7]
No status messages were found in the request, created a new map. Message
Map:{}
23 Jul 2019 14:44:56,744 DEBUG ConsoleDataRetriever
[https-jsse-nio-9443-exec-7] Currently the view is set to: /error500.jsp
23 Jul 2019 14:44:56,750 DEBUG ConsoleDataRetriever
[https-jsse-nio-9443-exec-7] query received in request:HOME
23 Jul 2019 14:44:56,750 DEBUG ConsoleDataRetriever
[https-jsse-nio-9443-exec-7] request for retrieving Dashboard data

Regards,
Sandeep Raghav

Customer Support Engineer
supp...@xcaptor.com
Captivate. Engage.


Tomcat manager keystore reload

2019-07-25 Thread Joseph Dornisch
Hello,

I have a CRL configured in my tomcat server configuration. If I update it
and want to have Tomcat refresh it, I can login into
https://127.0.0.1/manager/html and click the "Re-read" button under
"Configuration->Re-read TLS configuration files" and this causes my CRL to
be reread. It works great.

However,I have read here, "
https://people.apache.org/~schultz/ApacheCon%20NA%202018/Let's%20Encrypt%20Apache%20Tomcat.pdf"
on page 34 you can do basically the same thing with a command something
like:
https://localhost/manager/jmxproxy?invoke=Catalina%3Atype%3DProtocolHandler%2Cport%3D8443%2Caddress%3D%22127.0.0.1%22=reloadSslHostConfigs

When I do this, I get back:

Error - java.lang.NullPointerException
java.lang.NullPointerException
at 
org.apache.catalina.manager.JMXProxyServlet.invokeOperationInternal(JMXProxyServlet.java:264)
at 
org.apache.catalina.manager.JMXProxyServlet.invokeOperation(JMXProxyServlet.java:207)
at 
org.apache.catalina.manager.JMXProxyServlet.doGet(JMXProxyServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at 
com.arl.servlet.core.filters.AbstractRedirectFilter.doFilter(AbstractRedirectFilter.java:250)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at 
com.arl.servlet.core.filters.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:356)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at 
com.arl.servlet.core.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:128)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at 
org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
at 
org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:348)
at 
org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:52)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at 
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at 
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at 
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at 
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

Is this command supposed to work in Tomcat 8.5.43? Is there a different
command. Short of this, the only way to force reload without manual
intervention seems to be to login to the manager from code, and then execute
https://127.0.0.1/manager/html/sslReload?org.apache.catalina.filters.CSRF_NONCE=



Database timeout

2019-07-25 Thread Richard Huntrods
I'm having an ongoing issue with the database connections timing out
after a long period of inactivity (i.e. no-one connecting to the tomcat
applicaton).

But first...

My system:
OS: Ubuntu 18.04.2 LTS (server)
Tomcat: 9.0.22 (installed from tomcat distribution, not via apt get)
Java: OpenJDK "11.0.3" 2019-04-16
Mysql: Ver 14.14 Distrib 5.7.26

I'm using the standard 8-hour timeout on mysql connections, and have the
set autoReconnect=true when I connect to the database:

jdbc:mysql://127.0.0.1:3306/mydb?autoReconnect=true

Everything works fine except for the 8-hour timeouts. If I click the
tomcat link again, the autoReconnect works and the applications is back
up instantly.

The only message in any log is this:

> SQL Problem: The last packet successfully received from the server was 
> 30,394,076 milliseconds ago.  The last packet sent successfully to the server 
> was 30,394,076 milliseconds ago. is longer than the server configured value 
> of 'wait_timeout'. You should consider either expiring and/or testing 
> connection validity before use in your application, increasing the server 
> configured values for client timeouts, or using the Connector/J connection 
> property 'autoReconnect=true' to avoid this problem.
> SQL State: 08S01
> Vendor Error: 0

Is there a way other than using a longer timeout value to stop the
connection from breaking? That is, is there a pre-emptive form of
autoReconnect?

Some other statistics: I have a 'watchdog' process (servlet + cron job)
that exercises the database on regular intervals. In spite of that, I
still get these SQL timeouts.

I've been tracking the timeouts since April 2019. All timeouts exceed 8
hours. The minimum between timeouts was 9.3 hours, maximum  was 166.1
hours with an average since April 2019 of 35 hours.

Thanks in advance.

-Richard

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
This communication is intended for the use of the recipient to whom it is 
addressed, and may contain confidential, personal, and or privileged 
information. Please contact us immediately if you are not the intended 
recipient of this communication, and do not copy, distribute, or take action 
relying on it. Any communications received in error, or subsequent reply, 
should be deleted or destroyed.
---