[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Tomcat4 and Debian

Hi all,
  I have been makeing an application under tomcat4. The application tuns 
correctly with the version 4.1.24 downloaded directly from apache. But it 
does not with the version of tomcat from debian (unstable). The following 
exception appears:

javax.naming.NamingException: Cannot create resource instance

These are the lines causing the exception:

        InitialContext init = new InitialContext();
        Context ctx = (Context) init.lookup("java:comp/env");
->      DataSource source = (DataSource)ctx.lookup("jdbc/contenedores");

In the /etc/tomcat4/server.xml I have defined the following under the 
application context:

          <Resource name="jdbc/contenedores" auth="Container"
                type="javax.sql.DataSource" />
          <ResourceParams name="jdbc/contenedores" >

In the web.xml file of the application I have the following
      <description>Base de datos de contenedores</description>

And I have installed the file 05VazMaCon under the directory /etc/tomcat4/
policy.d containing:

grant codeBase "file:/home/luis/RamonVazquez/VazMaCon/WEB-INF/classes/-" {
  permission java.security.AllPermission;  

If I connect directly to de database:
            conexion = DriverManager.getConnection("jdbc:mysql://localhost

The application runs correctly. I suppose that there is a mistake in the jndi 
configuration, but I do not  what I have to do.

Thank you all,
        Luis Llana

Luis Fernando Llana Díaz
If you use Internet Explorer 6 under Windog XP, click here

Reply to: