Thomas Griffith

Ranch Hand
+ Follow
since Sep 30, 2020
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Thomas Griffith

Yeah, I'm using the .bat to javac the single QueryEngine class within the existing web app. That's the only place instantiating and importing javax.sql.DataSource and org.apache.tomcat.dbcp.dbcp2.BasicDataSource.

I remembered that jars are compressed zips so I was able to look inside rt.jar and the javax.sql.DataSource package isn't in there. So I found jmx.jar off a mirror site, took a look inside and it contains javax.sql.DataSource and put that in the classpath and it seems to compile...
2 months ago
yeah, it's weird. BasicDataSource will never be initialized at runtime as the boolean condition will never be false, I think the original designer was going for a general servlet implementation. This is the only class which has any reference to BasicDataSource so I'm trying to compile it "standalone" with the dbcp thing.

I created a bat file to compile the QueryEngine class...


I still get import javax.management.* does not exist. I thought rt.jar contained all the primary javax packages. uggh.
2 months ago
Thank you so much.

I think I found the source of the problem, I think it was insinuated earlier with something changing around Tomcat 7. The package for BasicDataSource is now org.apache.tomcat.dbcp.dbcp2. So when recompiling, that error went away.

However, I am now receiving class file javax.management.MBeanRegistration not found. This code is actually never touched when the servlet runs due to a boolean condition so it never shows at runtime.

Is there a jar within Tomcat container which contains javax.management? I tried to import javax.management.* but it can't find that with the jars I currently have in the classpath. I have servlet-api.jar from TOMCAT_HOME/lib in there and that's where I thought all javax packages were located.
2 months ago
I think I see, DataSource stores the reference(s), or "pointers"?, to the database (found in the context file) in a "bean pool" which then pulls one out when a servlet creates (and soon, closes) a connection (for SQL operations).

The DataSource pool is destroyed when Tomcat is shutdown.

The case on line 202 is to BasicDataSource. That's not in javax.sql but imported via org.apache.commons.dbcp.BasicDataSource. Could that be the java.lang.NoClassDefFoundError?
2 months ago
ok, yes, the DataSource for jdbcDataSource is specified within the app context file (conf/Catalina/localhost), so the container implicitly creates a pool from that? When the servlet is first called...or maybe at startup? This DataSource (jdbcDataSource)  is a connection to Oracle...

