Posted By:
Felix_Yuen
Posted On:
Tuesday, February 5, 2002 04:55 AM
Hi everyone, I am using Tomcat4 to develop a Web Application and I would like to use database connection pool to connection postgreSQL. But I meet a problem, I try to lookup a DataSource, I get a java.lang.ClassCastException , and I find that the lookup() method return null to me. I don't know why, I have try I lot of method, but still get the same problem. I have follow the document JNDI Resources HOW-TO that provide by Tomcat, get problem. Then I try to use Poolman, just follow the User guide, get problem again. After that, I try to integrate with JBoss, get the same problem too. Finally, I use Tomcat3 integrate with JBoss, I can lookup the datasource. I don't know why, is it the bug of Tomcat4?
More>>
Hi everyone,
I am using Tomcat4 to develop a Web Application and I would like to use database connection pool to connection postgreSQL. But I meet a problem, I try to lookup a DataSource, I get a
java.lang.ClassCastException
, and I find that the lookup() method return
null
to me.
I don't know why, I have try I lot of method, but still get the same problem. I have follow the document
JNDI Resources HOW-TO
that provide by Tomcat, get problem. Then I try to use Poolman, just follow the User guide, get problem again. After that, I try to integrate with JBoss, get the same problem too. Finally, I use Tomcat3 integrate with JBoss, I can lookup the datasource. I don't know why, is it the bug of Tomcat4?
Here is the code I use in my javabean.
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:1099");
InitialContext initCtx = new InitialContext(props);
DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/myDS");
Am I using the correct Context Factory?
Please help me to solve this problem, I want to use Tomcat4, I don't want to switch back to Tomcat3.
best regards,
Felix
<<Less