Re: Strange problem with data source Tomcat 6.0.18

2009-09-01 Thread Michael Ludwig

Schalk,

glad you solved it.

Michael Ludwig schrieb:

Then I suspect a typo in your resource definition. I once had
Resource/@url instead of Resource/@uri with the MySQL driver.
The error was just:


For posterity, I got this the wrong way around: Resource/@url is
correct, Resource/@uri is incorrect. At least for that version of
the driver - 5.1.7, I believe.

--
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Schalk
Hi everyone,

I sincerely hope someone can point me in the right direction here. I have
set-up a data source using the context.xml file located inside my META-INF
and added the relevant entry in the web apps web.xml. I also have the MySQL
connector/j driver inside my own apps lib as well as inside the server's
lib(same version). When running the app on my local machine it works without
any hassles b.t.w. I am connecting to the remote db server from my local
machine.

Now when I deploy the .war to the server in which the db is running, the
archive is deployed but when I now try to get a connection to the same db
and same server as from my local machine I get:

Cannot create JDBC driver of class '' for connect URL 'null'

I do test whether I can get a context before trying to connect to the db:

try {
Context initialContext = new InitialContext();
Context envContext = (Context)initialContext.lookup(java:comp/env);
if(envContext != null) {
DataSource dataSource =
(DataSource)envContext.lookup(jdbc/wuMaps);
conn = dataSource.getConnection();
} else {
log.error(Houston we have a problem No Context!);
}

The name jdbc/wuMaps is also exactly the same in the web.xml as well as the
context.xml, any ideas why the app cannot find the data source on the
server? I look forward to hearing from everyone.

--
Kind Regards
Schalk Neethling



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Caldarale, Charles R
 From: sch...@afrigis.co.za [mailto:sch...@afrigis.co.za]
 Subject: Strange problem with data source Tomcat 6.0.18
 
 I also have the MySQL connector/j driver inside my own apps lib
 as well as inside the server's lib(same version).

Don't ever do that.  A given class must appear in only *one* place in any 
particular branch of the classloader tree.  A picture of the tree is here:
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

Until you correct that duplication, nothing you try will be reliable.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Michael Ludwig
sch...@afrigis.co.za schrieb am 31.08.2009 um 23:16:48 (+0200):

 I have set-up a data source using the context.xml file located inside
 my META-INF and added the relevant entry in the web apps web.xml. I
 also have the MySQL connector/j driver inside my own apps lib as well
 as inside the server's lib(same version).

That's wrong. The driver must not be in both locations. It must be made
available to the common classloader, which provides classes to both the
server and the applications.

Discard the driver from your application.

 Now when I deploy the .war to the server in which the db is running,
 the archive is deployed but when I now try to get a connection to the
 same db and same server as from my local machine I get:
 
 Cannot create JDBC driver of class '' for connect URL 'null'

Are you doing a proper deploy using the manager application? Or removing
the WAR and properly waiting for Tomcat to discover this?

Or are you improperly clobbering the WAR? That would leave a stale
context.xml for your application in place.

-- 
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Schalk
Hey Chuck,

Thanks for the quick reply :) Which one would you recommend removing, I
guess removing it from my app and leaving it in the server's lib makes it
available to all apps but then I may break some other folks apps who deploy
their app with the jar, h Looking forward to hearing from you.

--
Kind Regards
Schalk Neethling

-Original Message-
From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] 
Sent: 31 August 2009 11:26 PM
To: Tomcat Users List
Subject: RE: Strange problem with data source Tomcat 6.0.18

 From: sch...@afrigis.co.za [mailto:sch...@afrigis.co.za]
 Subject: Strange problem with data source Tomcat 6.0.18
 
 I also have the MySQL connector/j driver inside my own apps lib
 as well as inside the server's lib(same version).

Don't ever do that.  A given class must appear in only *one* place in any
particular branch of the classloader tree.  A picture of the tree is here:
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

Until you correct that duplication, nothing you try will be reliable.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