The corresponding close() on the Notes DataSource doesn't throw an error.
2 months ago
The only explicit data pool in the app is the Domino data source pool (there isn't one for the jdbcDataSource). Does DataSource implicitly create a data pool in the container?
2 months ago
wow, I see what you're saying about the double spacing. I was pulling out "highlights" from the code so wasn't sure if that would be more confusing with the code tag and scroll boxes.

Yeah, line 202 is that cast and close() call in the close() method...



one of the objects is throwing the NoClassDefFound exception... but it seems like everything should be there...

jdbcDataSource... verified connectivity and used for SQL operations
BasicDataSource... tomcat-dbcp.jar exists in TOMCAT_HOME/lib

I have no idea what can't be found here.

2 months ago

Paul Clapham wrote:Looks to me like this is referring to non-Tomcat code. Do you recognize those classes?



Here's some snippets from the servlet code. Maybe that BasicDataSource cast from javax.sql.DataSource in the close() method? But that would throw a ClassCastException... but jdbcDataSource is clearly created and exists because the requests and responses are ok, and there is a previouss method which checks the JDBC connection on jdbcDataSource and that's good... I don't know what happens to jdbcDataSource when close() is called... it's apparently gone.

Or maybe jdbcDataSource is there and something changed with org.apache.commons.dbcp.BasicDataSource? Could i be missing a jar for that? I don't think so, ot seems to be a container jar...I see tomcat-dbcp.jar in TOMCAT_HOME/lib...

import javax.sql.*;
..etc...
import org.apache.commons.dbcp.BasicDataSource;
...etc....
................................

               //SQL Data Source
               private DataSource jdbcDataSource;

               //JDBC Data Source
               this.jdbcDataSource = createSQLDataSource(config.getJdbcConfig());

................................

               private DataSource createSQLDataSource(JDBCConfig jdbcConfig)

               //Get Jdbc DataSource from JNDI
               Context initCtx = new InitialContext();
               Context envCtx = (Context) initCtx.lookup("java:/comp/env");
               return (DataSource) envCtx.lookup(jdbcConfig.getDataSourceName());

................................

               public void close()
               {
                               if (this.isInServletContainer)
                               {
                                               try
                                               {
//*******************SOURCE OF NOCLASSDEFFOUND ERROR (I THINK)*****************
                                                               ((BasicDataSource) this.jdbcDataSource).close();
                                               }
                                               catch (SQLException e)
                                               {
                                                               log.error("", e);
                                               }
                               }
               }



2 months ago
yeah, you're right. I'm reviewing it now. I see two separate issues related around creating JDBC DataSource objects. One servlet runs this same code but does not connect to Oracle...when instantiated, returns null for the JDBC source object. That explains the NullPointerException on the JDBC source object when close() is called (during destroy() while Tomcat is shut down...).

The second servlet creates a JDBC DataSource object. This throws ClassNotFoundException when close() is called on this object. This one I'm not getting... could the JDBC source object be garbage collected that quickly? After a request and response have occurred? Making this close() call sort of a redundant last chance close() backup?
2 months ago
I went to localhost log and did find additional trace info, including the Caused By...


20-Oct-2020 12:28:38.582 SEVERE [Thread-5] org.apache.catalina.core.ApplicationContext.log Servlet [QueryEngineServlet] threw unload() exception

javax.servlet.ServletException: Servlet.destroy() for servlet [QueryEngineServlet] threw exception

               at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1343)

               at org.apache.catalina.core.StandardWrapper.stopInternal(StandardWrapper.java:1632)

               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

               at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5315)

               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1441)

               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1430)

               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)

               at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:997)

               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1441)

               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1430)

               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)

               at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:997)

               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

               at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:471)

               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

               at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:791)

               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

               at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:482)

               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

               at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

               at java.base/java.lang.reflect.Method.invoke(Method.java:566)

               at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:406)

               at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/dbcp/BasicDataSource

               at com.ptpsolutions.queryEngine.QueryEngine.close(QueryEngine.java:202)

               at com.ptpsolutions.queryEngine.QueryEngineServlet.destroy(QueryEngineServlet.java:40)

               at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1331)

               ... 29 more

Caused by: java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource

               at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275)

               at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1104)

               ... 32 more
2 months ago
It creates a connection with Notes via CORBA and DIIOP. After the session thread is created, it's thrown in the GenericObjectPool, and sleeps for ten seconds then recycled. I'm reading up on database connection pooling but I guess that it can be reused within that ten second time frame by another request. Otherwise, recycled.

What I noticed is that the Notes driver is in both the TOMCAT_HOME/lib as well as the webapp/WEB-INF/lib. Maybe since it's in TOMCAT_HOME/lib, it's persisting the connection thread (can't sleep)? Thus, can't destroy (due to NullPointerException)?

that's everything printed from the Tomcat stderr log. I can't find any Caused By in there...
2 months ago
This occurs when I shut down the Tomcat Windows service...

20-Oct-2020 09:50:12.032 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]
20-Oct-2020 09:50:12.126 INFO [Thread-5] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/C:/apache-tomcat-99/lib/catalina.jar) to field java.lang.Thread.threadLocals
WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoaderBase
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
20-Oct-2020 09:50:12.157 SEVERE [Thread-5] org.apache.catalina.core.StandardWrapper.unload InstanceManager.destroy() for servlet [QueryEngineServlet] threw exception
java.lang.NullPointerException
               at org.apache.catalina.core.DefaultInstanceManager.destroyInstance(DefaultInstanceManager.java:197)
               at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1349)
               at org.apache.catalina.core.StandardWrapper.stopInternal(StandardWrapper.java:1632)
               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
               at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5315)
               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1441)
               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1430)
               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
               at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:997)
               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1441)
               at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1430)
               at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
               at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
               at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
               at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:997)
               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
               at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:471)
               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
               at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:791)
               at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
               at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:482)
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
               at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
               at java.base/java.lang.reflect.Method.invoke(Method.java:566)
               at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:406)
               at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)


