dcsimg
I have a question about how JNDI works in Tomcat 4.0.1!_NEWLINE_! How can i set up a JNDI naming repository in order to create a!_NEWLINE_!datasource???
6 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jaime_Garcia
Posted On:   Thursday, October 25, 2001 03:10 AM

Hi evryone I have a question about how JNDI works in Tomcat 4.0.1 How can i set up a JNDI naming repository in order to create a datasource??? In the server.xml i have this: type="javax.sql.DataSource"/> user scott password tiger driverClassName oracle.jdbc.driver.OracleDriver driverName jdbc:oracle:thin:@zagarron:1521:orcl Inside de Context tag of my application. In the web.xml i have this: jdbc/FtcAppDb javax.sql.DataSource Container i get the datasource obje   More>>

Hi evryone

I have a question about how JNDI works in Tomcat 4.0.1
How can i set up a JNDI naming repository in order to create a
datasource???


In the server.xml i have this:


type="javax.sql.DataSource"/>



user scott



password tiger

driverClassName
oracle.jdbc.driver.OracleDriver


driverName

jdbc:oracle:thin:@zagarron:1521:orcl




Inside de Context tag of my application.


In the web.xml i have this:




jdbc/FtcAppDb

javax.sql.DataSource

Container




i get the datasource object doing this :

DataSource ds =
(DataSource)ctx.lookup("jdbc/FtcAppDb");
but when i try to create the connection object i get a Null Pointer
exception error


Could anyone help me i don't have a clue about what happen.

Thanks for the time

   <<Less

Re: I have a question about how JNDI works in Tomcat 4.0.1!_NEWLINE_! How can i set up a JNDI naming repository in order to create a!_NEWLINE_!datasource???

Posted By:   John_Keresztur  
Posted On:   Wednesday, March 20, 2002 12:13 PM

I had the same problem, turned out that my context path and docbase appear to be case sensitive. As far as I can tell, both of these have to match your web application's directory name under Tomcat's webapp directory.

e.g.:

I had a webapp called: "WorkAuth"

and initially had the following setup which in turn had the resource stuff in it (in server.xml):

.....blabla

once I changed it to match:



then it worked and I got a datasource.

-john

Re: I have a question about how JNDI works in Tomcat 4.0.1!_NEWLINE_! How can i set up a JNDI naming repository in order to create a!_NEWLINE_!datasource???

Posted By:   Apu_Nath  
Posted On:   Sunday, March 10, 2002 08:48 PM

Well how are you getting the context ctx that you are using to do the look up, as there is no factory for it u need to get to the context by the name of java:comp

try something like this
Context ctx=(Context)new InitialContext().lookup("java:comp/env");

this ctx can now e used in your

DataSource blah blah blah....

Re: I have a question about how JNDI works in Tomcat 4.0.1!_NEWLINE_! How can i set up a JNDI naming repository in order to create a!_NEWLINE_!datasource???

Posted By:   Lu_Phone  
Posted On:   Thursday, January 31, 2002 07:09 PM

when you try to do ctx.lookup(),put the Name String as
"java:comp/env/jdbc/FtcAppDb".
But even you do this,I think I will also get an Exception ("Name jdbc not found"),I have try it already.
I think the root reason is that we haven't really deployed such a JNDI DataSource with Tomcat,maybe it's tomcat's BUG .

Re: I have a question about how JNDI works in Tomcat 4.0.1!_NEWLINE_! How can i set up a JNDI naming repository in order to create a!_NEWLINE_!datasource???

Posted By:   srinivas_s  
Posted On:   Thursday, January 3, 2002 10:24 AM

Hi Jamie,

I am also facing the same problem and the only difference from your application and my application is that I am using SQL Server via jdbc-odbc bridge. I tried to use the way you have described and I still get a
javax.naming.NameNotFoundException. Name jdbc is not bound in this Context

Can you help me out as to what the problem could be. The configuration in the server.xml file and web.xml file are correct as Tomcat does not give any error while loading. Only at runtime, It is not able to find jdbc in the Context. Help me out in this please. Thanking you in advance. This is pretty urgent. I hope I am not being a bother

Re: I have a question about how JNDI works in Tomcat 4.0.1!_NEWLINE_! How can i set up a JNDI naming repository in order to create a!_NEWLINE_!datasource???

Posted By:   Leandro_Alves  
Posted On:   Thursday, December 20, 2001 10:51 AM

Hi Jaime,


You must copy the Oracle JDBC package to $TOMCAT_HOME/common/lib.


This package you get in Oracle's Web site.


The most important: the Oracle JDBC package is a .ZIP file. You´ll have to uncompress the file and compress it like a .JAR. The Tomcat just understand .JAR´s.


Leandro

Re: I have a question about how JNDI works in Tomcat 4.0.1!_NEWLINE_! How can i set up a JNDI naming repository in order to create a!_NEWLINE_!datasource???

Posted By:   Alex_Merk  
Posted On:   Wednesday, December 5, 2001 02:39 AM

Hello
i had the same problem, but i resolved it *yeah*. Tomcat can't handle "jar"-files in ZIP-format. i guess your oracle file is "classes12.zip". Please reformated to a real jar-file.
About | Sitemap | Contact