AfriGIS e-mail facility may not be used for the distribution of chain
letters or offensive email. AfriGIS hereby distances itself from and accepts
no liability for the unauthorized use of its e-mail facility or the sending
of e-mail communications for other than strictly business purposes. AfriGIS
furthermore disclaims liability for any unauthorized instruction for which
permission was not granted. Required as per Sec 50 Companies Act 61 of 1973
Afrigis Pty LTD Reg No 1997/0067/1607.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Schalk
Hi there Michael,

Ok, I removed the mysql jar from my app and left it in tomcat/lib

I also undeployed and then redeployed the war file via the manager app but
the problem persists.

--
Kind Regards
Schalk Neethling


-Original Message-
From: Michael Ludwig [mailto:mil...@gmx.de] 
Sent: 31 August 2009 11:28 PM
To: users@tomcat.apache.org
Subject: Re: Strange problem with data source Tomcat 6.0.18

sch...@afrigis.co.za schrieb am 31.08.2009 um 23:16:48 (+0200):

 I have set-up a data source using the context.xml file located inside
 my META-INF and added the relevant entry in the web apps web.xml. I
 also have the MySQL connector/j driver inside my own apps lib as well
 as inside the server's lib(same version).

That's wrong. The driver must not be in both locations. It must be made
available to the common classloader, which provides classes to both the
server and the applications.

Discard the driver from your application.

 Now when I deploy the .war to the server in which the db is running,
 the archive is deployed but when I now try to get a connection to the
 same db and same server as from my local machine I get:
 
 Cannot create JDBC driver of class '' for connect URL 'null'

Are you doing a proper deploy using the manager application? Or removing
the WAR and properly waiting for Tomcat to discover this?

Or are you improperly clobbering the WAR? That would leave a stale
context.xml for your application in place.

-- 
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

AfriGIS e-mail facility may not be used for the distribution of chain
letters or offensive email. AfriGIS hereby distances itself from and accepts
no liability for the unauthorized use of its e-mail facility or the sending
of e-mail communications for other than strictly business purposes. AfriGIS
furthermore disclaims liability for any unauthorized instruction for which
permission was not granted. Required as per Sec 50 Companies Act 61 of 1973
Afrigis Pty LTD Reg No 1997/0067/1607.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Michael Ludwig
sch...@afrigis.co.za schrieb am 31.08.2009 um 23:57:07 (+0200):
 Hi there Michael,
 
 Ok, I removed the mysql jar from my app and left it in tomcat/lib
 
 I also undeployed and then redeployed the war file via the manager app
 but the problem persists.

Then I suspect a typo in your resource definition. I once had
Resource/@url instead of Resource/@uri with the MySQL driver.
The error was just:

  Cannot create JDBC driver of class 'com.mysql.jdbc.Driver'
  for connect URL 'null'

Double-check your resource definition.

-- 
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Schalk
Hi there Michael,

I am starting to think it might very well have to do with my context.xml
file. I just saw in the logs that Tomcat was actually giving error saying
that it could not deploy myapp.xml. After reading some on the web I
discovered that this is actually my context.xml that Tomcat is picking up
and then renames to my app's name but then something goes wrong Here is
my context.xml file, I have changed it slightly since I saw the error
removing path and docbase and adding factory, going to try this one out now
and see whether that resolves the problem but just in case, here it is,
maybe you spot something I am missing btw. Might there be an ever so
slightly different way that this is handled with Tomcat on Linux as opposed
to Windows?

context debug=5 reloadable=true crossContext=true
Resource name=jdbc/wuMaps auth=Container
type=javax.sql.DataSource
factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory maxActive=100
maxIdle=30 maxWait=1 removeAbandoned=true
removeAbandonedTimeout=100 logAbandoned=true username=root
password=password driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://196.0.0.23:3306/wuadmin_development /
/context

--
Kind Regards
Schalk Neethling

-Original Message-
From: Michael Ludwig [mailto:mil...@gmx.de] 
Sent: 01 September 2009 12:13 AM
To: Tomcat Users List
Subject: Re: Strange problem with data source Tomcat 6.0.18

