Does Tomcat4.0 create automatically an InitialContext ?

2002-02-21 Thread Frederic Monclar

Hello,

I try to access to my Oracle database thanks to the new services of
Tomcat4.0.
I read all the interesting documentation on the Jakarta-Tomcat web site
:

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html
"Tomcat 4 provides a JNDI InitialContext implementation instance to web
applications running under it,
 in a manner that is compatible with those provided by a Java2
Enterprise Edition application server.
Entries in this InitialContext are configured in the
$CATALINA_HOME/conf/server.xml file, and may be referenced by the
following elements in the web application deployment descriptor
(/WEB-INF/web.xml) of your web application:"

and I tried the following :

server.xml (located in /usr/local/jakarta-tomcat-4.0.2/conf):
-


  

  

  

  user
  fred


  password
  fred


  driverClassName
  oracle.jdbc.driver.OracleDriver


  driverName
  jdbc:oracle:thin:@ukki:1521:develdb

  



my web.xml (located in /home/fred/myproject/WEB-INF/):
--

Resource reference to a factory for
java.sql.Connection
jdbc/SIR_DB
javax.sql.DataSource
Container


my jsp file (located in /home/fred/myproject/):
---
...
<%
  javax.naming.Context  initCtx   = null;
  javax.naming.Context  envCtx= null;
  // Obtain our environment naming context
  initCtx = new javax.naming.InitialContext();
  envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
  // Look up our data source
  ds = (oracle.jdbc.pool.OracleDataSource)
envCtx.lookup("jdbc/SIR_DB");
...
%>
Where "ds" is always null.



So, do we have to create an initialContext, or to had a subcontext or to
install an LDAP directory to manage these resources ?
Does anyone could help me ?
Thanks in advance,
Fred.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Does Tomcat4.0 create automatically an InitialContext ?

2002-02-21 Thread Frederic Monclar

Hello,

I try to access to my Oracle database thanks to the new services of
Tomcat4.0.
I read all the interesting documentation on the Jakarta-Tomcat web site
:

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html
"Tomcat 4 provides a JNDI InitialContext implementation instance to web
applications running under it,
 in a manner that is compatible with those provided by a Java2
Enterprise Edition application server.
Entries in this InitialContext are configured in the
$CATALINA_HOME/conf/server.xml file, and may be referenced by the
following elements in the web application deployment descriptor
(/WEB-INF/web.xml) of your web application:"

and I tried the following :

server.xml (located in /usr/local/jakarta-tomcat-4.0.2/conf):
-


  

  

  

  user
  fred


  password
  fred


  driverClassName
  oracle.jdbc.driver.OracleDriver


  driverName
  jdbc:oracle:thin:@ukki:1521:develdb

  



my web.xml (located in /home/fred/myproject/WEB-INF/):
--

Resource reference to a factory for
java.sql.Connection
jdbc/SIR_DB
javax.sql.DataSource
Container


my jsp file (located in /home/fred/myproject/):
---
...
<%
  javax.naming.Context  initCtx   = null;
  javax.naming.Context  envCtx= null;
  // Obtain our environment naming context
  initCtx = new javax.naming.InitialContext();
  envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
  // Look up our data source
  ds = (oracle.jdbc.pool.OracleDataSource)
envCtx.lookup("jdbc/SIR_DB");
...
%>
Where "ds" is always null.



So, do we have to create an initialContext, or to had a subcontext or to
install an LDAP directory to manage these resources ?
Does anyone could help me ?
Thanks in advance,
Fred.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: Datasources context ?

2002-02-15 Thread Frederic Monclar

May be you have defined at a wrong place your resource in your
server.xml file.
Fred.


> "Jacquet, Frederic" wrote:
> 
> I have got this error
> Name java:comp is not bound in this Context
> 
> When I try the following code :
>  try {
> Context initCtx = new InitialContext();
> Context envCtx = (Context)
> initCtx.lookup("java:comp/env");
> DataSource ds = (DataSource) envCtx.lookup("jdbc/TestDb");
> 
> Connection conn = ds.getConnection();
> 
> Statement st = conn.createStatement();
> ResultSet rs = st.executeQuery("SELECT prenom,nom FROM
> annuaire;");
> while (rs.next()) {
> out.println("" + rs.getString("prenom"));
> out.println(" " + rs.getString("nom"));
> }
> 
> conn.close();
> } catch (Exception e) {
> out.print(e.getMessage());
> }
> And the declarations
> server.xml
>  type="javax.sql.DataSource"/>
>   
> 
> useruser
> 
> passwordpasswd
> driverClassName
>   org.gjt.mm.mysql.Driver
> driverName
>   jdbc:mysql://localhost/test
>   
> web.xml
> 
> Test database.
> jdbc/TestDb
> javax.sql.DataSource
> CONTAINER
> 
> 
> What is wrong ???
> 
> Regards / Cordialement
> 
> Frederic Jacquet
> 
> ---
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




java.io.IOException: No such file or directory

2002-02-15 Thread Frederic Monclar

Hello,

Does someone have any idea about this exception when starting
Tomcatv4.02 ?

=> tldConfigJar(/WEB-INF/lib/oracledr.jar): 
java.io.IOException: No such file or directory

Thanks in advance,
Fred.

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Tomcat v4.0.2 : null DataSource when trying to get JNDI InitialContext

2002-02-15 Thread Frederic Monclar

Dear all,

Like several persons, I got this "null DataSource". I read several
mails, but i didn't find any answer.(example:
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg44065.html).