NOTE ~ Below also follows in the log during shutdown...looks to be thrown primarily during sleep...this warning of an open thread (same number, Thread-5) appears to be related to the destroy() NullPointerException trace above... I'm reading a mixed bag on the significance of this as it occurs only during shutdown...

20-Oct-2020 09:50:12.173 WARNING [Thread-5] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [EPS3] appears to have started a thread named [Thread-4] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@11.0.8/java.lang.Thread.sleep(Native Method)
org.apache.commons.pool.impl.GenericObjectPool$Evictor.run(GenericObjectPool.java:1122)
java.base@11.0.8/java.lang.Thread.run(Thread.java:834)
20-Oct-2020 09:50:12.173 WARNING [Thread-5] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [EPS3] appears to have started a thread named [Error reading Messages File.] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@11.0.8/java.net.SocketInputStream.socketRead0(Native Method)
java.base@11.0.8/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
java.base@11.0.8/java.net.SocketInputStream.read(SocketInputStream.java:168)
java.base@11.0.8/java.net.SocketInputStream.read(SocketInputStream.java:140)
lotus.priv.CORBA.iiop.Message.readFully(Unknown Source)
lotus.priv.CORBA.iiop.Message.createFromStream(Unknown Source)
lotus.priv.CORBA.iiop.IIOPInputStream.prefill(Unknown Source)
lotus.priv.CORBA.iiop.IIOPConnection.createInputStream(Unknown Source)
lotus.priv.CORBA.iiop.ReaderThread.run(Unknown Source)
20-Oct-2020 09:50:12.173 WARNING [Thread-5] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [EPS3] appears to have started a thread named [RecycleThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@11.0.8/java.lang.Thread.sleep(Native Method)
lotus.domino.cso.RecycleThread.sleep(Unknown Source)
lotus.domino.cso.RecycleThread.run(Unknown Source)
java.base@11.0.8/java.lang.Thread.run(Thread.java:834)
20-Oct-2020 09:50:12.189 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
2 months ago
hi, thank you...yeah, the two WARs are dumped into TOMCAT_HOME/webapps, but within each web.xml...the <servlet> node and subnodes are identical.

For example, <servlet-name>QueryEngineServlet</servlet-name>...etc...

the exception when the windows service is stopped refers to the servlet name... so Tomcat does have a reference to one of these servlets since it references the name, but it's seeing a null something...


org.apache.catalina.core.StandardWrapper.unload InstanceManager.destroy() for servlet [QueryEngineServlet] threw exception
java.lang.NullPointerException at org.apache.catalina.core.DefaultInstanceManager.destroyInstance (DefaultInstanceManager.java:197) at...etc...etc...


Is there a way to grab a full stack trace? It's not only what's printed in the stderr log, right?
2 months ago
Hi. I thought I should put it in consolidated form in Tomcat forum, should I remove this thread (although I don't think I have that access)?
2 months ago
Hello. I noticed this error while reviewing the logs and I further isolated it to when I shut the Tomcat Windows service off (working on previous issue)...


16-Oct-2020 12:37:49.350 SEVERE [Thread-5]

org.apache.catalina.core.StandardWrapper.unload InstanceManager.destroy() for servlet [QueryEngineServlet] threw exception

java.lang.NullPointerException at org.apache.catalina.core.DefaultInstanceManager.destroyInstance (DefaultInstanceManager.java:197) at...etc...etc...


I don't think it has anything to do with the destroy() methods in the running servlets as it doesn't specify those classes..rather it's destroy() in DefaultInstanceMenager.destroyInstance...and it seems to be on a higher thread level. Would anybody have an idea how to address this?

I do have two web apps running with the same servlet name (QueryEngneConfig)...could that be it? I wouldn't think so. I checked web.xml for both web apps and it seems ok.

The requests and responses seem all right as I noticed this error only in the log and it occurs only at service shutdown.

thank you very much.
2 months ago