Access to Tomcat's JNDI source (connection pool) outside of Tomcat

Hi,

I was wondering if there was a way to access the connection pool of Tomcat from a Java program (standalone) outside the context of Tomcat.  I am using JasperReports and want to test without have to restart Tomcat everytime.  The tool lets you run the JavaBean so I can see if the results are correct.

Thanks
LVL 1
James CochraneB2B FINTECH WRITER/Technology WriterAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
You can install and run DBCP without Tomcat

http://jakarta.apache.org/commons/dbcp/
0
 
aozarovCommented:
I don't think that is possible (even if you managed to get access to the jndi remotely).
<ResourceParams name="jdbc/TestDB">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
...

If you look at tomcat source:
http://www.docjar.com/html/api/org/apache/commons/dbcp/BasicDataSourceFactory.java.html
you will see that this returns
http://www.docjar.com/docs/api/org/apache/commons/dbcp/BasicDataSource.html
which is not either serializable nor a remote object.
0
 
aozarovCommented:
In addition to that I don't think you can even get access to the JNDI remotely.
From http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
"The InitialContext is configured as a web application is initially deployed, and is made available to web application components.."
The jndi does not seem to expose any remote access to it.
But as I said before even if you had access you still can't get the DataSource (unless you will replace the datasource factory).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.