So I am trying to define the problem as accurate as possible :

Environment definition :

- Running Tomcat v4.02 under Linux (installation directory :
/usr/local/jakarta-tomcat-4.0.2)
- Starting developping my web application with asimple JSP page
(installation directory : /home/james/myWebProject/)
- Creating subdirectrories /home/james/myWebProject/WEB-INF/ and
/home/james/myWebProject/WEB-INF/lib/
- Using Oracle 8 on my database server named ukki, and copying the
Oracle
driver in /home/james/myWebProject/WEB-INF/lib/
- The instance of my databse is named : develdb


My server.xml file (in /usr/local/jakarta-tomcat-4.0.2/conf) :
--
...
  
  
...



...

  
  
...


  

  

  

  user
  james


  password
  bond007


  driverClassName
  oracle.jdbc.driver.OracleDriver


  driverName
  jdbc:oracle:thin:@ukki:1521:develdb

  


...
  



  
...


and my "web.xml" file (in /home/james/myWebProject/WEB-INF/) :
--
...


  Resource reference to a factory for
  java.sql.Connection

jdbc/myDB
javax.sql.DataSource
Container

...

To start Tomcat :
-
/usr/local/jakarta-tomcat-4.0.2/bin/startup.sh

and i got the following traces :
2002-02-15 15:15:42 StandardContext[/Test]: Starting
2002-02-15 15:15:42 StandardContext[/Test]: Processing start(), current
available=false
2002-02-15 15:15:42 StandardContext[/Test]: Configuring default
Resources
2002-02-15 15:15:42 StandardContext[/Test]: Configuring non-privileged
default Loader
2002-02-15 15:15:42 StandardContext[/Test]: Configuring default Manager
2002-02-15 15:15:42 StandardContext[/Test]: Processing standard
container startup
2002-02-15 15:15:42 WebappLoader[/Test]: Deploying class repositories to
work directory /usr/local/jakarta-tomcat-4.0.2/work/localhost/Test
2002-02-15 15:15:42 WebappLoader[/Test]: Deploy JAR
/WEB-INF/lib/oracledr.jar to
/home/james/myWebProject/WEB-INF/lib/oracledr.jar
2002-02-15 15:15:42 WebappLoader[/Test]: Reloading checks are enabled
for this Context
2002-02-15 15:15:42 StandardManager[/Test]: Seeding random number
generator class java.security.SecureRandom
2002-02-15 15:15:42 StandardManager[/Test]: Seeding of random number
generator has been completed
2002-02-15 15:15:42 ContextConfig[/Test]: ContextConfig: Processing
START
2002-02-15 15:15:43 StandardContext[/Test]: Setting deployment
descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN'
2002-02-15 15:15:43 StandardContext[/Test]: Setting deployment
descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN'
2002-02-15 15:15:43 ContextConfig[/Test]: Scanning web.xml tag libraries
2002-02-15 15:15:43 ContextConfig[/Test]: Scanning library JAR files
2002-02-15 15:15:43 ContextConfig[/Test]:
tldConfigJar(/WEB-INF/lib/oracledr.jar): java.io.IOException: No such
file or directory
2002-02-15 15:15:43 Authenticator[/Test]: No SingleSignOn Valve is
present
2002-02-15 15:15:43 ContextConfig[/Test]: Configured an authenticator
for method BASIC
2002-02-15 15:15:43 ContextConfig[/Test]: Pipline Configuration:
2002-02-15 15:15:43 ContextConfig[/Test]:  
org.apache.catalina.authenticator.BasicAuthenticator/1.0
2002-02-15 15:15:43 ContextConfig[/Test]:  
org.apache.catalina.core.StandardContextValve/1.0
2002-02-15 15:15:43 ContextConfig[/Test]: ==
2002-02-15 15:15:43 StandardContext[/Test]: Configuring application
event listeners
2002-02-15 15:15:43 StandardContext[/Test]: Sending application start
events
2002-02-15 15:15:43 StandardContext[/Test]: Starting filters
2002-02-15 15:15:43 StandardContext[/Test]: Posting standard context
attributes
2002-02-15 15:15:43 StandardWrapper[/Test:default]: Loading container
servlet default
2002-02-15 15:15:43 default: init
2002-02-15 15:15:43 StandardWrapper[/Test:invoker]: Loading container
servlet invoker
2002-02-15 15:15:43 invoker: init
2002-02-15 15:15:43 jsp: init
2002-02-15 15:15:44 StandardContext[/Test]: Starting completed



 1st PROBLEM 
2002-02-15 15:15:43 ContextConfig[/Test]: Scanning library JAR files
2002-02-15 15:15:43 ContextConfig[/Test]:
tldConfigJar(/WEB-INF/lib/oracledr.jar): java.io.IOException: No such
file or directory
 1st PROBLEM 


Then I use a simple jsp page to execute a simple SQL statement :
--