Garbage Collector

2004-07-09 Thread Freddy Villalba Arias
Hi everybody,

 

What's the best / simplest way to implement a garbage collector that
starts running as soon as the web application (Tomcat) is up?

 

In my particular case, this garbage collector cleans certain records
meeting a certain criteria. The idea is quite simple: every n seconds,
the GC performs the corresponding query and deletes the records returned
by it.

 

I remember Weblogic having something like startup-classes that would be
exactly what I'm needing. Is there something similar in Tomcat? If not,
what would be the best / simplest way to implement this? I've thought
about a few options but none of them seem clean / efficient enough for
me...

 

Let me hear those thoughts!

 

Thanks in advance,

Freddy.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: Garbage Collector

2004-07-09 Thread Freddy Villalba Arias
Whoa, it was so obvious I almost feel stupid!

Thanks, Simon!

-Mensaje original-
De: simon colston [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 09 de julio de 2004 11:07
Para: Tomcat Users List
Asunto: Re: Garbage Collector

Freddy Villalba Arias wrote:
 
 What's the best / simplest way to implement a garbage collector that
 starts running as soon as the web application (Tomcat) is up?

I think this calls for a ServletContextListener.  Start your reaper 
thread in contextInitialized and kill it in contextDestroyed.

http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletCo
ntextListener.html

Cheers,

-- 
simon colston


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JNDI Datasource advanced use

2004-06-08 Thread Freddy Villalba Arias
Hi Enrico,

I suppose that by closing you mean freeing up the resource. When you
close a connection that has been obtained from a DataSource, I believe
it is not actually closed, but only released, hence made available to
other processes.

How many connections are there, for how long, and that sort of things...
they should be transparently managed by the underlying product (the one
where you configured your DS).

If this resembles your scenario, then closing connection should do it;
obviously, you will still have to handle the consequences of closing a
connection: rollback (or not) any transaction, etc... etc...

HTH,
Freddy.

-Mensaje original-
De: Enrico Drusiani [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 08 de junio de 2004 13:14
Para: [EMAIL PROTECTED]
Asunto: JNDI Datasource advanced use

Greetings everyone.

I need to give the user of my servlet based web application the chance
to
close a connection to a db if it takes too much time (some of my queries
work on a huge amount of data). I was thinking of something like a
cancel
button that asks a servlet to close the working connection. Can that be
achieved by using the JNDI datasource or have I to use some more
advanced
data layer like hibernate or jdo?

Thanks for your time and attention


Enrico Drusiani



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to monitor hits on static web pages?

2004-05-04 Thread Freddy Villalba Arias
Hello,

If I understood, I believe a Servlet Filter would do the job... You'd just have to 
make sure the pattern doesn't leave out anything you'd want to monitor / include 
anything you don't want to monitor.

HTH.

Freddy.

-Mensaje original-
De: Matrix [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 04 de mayo de 2004 14:18
Para: [EMAIL PROTECTED]
Asunto: How to monitor hits on static web pages?

I built a website for selling maple syrup (http://www.diotte.ca) and now I would like 
to track how many users are coming on the site.  When people goes to my dynamic pages 
it is easy to store all the information about the visitors but how can I do it from 
the first page that is static (index.html)?  Does Tomcat have a configuration flag for 
this?  Why I want to do that?  I want to know the ratio (people who visit the products 
page / people who visit the first page).  I don't use Apache as front end, I only use 
Tomcat 5.1.30.

Thanks,
Matrix




-
Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JTA support

2004-04-15 Thread Freddy Villalba Arias
Hello everybody,

 

I've been going up and down DBCP's (and Tomcat's) homesite and haven't
found the answer to this:

 

Does Tomcat support (and manage) JTA?

 

I know there is Tyrex, which provides this support, but I don't want to
use it. From what I've read, it's somewhat obsolete, replaced by DBCP.
I'm currently using DBCP.

 

On the top of that, from what I've understood from reading Sun's JTA
specs (yes, I'm a newbie to JTA), one thing is to provide the JTA
connectivity support (which is provided by the JDBC driver), and a
different one to support JTA management (this is transaction management
and so...), which is responsibility of the container (Servlet container
/ App. Server). Am I right?

 

Will appreciate any help you can provide.

 

Thanks in advance.

 

Regards,

Freddy.



RE: JTA support

2004-04-15 Thread Freddy Villalba Arias
Thanks, Robert. You've been quite helpful!

In Fact, I'd already installed and configured JBoss, knowing that it was
the best (cheapest / safest / easiest) option available; that is, those
I could envision based on my knowledge / experience, of course -- for
instance, I didn't know products such as JOTM (therefore, did not took
it into account as a possibility).

Based on your comments and my previous thoughts about this issue, I
believe I'll just stick to JBoss, play it safe.

Should anybody else have a different opinion, I'm still open to
suggestions.

Thanks everybody,
Freddy.

-Mensaje original-
De: Robert Krüger [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 15 de abril de 2004 11:04
Para: Tomcat Users List
Asunto: Re: JTA support


Freddy,

IMHO your options in this issue are:

1. Use Tyrex (Dead project, so you're on your own when you run into 
problems)
2. Use JOTM from Objectweb (that code is not really maintained nor in a 
good shape either. current project lead agreed on the mailing list, that

it's probably a good idea to rewrite and several people who have run 
into problems have come to the same conclusion)
3. Use JBoss (Almost certainly the best-supported but that means you 
have to learn how to set up tomcat to run within JBoss, the complexity 
of which others should judge as I have not tried it)
4. Buy a commercial solution as the one by atomikos (rather strange 
licensing model IMHO)

The right choice depends on what kind of project you do (critical 
commercial or less critical e.g. university project). I would recommend 
against 1 which I've been doing myself and it's not really worth the 
trouble. 2 is rather easy to set up and OK if it works for you (as I 
mentioned quite a few people including myself have run into some issues 
but a lot of others as I understand use it in production with success). 
I guess 3 would probably be the safest route but might be a bit of a 
learning curve in the beginning. 4 I have not used but if you don't know

exactly how many concurrent TXs you will have the license may become 
very expensive.

Hope this helps,

Robert


Freddy Villalba Arias wrote:

 Hello everybody,
 
  
 
 I've been going up and down DBCP's (and Tomcat's) homesite and haven't
 found the answer to this:
 
  
 
 Does Tomcat support (and manage) JTA?
 
  
 
 I know there is Tyrex, which provides this support, but I don't want
to
 use it. From what I've read, it's somewhat obsolete, replaced by DBCP.
 I'm currently using DBCP.
 
  
 
 On the top of that, from what I've understood from reading Sun's JTA
 specs (yes, I'm a newbie to JTA), one thing is to provide the JTA
 connectivity support (which is provided by the JDBC driver), and a
 different one to support JTA management (this is transaction
management
 and so...), which is responsibility of the container (Servlet
container
 / App. Server). Am I right?
 
  
 
 Will appreciate any help you can provide.
 
  
 
 Thanks in advance.
 
  
 
 Regards,
 
 Freddy.
 
 

-- 

Robert Krüger
Signal7 GmbH
Brüder Knauss Str. 79
64285 Darmstadt
Germany

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JTA support

2004-04-15 Thread Freddy Villalba Arias
Hi Robert,

Well... eerrrhmmm... let's see:

I just downloaded JBoss' latest version. I has already integrated
(ready to use) Tomcat 4 (v4.1, if I recall). Then, based on what JBoss
claims, I suppose (have not confirmed it, I have to say...) that the JTA
management implementation is provided (as specified by Sun's JTA
specs) by JBoss. The complementary part is, as you already know,
provided (or not) by the JDBC driver you are using. In a few words, I'm
trusting JBoss's JTA-ability, not Tomcat's.

That said, I can do this for you:

(1) Given the fact that I'll be using JBoss + Tomcat 4, just as they are
shipped, I'll develop a few JTA test over JBoss. Once I run them all, I
can send you my config files (cannot guarantee when I'll finish this,
I'm into lots of stuff right now). :)

(2) I can give it a look to see if I find something on the Internet (so
far, all I've found refers to v4, not v5).


Let me know if there is something else I can do for you.

Cheers,
Freddy.


-Mensaje original-
De: Robert Krüger [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 15 de abril de 2004 12:44
Para: Tomcat Users List
Asunto: Re: JTA support


Hi Freddy,

do you know (or anyone else for that matter) where to find instructions 
  how to configure a minimal JBoss to provide Tomcat 5 with JTA? On the 
JBoss website I can only see bundles with Tomcat 4. In case you succeed.

I would be interested in having a look at your configuration files. In 
the medium term I would like to get rid of our current hacked 
Tyrex-based JTA solution.

Regards,

Robert


Freddy Villalba Arias wrote:

 Thanks, Robert. You've been quite helpful!
 
 In Fact, I'd already installed and configured JBoss, knowing that it
was
 the best (cheapest / safest / easiest) option available; that is,
those
 I could envision based on my knowledge / experience, of course -- for
 instance, I didn't know products such as JOTM (therefore, did not took
 it into account as a possibility).
 
 Based on your comments and my previous thoughts about this issue, I
 believe I'll just stick to JBoss, play it safe.
 
 Should anybody else have a different opinion, I'm still open to
 suggestions.
 
 Thanks everybody,
 Freddy.
 
-- 

Robert Krüger
Signal7 GmbH
Brüder Knauss Str. 79
64285 Darmstadt
Germany

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JTA support

2004-04-15 Thread Freddy Villalba Arias
Hi,

Sorry if I misled you.

I'm using JBoss v3.2.3. According to that version's download page:

(includes Tomcat 4.1.29 JBossWeb HTTP server and JSP/Servlet engine,
EJB, CMP2.0, JCA, IIOP, Clustering, JTA, JMX and more)

I suppose (would have to start it up and check the logger's output)
that's the default version used by that version of JBoss. However, I
can't assure anything about other versions (of JBoss).

Regards,
Freddy.

-Mensaje original-
De: Nikola Milutinovic [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 15 de abril de 2004 14:04
Para: Tomcat Users List
Asunto: Re: JTA support

Robert Krüger wrote:

 
 Hi Freddy,
 
 do you know (or anyone else for that matter) where to find
instructions 
  how to configure a minimal JBoss to provide Tomcat 5 with JTA? On the

 JBoss website I can only see bundles with Tomcat 4. In case you
succeed. 
 I would be interested in having a look at your configuration files. In

 the medium term I would like to get rid of our current hacked 
 Tyrex-based JTA solution.

I think JBoss 3.2.4RCx ships with Tomcat 5.0.18 as default and has 4.1.x
as 
optional (under doc/examples or some such path).

Nix.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JTA support

2004-04-15 Thread Freddy Villalba Arias
You are right, Nik. There it is.

However, I believe the default used by JBoss (as shipped, of course)
will be v4.1.29... right? (haven't confirmed it yet) :)

Cheers,
Freddy.


-Mensaje original-
De: Nikola Milutinovic [mailto:[EMAIL PROTECTED] 
Enviado el: jueves, 15 de abril de 2004 14:19
Para: Tomcat Users List
Asunto: Re: JTA support

Freddy Villalba Arias wrote:

 Hi,
 
 Sorry if I misled you.
 
 I'm using JBoss v3.2.3. According to that version's download page:
 
 (includes Tomcat 4.1.29 JBossWeb HTTP server and JSP/Servlet engine,
 EJB, CMP2.0, JCA, IIOP, Clustering, JTA, JMX and more)

Look under doc/examples, there is a build dir for Tomcat 5.0.1x. You'll
need a 
working Ant to build it.

Nix.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JNDI and DataSource

2004-04-13 Thread Freddy Villalba Arias
Yeap, Daniel. It's there.

As I mentioned, I performed the very same test I'm doing right now, but
without DataSource and it works.

Now that you mention it, I read in some place that it was necessary to
remove the java.sql.* package from the jdbc jar file. I don't know if
that is true and, if so, why would that be necessary? Could that have
something to do with this problem? (it would be something very odd since
it would be affecting exclusively the behaviour of the DataSource,
according to what I stated on the previous paragraph.

Regards,
Freddy.



-Mensaje original-
De: Daniel Huang [mailto:[EMAIL PROTECTED] 
Enviado el: lunes, 12 de abril de 2004 20:57
Para: Tomcat Users List
Asunto: RE: JNDI and DataSource

Where did you put your db driver jar file? You want to put it under
$CATILINA/common/lib.

Regards,
Daniel

-Original Message-
From: Freddy Villalba Arias [mailto:[EMAIL PROTECTED]
Sent: Monday, April 12, 2004 10:19 AM
To: Tomcat Users List
Subject: RE: JNDI and DataSource

Tested it. Same result... same problem.

A side comment: the positive part of the other config file (the one I
had originally) was that you could trace how Tomcat loaded the
Resources. Then, you could see how the tags actually got processed
(read) correctly. But then, something happens when the factory builds
the DataSource object.

Regards,
Freddy.

-Mensaje original-
De: Guy Pardon [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 12 de abril de 2004 19:02
Para: Tomcat Users List
Asunto: Re: JNDI and DataSource


Hi,

The fact that you get 'No suitable driver' could also mean that the
chosen properties are incompatible (as opposed to not set).

Just a guess: did you try to specify the user and password as part of
the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED])
That's the way I usually connect to oracle.

You never know, maybe that's it...

HTH,

Guy

http://www.atomikos.com - Our JTA for your transactions

On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba
Arias wrote:

image.tiff





 Hi Sandy,



 Thanks, it certainly looked better than mine. I appreciate it.
 However, the problem persists...



 Any other suggestion? (I'll keep looking at it, too... obviously)





 -Mensaje original-
 De: Sandy McArthur [mailto:[EMAIL PROTECTED]
 Enviado el: lunes, 12de abril de 2004 18:29
 Para: Tomcat Users List
 Asunto: Re: JNDI and DataSource



 This shouldn't be all that different, but this is the server.xml I'd

 use on my setup.



 ?xml version=1.0 encoding=UTF-8?



 Server debug=5 port=8081 shutdown=SHUTDOWN

GlobalNamingResources



Resource name=jdbc/cnid scope=Shareable

 type=javax.sql.DataSource cached=false/



ResourceParams name=jdbc/cnid

  parameter

namefactory/name



 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

  /parameter



  parameter

namedriverClassName/name

valueoracle.jdbc.driver.OracleDriver/value

  /parameter



  parameter

nameurl/name



 valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value

  /parameter



  parameter

nameusername/name

valueSGC_CNID/value

  /parameter



  parameter

namepassword/name

value/value

  /parameter



  parameter

namedriverClassName/name

valueoracle.jdbc.driver.OracleDriver/value

  /parameter



  parameter

namemaxActive/name

value20/value

  /parameter



  parameter

namemaxIdle/name

value10/value

  /parameter



  parameter

namemaxWait/name

value-1/value

  /parameter



/ResourceParams

/GlobalNamingResources





Service name=Tomcat-Standalone



  Connector acceptCount=10

 className=org.apache.coyote.tomcat4.CoyoteConnector

 connectionTimeout=6 debug=0 maxProcessors=75
 minProcessors=5

 port=8080/



  Engine debug=5 defaultHost=localhost name=Standalone



Host


appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso

 a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true



  DefaultContext

 ResourceLink name=jdbc/cnid

 global=jdbc/cnid

 type=javax.sql.DataSource/

  /DefaultContext



  Context path=wa docBase=..\..\Testing debug=5

 reloadable=true

  /Context



  Context path= docBase=..\..\Testing debug=5

 reloadable=true

  /Context

RE: Tomcat 5 : Connection Pool to Access database

2004-04-13 Thread Freddy Villalba Arias
Hi Franz,

I'm experiencing EXACTLY the same problem, but in Tomcat 4.1 (running
from a Jbuilder X). HAVEN't solved it yet. However, I've received some
valid feedback that may prove to be effective for you.

Let me know of any adavances you make in this regard.

Jee... it's good to know I'm not the only one with this bizarre problem!

Regards,
Freddy.

-Mensaje original-
De: Francesco Pellegrini [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 13 de abril de 2004 9:28
Para: Tomcat-User-ML
Asunto: Tomcat 5 : Connection Pool to Access database 
Importancia: Alta

Hi All,

I'm working on Tomcat 5.0.18 web server with Access 2000 database on
Windows
2000 server environment.

At the moment I use simple connection to database by direct calling in
the
Java code like:

Connection Con=DriverManager.getConnection(jdbc:odbc:MyDatabase);

where MyDatabase is the ODBC source.

I'would like to configure a connection pool instead of direct
connection,
but after I did this changes in server.xml :




**

 GlobalNamingResources


Resource name=jdbc/myoracle auth=CONTAINER
type=javax.sql.DataSource/
  ResourceParams name=jdbc/myoracle
  parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory
/value
  /parameter
  parameter
namedriverClassName/name
valuesun.jdbc.odbc.JdbcOdbcDriver/value
 /parameter
   parameter
nameurl/name
valuejdbc:odbc:MyDatabase/value
  /parameter
 /ResourceParams

  /GlobalNamingResources






**


and this changes in web.xml of my web application :



**
resource-ref
descriptionOracle Datasource example/description
res-ref-namejdbc/myoracle/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref


**

I got on this error :

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.jav
a:743)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:5
18)


Could someone help me?

Thanks

Franz.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat 5 : Connection Pool to Access database

2004-04-13 Thread Freddy Villalba Arias
BTW, the topic is JNDI and DataSource and I'm trying to connect to an
Oracle DB.  :)

Freddy.

-Mensaje original-
De: Francesco Pellegrini [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 13 de abril de 2004 9:28
Para: Tomcat-User-ML
Asunto: Tomcat 5 : Connection Pool to Access database 
Importancia: Alta

Hi All,

I'm working on Tomcat 5.0.18 web server with Access 2000 database on
Windows
2000 server environment.

At the moment I use simple connection to database by direct calling in
the
Java code like:

Connection Con=DriverManager.getConnection(jdbc:odbc:MyDatabase);

where MyDatabase is the ODBC source.

I'would like to configure a connection pool instead of direct
connection,
but after I did this changes in server.xml :




**

 GlobalNamingResources


Resource name=jdbc/myoracle auth=CONTAINER
type=javax.sql.DataSource/
  ResourceParams name=jdbc/myoracle
  parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory
/value
  /parameter
  parameter
namedriverClassName/name
valuesun.jdbc.odbc.JdbcOdbcDriver/value
 /parameter
   parameter
nameurl/name
valuejdbc:odbc:MyDatabase/value
  /parameter
 /ResourceParams

  /GlobalNamingResources






**


and this changes in web.xml of my web application :



**
resource-ref
descriptionOracle Datasource example/description
res-ref-namejdbc/myoracle/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref


**

I got on this error :

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.jav
a:743)
at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:5
18)


Could someone help me?

Thanks

Franz.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JNDI and DataSource

2004-04-12 Thread Freddy Villalba Arias
Hi everybody,

 

This is a fairly simple problem, however this is one of those days a
huge truck could easily pass over you without you even noticing it...
anyway, here it goes!

 

The environment is: JBuilder X + Tomcat 4.1 + DBCP

 

The problem:

 

I want to obtain a DB connection through a DataSource that I'm looking
up using JNDI, configuring it inside server.xml

 

So far, I'm obtaining a reference to the DataSource object as expected,
using the jdbc/cnid name (that's the one I gave to that resource) on
the java:comp/env Context. However, that object is not initialized and
- the most bizarre part - the properties that I specified for that
resource inside serverXXX.xml are not populated.

 

I've read many postings and tutorials, even cut / pasted (adapted)
several similar examples I've found throughout the web, but can't seem
to make them work.

 

I've already tested DB connections without DataSources and they work
just fine.

 

This is the server.xml file:

 

?xml version=1.0 encoding=UTF-8?

Server debug=5 port=8081 shutdown=SHUTDOWN

  Service name=Tomcat-Standalone

Connector acceptCount=10
className=org.apache.coyote.tomcat4.CoyoteConnector
connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5
port=8080/

Engine debug=5 defaultHost=localhost name=Standalone

  Host
appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso
a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true

Context path=wa docBase=..\..\Testing debug=5
reloadable=true

  Resource name=jdbc/cnid scope=Shareable
type=javax.sql.DataSource cached=false/

  ResourceParams name=jdbc/cnid

parameter

  namefactory/name

 
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

/parameter

parameter

  namedriverClassName/name

  valueoracle.jdbc.driver.OracleDriver/value

/parameter

parameter

  nameurl/name

 
valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value

/parameter

parameter

  nameusername/name

  valueSGC_CNID/value

/parameter

parameter

  namepassword/name

  value/value

/parameter

parameter

  namedriverClassName/name

  valueoracle.jdbc.driver.OracleDriver/value

/parameter

parameter

  namemaxActive/name

  value20/value

/parameter

parameter

  namemaxIdle/name

  value10/value

/parameter

parameter

  namemaxWait/name

  value-1/value

/parameter

  /ResourceParams   

/Context

Context path= docBase=..\..\Testing debug=5
reloadable=true

/Context

  /Host

/Engine

  /Service

/Server

 

 

This is the exception thrown when attempting to obtain a Connection from
the DataSource I just looked-up (note that I'm printing the DataSource
object on the second line of the log below):

 

StandardHost[localhost]:  Mapped to context '/wa'

[EMAIL PROTECTED]

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null', cause: 

java.sql.SQLException: No suitable driver

at java.sql.DriverManager.getDriver(DriverManager.java:244)

at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:743)

at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:518)

at
com.bilbomatica.cnid.services.DBServiceProvider.getConnection(DBServiceP
rovider.java:71)

at org.apache.jsp.test_jsp._jspService(test_jsp.java:103)

at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:210)

at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)

at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:256)

at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)

at

RE: JNDI and DataSource

2004-04-12 Thread Freddy Villalba Arias
I MEANT OVER ME!!!

Sorry... as you can see, I'm a little burned-out here...

Thankx.

-Mensaje original-
De: Freddy Villalba Arias 
Enviado el: lunes, 12 de abril de 2004 15:44
Para: [EMAIL PROTECTED]
Asunto: JNDI and DataSource

Hi everybody,

 

This is a fairly simple problem, however this is one of those days a
huge truck could easily pass over you without you even noticing it...
anyway, here it goes!

 

The environment is: JBuilder X + Tomcat 4.1 + DBCP

 

The problem:

 

I want to obtain a DB connection through a DataSource that I'm looking
up using JNDI, configuring it inside server.xml

 

So far, I'm obtaining a reference to the DataSource object as expected,
using the jdbc/cnid name (that's the one I gave to that resource) on
the java:comp/env Context. However, that object is not initialized and
- the most bizarre part - the properties that I specified for that
resource inside serverXXX.xml are not populated.

 

I've read many postings and tutorials, even cut / pasted (adapted)
several similar examples I've found throughout the web, but can't seem
to make them work.

 

I've already tested DB connections without DataSources and they work
just fine.

 

This is the server.xml file:

 

?xml version=1.0 encoding=UTF-8?

Server debug=5 port=8081 shutdown=SHUTDOWN

  Service name=Tomcat-Standalone

Connector acceptCount=10
className=org.apache.coyote.tomcat4.CoyoteConnector
connectionTimeout=6 debug=0 maxProcessors=75 minProcessors=5
port=8080/

Engine debug=5 defaultHost=localhost name=Standalone

  Host
appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso
a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true

Context path=wa docBase=..\..\Testing debug=5
reloadable=true

  Resource name=jdbc/cnid scope=Shareable
type=javax.sql.DataSource cached=false/

  ResourceParams name=jdbc/cnid

parameter

  namefactory/name

 
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

/parameter

parameter

  namedriverClassName/name

  valueoracle.jdbc.driver.OracleDriver/value

/parameter

parameter

  nameurl/name

 
valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value

/parameter

parameter

  nameusername/name

  valueSGC_CNID/value

/parameter

parameter

  namepassword/name

  value/value

/parameter

parameter

  namedriverClassName/name

  valueoracle.jdbc.driver.OracleDriver/value

/parameter

parameter

  namemaxActive/name

  value20/value

/parameter

parameter

  namemaxIdle/name

  value10/value

/parameter

parameter

  namemaxWait/name

  value-1/value

/parameter

  /ResourceParams   

/Context

Context path= docBase=..\..\Testing debug=5
reloadable=true

/Context

  /Host

/Engine

  /Service

/Server

 

 

This is the exception thrown when attempting to obtain a Connection from
the DataSource I just looked-up (note that I'm printing the DataSource
object on the second line of the log below):

 

StandardHost[localhost]:  Mapped to context '/wa'

[EMAIL PROTECTED]

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null', cause: 

java.sql.SQLException: No suitable driver

at java.sql.DriverManager.getDriver(DriverManager.java:244)

at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:743)

at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:518)

at
com.bilbomatica.cnid.services.DBServiceProvider.getConnection(DBServiceP
rovider.java:71)

at org.apache.jsp.test_jsp._jspService(test_jsp.java:103)

at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:210)

at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193

RE: JNDI and DataSource

2004-04-12 Thread Freddy Villalba Arias
Yes and no... :)

I have only one web application to be deployed (wa). Then, I read in
some places that it's mandatory to have a default context. I tried
defining a DefaultContext but then Tomcat's initialization failed (I
looked for something odd but couldn't find anything). So, I decided to
create a default (dummy) web app by hand. That's the only intent of
that second web app. It doesn't even exist (there is no WEB-INF
directory, leave alone web.xml). The good part: that solved the
initialization problem.

So, it's not what I originally wanted (I'd remove it if I knew how to
elegantly solve the dummy web app - or just no default web app, if
possible - issue), but it does the job for now (if you can provide some
insight on this other subject, I would also appreciate it).

HTH.

-Mensaje original-
De: Sandy McArthur [mailto:[EMAIL PROTECTED] 
Enviado el: lunes, 12 de abril de 2004 17:32
Para: Tomcat Users List
Asunto: Re: JNDI and DataSource

You have a default context right after the wa context that doesn't 
specify a Resource . Is that what you meant?

Sandy

On Apr 12, 2004, at 9:44 AM, Freddy Villalba Arias wrote:

 [...]
   /ResourceParams

 /Context

 Context path= docBase=..\..\Testing debug=5
 reloadable=true

 /Context

   /Host

 [...]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JNDI and DataSource

2004-04-12 Thread Freddy Villalba Arias














Hi Sandy,



Thanks, it certainly looked better than mine. I
appreciate it. However, the problem persists



Any other suggestion? (Ill keep looking at it,
too obviously)





-Mensaje original-
De: Sandy McArthur [mailto:[EMAIL PROTECTED] 
Enviado el: lunes, 12 de abril de 2004 18:29
Para: Tomcat Users List
Asunto: Re: JNDI and DataSource



This shouldn't be all that different, but this is the server.xml I'd 

use on my setup.



?xml version=1.0 encoding=UTF-8?



Server debug=5 port=8081
shutdown=SHUTDOWN

 GlobalNamingResources



 Resource name=jdbc/cnid
scope=Shareable 

type=javax.sql.DataSource cached=false/



 ResourceParams name=jdbc/cnid

 parameter

 namefactory/name

 

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

 /parameter



 parameter

 namedriverClassName/name


valueoracle.jdbc.driver.OracleDriver/value

 /parameter



 parameter

 nameurl/name

 

valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value

 /parameter



 parameter

 nameusername/name

 valueSGC_CNID/value

 /parameter



 parameter

 namepassword/name

 value/value

 /parameter



 parameter

 namedriverClassName/name


valueoracle.jdbc.driver.OracleDriver/value

 /parameter



 parameter

 namemaxActive/name

 value20/value

 /parameter



 parameter

 namemaxIdle/name

 value10/value

 /parameter



 parameter

 namemaxWait/name

 value-1/value

 /parameter



 /ResourceParams

 /GlobalNamingResources





 Service name=Tomcat-Standalone



 Connector acceptCount=10

className=org.apache.coyote.tomcat4.CoyoteConnector

connectionTimeout=6 debug=0
maxProcessors=75 minProcessors=5

port=8080/



 Engine debug=5 defaultHost=localhost
name=Standalone



 Host

appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso

a datos\Tomcat\webapps debug=5
name=localhost unpackWARs=true



 DefaultContext

 ResourceLink name=jdbc/cnid

 global=jdbc/cnid

 type=javax.sql.DataSource/

 /DefaultContext



 Context path=wa
docBase=..\..\Testing debug=5 

reloadable=true

 /Context



 Context path=
docBase=..\..\Testing debug=5 

reloadable=true

 /Context



 /Host



 /Engine



 /Service



/Server





HTH



Sandy



On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote:



 Yes and no... :)



 I have only one web application to be deployed (wa). Then, I read
in

 some places that it's mandatory to have a default context. I tried

 defining a DefaultContext but then Tomcat's initialization
failed (I

 looked for something odd but couldn't find anything). So, I
decided to

 create a default (dummy) web app by hand.
That's the only intent of

 that second web app. It doesn't even exist (there is no WEB-INF

 directory, leave alone web.xml). The good part: that solved the

 initialization problem.



 So, it's not what I originally wanted (I'd remove it if I knew how
to

 elegantly solve the dummy web app - or just no default
web app, if

 possible - issue), but it does the job for now (if you can provide
some

 insight on this other subject, I would also appreciate it).



 HTH.



 -Mensaje original-

 De: Sandy McArthur [mailto:[EMAIL PROTECTED]

 Enviado el: lunes, 12 de abril de 2004 17:32

 Para: Tomcat Users List

 Asunto: Re: JNDI and DataSource



 You have a default context right after the wa context that doesn't

 specify a Resource . Is that what you meant?



 Sandy



 On Apr 12, 2004, at 9:44 AM, Freddy Villalba Arias wrote:



 [...]

 /ResourceParams



 /Context



 Context path=
docBase=..\..\Testing debug=5

 reloadable=true



 /Context



 /Host



 [...]






-

 To unsubscribe, e-mail: [EMAIL PROTECTED]

 For additional commands, e-mail:
[EMAIL PROTECTED]






-

 To unsubscribe, e-mail: [EMAIL PROTECTED]

 For additional commands, e-mail:
[EMAIL PROTECTED]









-

To unsubscribe, e-mail: [EMAIL PROTECTED]

For additional commands, e-mail: [EMAIL PROTECTED]










RE: JNDI and DataSource

2004-04-12 Thread Freddy Villalba Arias
Hi Guy,

That's interesting. I hadn't thought about that possibility. I'll try
it. 

However, let me state that I don't think that's the problem (hope I'm
wrong, of course!) since the inspection (JBuilder inspector) on the java
variable holding the reference to the DataSource object reveals that the
properties are indeed not being populated (in fact, there is an
attribute dataSource which I suppose is intended for holding the
actual DataSource and it's null as well).

Anyway, can't discard anything and your help is appreciated. Will let
you know the outcome of this test.

Cheers,
Freddy.

-Mensaje original-
De: Guy Pardon [mailto:[EMAIL PROTECTED] 
Enviado el: lunes, 12 de abril de 2004 19:02
Para: Tomcat Users List
Asunto: Re: JNDI and DataSource


Hi,

The fact that you get 'No suitable driver' could also mean that the 
chosen properties are incompatible (as opposed to not set).

Just a guess: did you try to specify the user and password as part of 
the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED])
That's the way I usually connect to oracle.

You never know, maybe that's it...

HTH,

Guy

http://www.atomikos.com - Our JTA for your transactions

On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba 
Arias wrote:

image.tiff

  

  

 Hi Sandy,

  

 Thanks, it certainly looked better than mine. I appreciate it. 
 However, the problem persists...

  

 Any other suggestion? (I'll keep looking at it, too... obviously)

  

  

 -Mensaje original-
 De: Sandy McArthur [mailto:[EMAIL PROTECTED]
 Enviado el: lunes, 12de abril de 2004 18:29
 Para: Tomcat Users List
 Asunto: Re: JNDI and DataSource

  

 This shouldn't be all that different, but this is the server.xml I'd

 use on my setup.

  

 ?xml version=1.0 encoding=UTF-8?

  

 Server debug=5 port=8081 shutdown=SHUTDOWN

    GlobalNamingResources

  

    Resource name=jdbc/cnid scope=Shareable

 type=javax.sql.DataSource cached=false/

  

    ResourceParams name=jdbc/cnid

  parameter

    namefactory/name

   

 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

  /parameter

  

  parameter

    namedriverClassName/name

    valueoracle.jdbc.driver.OracleDriver/value

  /parameter

  

  parameter

    nameurl/name

   

 valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value

  /parameter

  

  parameter

    nameusername/name

        valueSGC_CNID/value

  /parameter

  

  parameter

    namepassword/name

    value/value

  /parameter

  

  parameter

    namedriverClassName/name

    valueoracle.jdbc.driver.OracleDriver/value

  /parameter

  

  parameter

    namemaxActive/name

    value20/value

      /parameter

  

  parameter

    namemaxIdle/name

    value10/value

  /parameter

  

  parameter

    namemaxWait/name

    value-1/value

  /parameter

  

    /ResourceParams

    /GlobalNamingResources

  

  

    Service name=Tomcat-Standalone

  

  Connector acceptCount=10

 className=org.apache.coyote.tomcat4.CoyoteConnector

 connectionTimeout=6 debug=0 maxProcessors=75 
 minProcessors=5

 port=8080/

  

  Engine debug=5 defaultHost=localhost name=Standalone

  

    Host


appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso

 a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true

  

  DefaultContext

     ResourceLink name=jdbc/cnid

     global=jdbc/cnid

     type=javax.sql.DataSource/

  /DefaultContext

  

      Context path=wa docBase=..\..\Testing debug=5

 reloadable=true

  /Context

  

  Context path= docBase=..\..\Testing debug=5

 reloadable=true

  /Context

  

    /Host

  

  /Engine

  

    /Service

  

 /Server

  

  

 HTH

  

 Sandy

  

 On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote:

  

  Yes and no... :)

 

  I have only one web application to be deployed (wa). Then, I read in

  some places that it's mandatory to have a default context. I tried

  defining a DefaultContext but then Tomcat's initialization failed 
 (I

  looked for something odd but couldn't find anything). So, I decided 
 to

  create a default (dummy) web app by hand. That's the only intent

 of

  that second web app. It doesn't even exist (there is no WEB-INF

  directory, leave alone web.xml). The good part: that solved

RE: JNDI and DataSource

2004-04-12 Thread Freddy Villalba Arias
Tested it. Same result... same problem.

A side comment: the positive part of the other config file (the one I
had originally) was that you could trace how Tomcat loaded the
Resources. Then, you could see how the tags actually got processed
(read) correctly. But then, something happens when the factory builds
the DataSource object.

Regards,
Freddy.

-Mensaje original-
De: Guy Pardon [mailto:[EMAIL PROTECTED] 
Enviado el: lunes, 12 de abril de 2004 19:02
Para: Tomcat Users List
Asunto: Re: JNDI and DataSource


Hi,

The fact that you get 'No suitable driver' could also mean that the 
chosen properties are incompatible (as opposed to not set).

Just a guess: did you try to specify the user and password as part of 
the URL? (jdbc:oracle:thin:user/[EMAIL PROTECTED])
That's the way I usually connect to oracle.

You never know, maybe that's it...

HTH,

Guy

http://www.atomikos.com - Our JTA for your transactions

On maandag, apr 12, 2004, at 18:35 Europe/Brussels, Freddy Villalba 
Arias wrote:

image.tiff

  

  

 Hi Sandy,

  

 Thanks, it certainly looked better than mine. I appreciate it. 
 However, the problem persists...

  

 Any other suggestion? (I'll keep looking at it, too... obviously)

  

  

 -Mensaje original-
 De: Sandy McArthur [mailto:[EMAIL PROTECTED]
 Enviado el: lunes, 12de abril de 2004 18:29
 Para: Tomcat Users List
 Asunto: Re: JNDI and DataSource

  

 This shouldn't be all that different, but this is the server.xml I'd

 use on my setup.

  

 ?xml version=1.0 encoding=UTF-8?

  

 Server debug=5 port=8081 shutdown=SHUTDOWN

    GlobalNamingResources

  

    Resource name=jdbc/cnid scope=Shareable

 type=javax.sql.DataSource cached=false/

  

    ResourceParams name=jdbc/cnid

  parameter

    namefactory/name

   

 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

  /parameter

  

  parameter

    namedriverClassName/name

    valueoracle.jdbc.driver.OracleDriver/value

  /parameter

  

  parameter

    nameurl/name

   

 valuejdbc:oracle:thin:@BMSRVORACLE:1521:BMSRVMS/value

  /parameter

  

  parameter

    nameusername/name

        valueSGC_CNID/value

  /parameter

  

  parameter

    namepassword/name

    value/value

  /parameter

  

  parameter

    namedriverClassName/name

    valueoracle.jdbc.driver.OracleDriver/value

  /parameter

  

  parameter

    namemaxActive/name

    value20/value

      /parameter

  

  parameter

    namemaxIdle/name

    value10/value

  /parameter

  

  parameter

    namemaxWait/name

    value-1/value

  /parameter

  

    /ResourceParams

    /GlobalNamingResources

  

  

    Service name=Tomcat-Standalone

  

  Connector acceptCount=10

 className=org.apache.coyote.tomcat4.CoyoteConnector

 connectionTimeout=6 debug=0 maxProcessors=75 
 minProcessors=5

 port=8080/

  

  Engine debug=5 defaultHost=localhost name=Standalone

  

    Host


appBase=C:\Usuarios\fvillalba\project\SGC\SGC_CNID\FUENTES\java\Acceso

 a datos\Tomcat\webapps debug=5 name=localhost unpackWARs=true

  

  DefaultContext

     ResourceLink name=jdbc/cnid

     global=jdbc/cnid

     type=javax.sql.DataSource/

  /DefaultContext

  

      Context path=wa docBase=..\..\Testing debug=5

 reloadable=true

  /Context

  

  Context path= docBase=..\..\Testing debug=5

 reloadable=true

  /Context

  

    /Host

  

  /Engine

  

    /Service

  

 /Server

  

  

 HTH

  

 Sandy

  

 On Apr 12, 2004, at 11:36 AM, Freddy Villalba Arias wrote:

  

  Yes and no... :)

 

  I have only one web application to be deployed (wa). Then, I read in

  some places that it's mandatory to have a default context. I tried

  defining a DefaultContext but then Tomcat's initialization failed 
 (I

  looked for something odd but couldn't find anything). So, I decided 
 to

  create a default (dummy) web app by hand. That's the only intent

 of

  that second web app. It doesn't even exist (there is no WEB-INF

  directory, leave alone web.xml). The good part: that solved the

  initialization problem.

 

  So, it's not what I originally wanted (I'd remove it if I knew how
to

  elegantly solve the dummy web app - or just no default web app, if

  possible - issue), but it does the job for now (if you can