?
Solved

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

Posted on 2005-04-21
3
Medium Priority
?
645 Views
Last Modified: 2013-11-24
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
0
Comment
Question by:James Cochrane
  • 2
3 Comments
 
LVL 15

Expert Comment

by:aozarov
ID: 13836305
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
 
LVL 15

Expert Comment

by:aozarov
ID: 13836383
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
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 13838665
You can install and run DBCP without Tomcat

http://jakarta.apache.org/commons/dbcp/
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question