tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Hernandez Angeles" <>
Subject Trying to mix db connection pooling on web and desktop applications
Date Tue, 22 Jul 2008 19:51:36 GMT
Hello, this is the scenario:
I have an application that must have two interfaces: as a desktop application and as a web
I've put the business logic inside a JAR library (client_bpm.jar), which must connect to an
Oracle 9i database
I configured the web application so it can use a db pool connection, in the following manner:

1. Added to %CATALINA_HOME%/conf/server.xml the following:
      <Resource name="jdbc/RAM_DB"

2. Added to %CATALINA_HOME%/conf/context.xml the following:

3. Added to %CATALINA_HOME%/webapps/myWebApp/WEB-INF/web.xml the following:
      Resource reference to a factory for java.sql.Connection
      instances that may be used for talking to a particular
      database that is configured in the Context
      configurartion for the web application.

4. Added my business library (client_bpm.jar) to %CATALINA_HOME%/webapps/myWebApp/WEB-INF/lib
5. Added JDBC library (ojdbc14.jar) to %CATALINA_HOME%/lib
6. Use the following code to get a db connection:
  Context initCtx = new InitialContext();
  Context envCtx = (Context) initCtx.lookup("java:comp/env");
  DataSource ds = (DataSource) envCtx.lookup("jdbc/RAM_DB");
  Connection conn= ds.getConnection();

And the web application runs fine, i have no problems with it
Now, what i want is to use the same db connection pool facility (that Tomcat provides to web
applications) on my desktop application, and use the same code (or something very similar)
i used in point 6 to obtain a db connection
With points 1-3 Tomcat provided my web application with a db connection pooling facility
I want Tomcat to provide to my desktop application the same db connection pooling facility,
¿How do i do that?
I have tried invoking my desktop application with the following:
java -classpath ".;%CATALINA_HOME%/webapps/myWebApp/WEB-INF/lib/client_bpm.jar;%CATALINA_HOME%/lib/catalina.jar;%CATALINA_HOME%/bin/tomcat-juli.jar;%CATALINA_HOME%/lib/ojdbc14.jar" -Djava.naming.factory.url.pkgs=org.apache.naming

And got the following error:
javax.naming.NameNotFoundException: Name java: is not bound in this Context
        at org.apache.naming.NamingContext.list(
        at org.apache.naming.NamingContext.list(
        at javax.naming.InitialContext.list(
        at MyDesktopApp.main(

Any suggestions will be appreciated
Aviso Confidencial.-

Este correo electrónico, así como los archivos adjuntos que contenga son confidenciales
de conformidad con las leyes aplicables, y es para uso exclusivo del destinatario al que expresamente
se le ha enviado. Si usted no es el destinatario legítimo del mismo, deberá reportarlo al
remitente del correo y borrarlo inmediatamente. Cualquier revisión, retransmisión, divulgación,
difusión o cualquier otro uso de este correo, por personas o entidades distintas a las del
destinatario legítimo, queda expresamente prohibido. Los derechos de propiedad respecto de
la información, material, bases de datos, diseños, y los distintos elementos en él contenidos
son titularidad de Mapfre Tepeyac, S. A. Este correo electrónico no pretende ni debe ser
considerado como constitutivo de ninguna relación legal, contractual o de otra índole similar.


Confidencial Notice.-

This e-mail, as such as the attached files it contains are confidential in accordance with
the applicable laws, and is for exclusive use to expressly addressee has been sending. If
you are not the legitimate addressee itself, you will must report to sender of mail and cross
it immediately. Any review, re-transmission, disclosure, dissemination or any other use of
this mail, from people or different entities from the legitimate addressee, is prohibited.
The property rights about the information, material, databases, designs, and the different
components in it contains are ownership of  MAPFRE Tepeyac, S. A. This e-mail do not pretend,
neither it should be considered of any legal or contractual relationship.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message