sch...@afrigis.co.za schrieb am 31.08.2009 um 23:57:07 (+0200):
 Hi there Michael,
 
 Ok, I removed the mysql jar from my app and left it in tomcat/lib
 
 I also undeployed and then redeployed the war file via the manager app
 but the problem persists.

Then I suspect a typo in your resource definition. I once had
Resource/@url instead of Resource/@uri with the MySQL driver.
The error was just:

  Cannot create JDBC driver of class 'com.mysql.jdbc.Driver'
  for connect URL 'null'

Double-check your resource definition.

-- 
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

AfriGIS e-mail facility may not be used for the distribution of chain
letters or offensive email. AfriGIS hereby distances itself from and accepts
no liability for the unauthorized use of its e-mail facility or the sending
of e-mail communications for other than strictly business purposes. AfriGIS
furthermore disclaims liability for any unauthorized instruction for which
permission was not granted. Required as per Sec 50 Companies Act 61 of 1973
Afrigis Pty LTD Reg No 1997/0067/1607.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Michael Ludwig
sch...@afrigis.co.za schrieb am 01.09.2009 um 00:29:34 (+0200):

 I am starting to think it might very well have to do with my
 context.xml file. I just saw in the logs that Tomcat was actually
 giving error saying that it could not deploy myapp.xml. After reading
 some on the web I discovered that this is actually my context.xml that
 Tomcat is picking up and then renames to my app's name but then
 something goes wrong Here is my context.xml file, I have changed
 it slightly since I saw the error removing path

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

  The value of this field must not be set except when statically
  defining a Context in server.xml, as it will be inferred from the
  filenames used for either the .xml context file or the docBase.

 and docbase

  The value of this field must not be set when the Context is configured
  using a META-INF/context.xml file as it will be inferred by the
  automatic deployment process.

 and adding factory

Probably not necessary.

 Might there be an ever so slightly different way that this is handled
 with Tomcat on Linux as opposed to Windows?

There are some slight differences pertaining to case-insensitive
filesystems, but that's probably not relevant here.

 context debug=5 reloadable=true crossContext=true

Try capitalizing context to Context.

-- 
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Schalk
Hi there Michael,

Thanks so much for all of your assistance. I am going to try all of these
suggestions and let you know what the results are. One thing though, with
what you just mentioned I technically do not have to include the Context
definition bit at all in the context.xml and can basically just use the
Resource definitions on its own and Tomcat will figure out all of the rest.

--
Kind Regards
Schalk Neethling
Developer - AfriGIS - Mobile
Skype: volume4
www.afrigis.co.za


-Original Message-
From: Michael Ludwig [mailto:mil...@gmx.de] 
Sent: 01 September 2009 12:56 AM
To: Tomcat Users List
Subject: Re: Strange problem with data source Tomcat 6.0.18

sch...@afrigis.co.za schrieb am 01.09.2009 um 00:29:34 (+0200):

 I am starting to think it might very well have to do with my
 context.xml file. I just saw in the logs that Tomcat was actually
 giving error saying that it could not deploy myapp.xml. After reading
 some on the web I discovered that this is actually my context.xml that
 Tomcat is picking up and then renames to my app's name but then
 something goes wrong Here is my context.xml file, I have changed
 it slightly since I saw the error removing path

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

  The value of this field must not be set except when statically
  defining a Context in server.xml, as it will be inferred from the
  filenames used for either the .xml context file or the docBase.

 and docbase

  The value of this field must not be set when the Context is configured
  using a META-INF/context.xml file as it will be inferred by the
  automatic deployment process.

 and adding factory

Probably not necessary.

 Might there be an ever so slightly different way that this is handled
 with Tomcat on Linux as opposed to Windows?

There are some slight differences pertaining to case-insensitive
filesystems, but that's probably not relevant here.

 context debug=5 reloadable=true crossContext=true

Try capitalizing context to Context.

-- 
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

AfriGIS e-mail facility may not be used for the distribution of chain
letters or offensive email. AfriGIS hereby distances itself from and accepts
no liability for the unauthorized use of its e-mail facility or the sending
of e-mail communications for other than strictly business purposes. AfriGIS
furthermore disclaims liability for any unauthorized instruction for which
permission was not granted. Required as per Sec 50 Companies Act 61 of 1973
Afrigis Pty LTD Reg No 1997/0067/1607.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Schalk
Hi Michael,

A combination of factors did it and this is definitely one of those moments
where you want to kick your own *ss ;)Basically what I did was make all
references everywhere, and I mean everywhere, to wuMaps to wumaps. So this
is in the resource reference in the web.xml in the Java class, the path as
well as docbase and walla! Thanks again!

--
Kind Regards
Schalk Neethling


-Original Message-
From: Michael Ludwig [mailto:mil...@gmx.de] 
Sent: 01 September 2009 12:56 AM
To: Tomcat Users List
Subject: Re: Strange problem with data source Tomcat 6.0.18

sch...@afrigis.co.za schrieb am 01.09.2009 um 00:29:34 (+0200):

 I am starting to think it might very well have to do with my
 context.xml file. I just saw in the logs that Tomcat was actually
 giving error saying that it could not deploy myapp.xml. After reading
 some on the web I discovered that this is actually my context.xml that
 Tomcat is picking up and then renames to my app's name but then
 something goes wrong Here is my context.xml file, I have changed
 it slightly since I saw the error removing path

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

  The value of this field must not be set except when statically
  defining a Context in server.xml, as it will be inferred from the
  filenames used for either the .xml context file or the docBase.

 and docbase

  The value of this field must not be set when the Context is configured
  using a META-INF/context.xml file as it will be inferred by the
  automatic deployment process.

 and adding factory

Probably not necessary.

 Might there be an ever so slightly different way that this is handled
 with Tomcat on Linux as opposed to Windows?

There are some slight differences pertaining to case-insensitive
filesystems, but that's probably not relevant here.

 context debug=5 reloadable=true crossContext=true

Try capitalizing context to Context.

-- 
Michael Ludwig

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

AfriGIS e-mail facility may not be used for the distribution of chain
letters or offensive email. AfriGIS hereby distances itself from and accepts
no liability for the unauthorized use of its e-mail facility or the sending
of e-mail communications for other than strictly business purposes. AfriGIS
furthermore disclaims liability for any unauthorized instruction for which
permission was not granted. Required as per Sec 50 Companies Act 61 of 1973
Afrigis Pty LTD Reg No 1997/0067/1607.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Caldarale, Charles R
 From: Michael Ludwig [mailto:mil...@gmx.de]
 Subject: Re: Strange problem with data source Tomcat 6.0.18
 
 Try capitalizing context to Context.

Also make sure there is no conf/Catalina/[host]/myapp.xml file lying around; if 
so, it will override your META-INF/context.xml file.  The copy in 
conf/Catalina/[host] is created during deployment, and removed when the webapp 
is undeployed.  However, if you're simply replacing the webapp, the old 
myapp.xml file may hang around.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Strange problem with data source Tomcat 6.0.18

2009-08-31 Thread Caldarale, Charles R
 From: sch...@afrigis.co.za [mailto:sch...@afrigis.co.za]
 Subject: RE: Strange problem with data source Tomcat 6.0.18
 
 I technically do not have to include the Context definition bit
 at all in the context.xml and can basically just use the Resource
 definitions on its own and Tomcat will figure out all of the rest.

Depends on how wide a scope you want for the Resource.  If it's intended to 
be for just one webapp, the Resource element must be nested inside the 
Context element for that webapp.  If you want the Resource to be available 
to all webapps, you can place it inside a GlobalNamingResources element which 
itself must be inside the Server element; in this case, you will need a 
ResourceLink element inside the Context of each webapp that you want to 
give access to said Resource.  Regardless, you do need the Context element.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org