tomcat-5 jndi

2005-04-13 Thread Licinio Gomez Delgado
Hi,

I´ve been reading examples and the mailing list, but I can´t configure
correctly Tomcat 5.0.28 with Oracle 9, I´m a bit desperate. I think I´ve
tried everything.

this is what I got:


in my Tomcat 5.0\common\lib folder I´ve got ojdbc14.jar


---
Tomcat 5.0\conf\server.xml:
---

?xml version='1.0' encoding='utf-8'?
Server
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/
  Listener
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/
  GlobalNamingResources
Environment name=simpleValue type=java.lang.Integer value=30/
Resource auth=Container description=User database that can be
updated and saved name=UserDatabase
type=org.apache.catalina.UserDatabase/
ResourceParams name=UserDatabase
  parameter
namefactory/name
valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
  /parameter
  parameter
namepathname/name
valueconf/tomcat-users.xml/value
  /parameter
/ResourceParams
  /GlobalNamingResources
  Service name=Catalina
Connector acceptCount=100 connectionTimeout=2
disableUploadTimeout=true port=8080 redirectPort=8443
maxSpareThreads=75 maxThreads=150 minSpareThreads=25
/Connector
Connector port=8009 protocol=AJP/1.3
protocolHandlerClassName=org.apache.jk.server.JkCoyoteHandler
redirectPort=8443
/Connector
Engine defaultHost=localhost name=Catalina
  Host appBase=webapps name=localhost
Logger className=org.apache.catalina.logger.FileLogger
prefix=localhost_log. suffix=.txt timestamp=true/


Resource name=jdbc/bddesa auth=Container
  type=javax.sql.DataSource/

ResourceParams name=jdbc/bddesa
  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:@10.0.100.6:1521:bddesa/value
  /parameter
  parameter
nameusername/name
value*/value
  /parameter
  parameter
namepassword/name
value*/value
  /parameter
  parameter
namemaxActive/name
value20/value
  /parameter
  parameter
namemaxIdle/name
value10/value
  /parameter
  parameter
namemaxWait/name
value-1/value
  /parameter
/ResourceParams



  /Host
  Logger className=org.apache.catalina.logger.FileLogger
prefix=catalina_log. suffix=.txt timestamp=true/
  Realm className=org.apache.catalina.realm.UserDatabaseRealm/
/Engine
  /Service
/Server









---
Tomcat 5.0\webapps\ROOT\WEB-INF\web.xml
---

?xml version=1.0 encoding=ISO-8859-1?
!--
  Copyright 2004 The Apache Software Foundation

  Licensed under the Apache License, Version 2.0 (the License);
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an AS IS BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--

web-app xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
version=2.4

  display-nameWelcome to Tomcat/display-name
  description
 Welcome to Tomcat
  /description



Tomcat 5/JNDI Realm Port 989

2004-07-30 Thread John Clisham
Hello All,

I'm a total newbie to this stuff, but I think I have an easy question
for everyone...

I'm trying to get Tomcat 5 to use Basic Authentication using a JNDI
Realm to our corporate LDAP server.  Our server allows read access on
port 389 and bind access on port 989.  

Here's the issue.  If I set the port to 389 and restart Tomcat, the logs
appear to connect ok, and my web.xml configuration must be right because
I get prompted for a login/password by the browser. But, it fails
because I'm on port 989.  Naturally, I change the port to 989, but I can
no longer anonymously bind so the context never gets loaded.  Here's my
realm config:

Realm className=org.apache.catalina.realm.JNDIRealm debug=99
connectionURL=ldap://my.ldap.server:389;
userBase=ou=people,ou=mycompany,o=world
userSearch=(ExtShortName=({0})
userRoleName=cn
roleSearch=(uniqueMember={0})
/

Net, is there anyway to specify a connection port and a bind port?  I
can't find it anywhere.  I know it's not a password/digest/ldap server
issue because a wrote a test class with my ID  Password set and was
able to authenticate without an issue to port 989...

Any help would be greatly appreciated!
Thanks
John


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



Tomcat 4: JNDI LDAP - Can't get single role name

2004-05-13 Thread Goerlich, Michael
Hello Tomcat-Users,

I've got a problem and I don't know if it's my lack (...but I've already
scanned this list).

In my environment I want to authenticate the users against MS AD by JNDI
LDAP. The user authentication is ok and also the roles found by
getRoles() are the right ones. But the returned roles are given in the
complete distinguished name (DN) of the role (i.e.
CN=ERKUSAAdmin,CN=Users,DC=local,DC=bremereb,DC=de) instead of the
single role name (attribute cn) (i.e. ERKUSAAdmin) so I have to
configure the fully DN in web.xml for a security-constraint what is very
undesireable:

Log in catalina.out (tomcat 4.1.7):

2004-05-13 11:33:44 JNDIRealm[Standalone]:   Searching for goerlich
2004-05-13 11:33:44 JNDIRealm[Standalone]:   base:
CN=Users,dc=local,dc=bremereb,dc=de  filter: (sAMAccountName=goerlich)
2004-05-13 11:33:44 JNDIRealm[Standalone]:   entry found for goerlich
with dn CN=Goerlich\, Michael,CN=Users,dc=local,dc=bremereb,dc=de
2004-05-13 11:33:44 JNDIRealm[Standalone]:   retrieving values for
attribute memberOf
2004-05-13 11:33:44 JNDIRealm[Standalone]:   validating credentials by
binding as the user
2004-05-13 11:33:44 JNDIRealm[Standalone]:   binding as CN=Goerlich\,
Michael,CN=Users,dc=local,dc=bremereb,dc=de
2004-05-13 11:33:44 JNDIRealm[Standalone]: Username goerlich
successfully authenticated
2004-05-13 11:33:44 JNDIRealm[Standalone]:   getRoles(CN=Goerlich\,
Michael,CN=Users,dc=local,dc=bremereb,dc=de)
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Searching role base
'CN=Users,dc=local,dc=bremereb,dc=de' for attribute 'cn'
2004-05-13 11:33:44 JNDIRealm[Standalone]:   With filter expression
'member=CN=Goerlich\, Michael,CN=Users,dc=local,dc=bremereb,dc=de'
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Returning 7 roles
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Found role
CN=erkusaverwalter,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Found role
CN=tomcat,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Found role
CN=manager,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Found role
CN=ERKUSAAdmin,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Found role
CN=_Gewerbekunden,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Found role
CN=_Dokumentation,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:44 JNDIRealm[Standalone]:   Found role
CN=_Team_SAP,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:44 JNDIRealm[Standalone]: Username goerlich has role
CN=ERKUSAAdmin,CN=Users,DC=local,DC=bremereb,DC=de
2004-05-13 11:33:57 JNDIRealm[Standalone]: Username goerlich does NOT
have role ERKUSAAdmin
2004-05-13 11:33:57 JNDIRealm[Standalone]: Username goerlich does NOT
have role ERKUSAVerwalter
2004-05-13 11:33:57 JNDIRealm[Standalone]: Username goerlich does NOT
have role ERKUSAAdmin

My configured JNDI-realm in server.xml:

Realm className=org.apache.catalina.realm.JNDIRealm debug=99
connectionURL=... (substituted)
userBase=CN=Users,dc=local,dc=bremereb,dc=de
userSearch=(sAMAccountName={0})
userRoleName=memberOf
roleBase=CN=Users,dc=local,dc=bremereb,dc=de
roleName=cn
roleSearch=member={0}
connectionName=[EMAIL PROTECTED]
connectionPassword=secret
roleSubtree=true
userSubtree=true /

I run this on tomcat 4.1.27.

The funny thing is that the same configuration on tomcat 5 return 14
roles (for the given example) what work for me, but I need that
functionality in tomcat 4:

Log in catalina.out (tomcat 5.0.24)

2004-05-13 11:59:31 JNDIRealm[Catalina]:   Searching for goerlich
2004-05-13 11:59:31 JNDIRealm[Catalina]:   base:
CN=Users,dc=local,dc=bremereb,dc=de  filter: (sAMAccountName=goerlich)
2004-05-13 11:59:31 JNDIRealm[Catalina]:   entry found for goerlich with
dn CN=Goerlich\, Michael,CN=Users,dc=local,dc=bremereb,dc=de
2004-05-13 11:59:31 JNDIRealm[Catalina]:   retrieving values for
attribute memberOf
2004-05-13 11:59:31 JNDIRealm[Catalina]:   validating credentials by
binding as the user
2004-05-13 11:59:31 JNDIRealm[Catalina]:   binding as CN=Goerlich\,
Michael,CN=Users,dc=local,dc=bremereb,dc=de
2004-05-13 11:59:31 JNDIRealm[Catalina]: Username goerlich successfully
authenticated
2004-05-13 11:59:31 JNDIRealm[Catalina]:   getRoles(CN=Goerlich\,
Michael,CN=Users,dc=local,dc=bremereb,dc=de)
2004-05-13 11:59:31 JNDIRealm[Catalina]:   Searching role base
'CN=Users,DC=local,DC=bremereb,DC=de' for attribute 'cn'
2004-05-13 11:59:31 JNDIRealm[Catalina]:   With filter expression
'member=CN=Goerlich\5c, Michael,CN=Users,dc=local,dc=bremereb,dc=de'
2004-05-13 11:59:31 JNDIRealm[Catalina]:   retrieving values for
attribute cn
2004-05-13 11:59:31 JNDIRealm[Catalina]:   retrieving values for
attribute cn
2004-05-13 11:59:31 JNDIRealm[Catalina]:   retrieving values for
attribute cn
2004-05-13 11:59:31 JNDIRealm[Catalina]:   retrieving values for
attribute cn
2004-05-13 11:59:31 JNDIRealm[Catalina]:   retrieving values for
attribute 

RE: Bug in jndi implementation : Tomcat 5 - jndi problem

2003-12-11 Thread Shapira, Yoav

Howdy,
It's not a bug in the tomcat implementation -- tomcat does not have an
external JNDI provider, while most full J2EE servers like the ones you
mention do.  So you can't connect to tomcat's JNDI contexts from outside
the tomcat JVM.

Please don't jump to conclusions without asking ;)

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Frank Renaers [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 11, 2003 3:04 AM
To: [EMAIL PROTECTED]
Subject: Bug in jndi implementation : Tomcat 5 - jndi problem

Hi,

I assume it's a bug in the Tomcat jndi implementation, because my test
is successfull when I use another jndi - implementation (Weblogic,
Websphere, ...)

Greetings,

Frank

  -Original Message-
 From:Frank Renaers
 Sent:woensdag 10 december 2003 11:58
 To:  [EMAIL PROTECTED]
 Subject: Tomcat 5 - jndi problem

 Hi,

 Is it possible to browse the Tomcat jndi context from within another
vm.
 I wrote a small junit test to test this, but it always fails !!
 It always throws a javax.naming.NameNotFoundException: Name java:comp
is
not bound in this Context

 My jndi.properties contains the following settings :

java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
 java.naming.provider.url=http://localhost:8080

 My conf.xml :
 !-- Global JNDI resources --
 GlobalNamingResources

   !-- Test entry for demonstration purposes --
   Environment name=simpleValue type=java.lang.Integer
value=30/
 /GlobalNamingResources

 My test :

 public void testDataSource() throws Exception {

 // Obtain our environment naming context
 javax.naming.Context initCtx = new
javax.naming.InitialContext();
 javax.naming.Context envCtx = (javax.naming.Context)
initCtx.lookup(java:comp/env/simpleValue);

 }
 }

 Thanks,

 Frank Renaers





This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Tomcat 5 - jndi problem

2003-12-10 Thread Frank Renaers
Hi,

Is it possible to browse the Tomcat jndi context from within another vm.
I wrote a small junit test to test this, but it always fails !!
It always throws a javax.naming.NameNotFoundException: Name java:comp is not bound in 
this Context 

My jndi.properties contains the following settings : 
java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
java.naming.provider.url=http://localhost:8080

My conf.xml :
!-- Global JNDI resources --
GlobalNamingResources

  !-- Test entry for demonstration purposes --
  Environment name=simpleValue type=java.lang.Integer value=30/
/GlobalNamingResources

My test :

public void testDataSource() throws Exception {

// Obtain our environment naming context
javax.naming.Context initCtx = new javax.naming.InitialContext();
javax.naming.Context envCtx = (javax.naming.Context) 
initCtx.lookup(java:comp/env/simpleValue);
   
}
}

Thanks,

Frank Renaers




RE: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-19 Thread Euan Guttridge
Still waiting for some confirmation from Remy Maucherat. He was 
 talking about the client deployer package, however I cannot find 
it...

Neither can I..

Thanks

-Original Message-
From: Ilja Hehenkamp [mailto:[EMAIL PROTECTED] 
Sent: 15 September 2003 16:07
To: [EMAIL PROTECTED]
Subject: Re: Tomcat, MySQL  JNDI: java.sql.SQLException: Cannot load JDBC
driver class 'null'


It could be related, but I'm not sure.

I think the problem lies in the way the application gets deployed with this 
ant build file. Probably the docbase doesn't match (however that's just a 
wild guess)

Still waiting for some confirmation from Remy Maucherat. He was talking 
about the client deployer package, however I cannot find it...

Ilja

_
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl


-
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, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-19 Thread Ilja Hehenkamp
Remy Maucherat, can you elobarate on this deployer client? You talked about 
it, but it can nowhere be found. I'm still very stuck on this matter and 
don't have a way of fixing it... Deploying is a pain in the ass now compared 
to the convenient way of building with ant...

From: Ilja Hehenkamp [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Tomcat, MySQL  JNDI: java.sql.SQLException: Cannot load JDBC 
driver class 'null'
Date: Fri, 19 Sep 2003 19:37:46 +0200


Sorry, I don't really understand what you mean?

Do you mean I shouldn't use the build file anymore? If so: that's too  
bad,
since I like the way of automated updating the tomcat manager...

I'm sure you do. You seem to be stuck on that particular page of the
docs, however, which happens to be out of date, and doesn't actually
mention what is important.
Read the deployer page instead
(http://jakarta.apache.org/tomcat/tomcat-5.0-doc/deployer-howto.html ).
But still: I don't know how to fix the problem: why doesn't the jndi
datasource work with the through ant deployed application?
Because I don't think your stuff in server.xml is used at all.

That's much better.

I recommend you use the deployer package instead. The instructions  from
appdev are going to be updated or removed.

I think I know where lies the problem, however I still don't know  how 
to fix
it...

I use the sample build.xml file from Tomcat:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/ build.xml.txt 
to
install, reload and distribute my sample application.

When I do an ant -install it apparantly installs the application in  
the
Tomcat manager, however the application doesn't show up in the  webapps
directory. That's 1.

So maybe there's a conflict with either the context path, which I  
don't
think so, since my build file has explicitly set the context path to
/DBTest:

  property name=app.name  value=DBTest/
  property name=app.path  value=/${app.name}/
  property name=app.version   value=/
  property name=build.homevalue=${basedir}/build/
  property name=catalina.home value=/Library/Tomcat/ !--  UPDATE 
THIS!
--
  property name=dist.home value=${basedir}/dist/
  property name=docs.home value=${basedir}/docs/
  property name=manager.url   value=  http://localhost:8080/manager 
/
  property name=src.home  value=${basedir}/src/
  property name=web.home  value=${basedir}/web/

Or there's a conflict with the docbase, which I suspect... However  I'm 
not
sure why and how to fix it

Because when I put the generated war file (when doing an ant -dist)  in 
the
webapps directory the connection works! Although this works, it's  not 
very
convenient, since it defeats the purpose of the automated  installing 
through
ant...

Hope I made myself clear?


Ok, first some configuration information:

Tomcat 5.09
MySQL Driver 3.08 stable
OS: Mac OSX 10.2.6
J2SE 1.4.2
all commons libraries reside in $CATALINA_HOME/common/lib
MySQL Driver resides in $CATALINA_HOME/common/lib as well
I tried setting up a simple JNDI datasource connection but get  the  
following error message:
java.sql.SQLException: Cannot load JDBC driver class 'null'
at  
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataS 
ource
.java:529)
at  
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSour 
ce.ja
va:312)
at foo.DBTest.init(DBTest.java:24)
at foo.TestServlet.doGet(TestServlet.java:34)
at  
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at  
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  
  

The code and examples are taken from  
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-
examples-howto.html
I have searched through tons of archives and websites and mostly  
this  
error could be resolved by placing the driver and commons in the  
common/lib directory. However in my case they are there, so I  
cannot  
figure out what's the problem...

server.xml:

Context path=/DBTest docBase=DBTest debug=5
  reloadable=true crossContext=true
Logger className=org.apache.catalina.logger.FileLogger
  directory=logs  prefix=localhost_DBTest_log.   
suffix=.txt
 timestamp=true/
  Resource name=jdbc/TestDB
auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/TestDB
   parameter
namedriverClassName/name
valueorg.gjt.mm.mysql.Driver/value
   /parameter
   parameter
nameusername/name
valuexxx/value
   /parameter
   parameter
namepassword/name
valuexxx/value
   /parameter
   parameter
nameurl/name
valuejdbc:mysql://localhost/javatest?autoReconnect=true/ value
   /parameter
  /ResourceParams
/Context
web.xml

?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app PUBLIC
 -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
  http://java.sun.com/dtd/web-app_2_3.dtd 
web-app
   descriptionMySQL Test App/description

Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Ilja
Ok, first some configuration information:

Tomcat 5.09
MySQL Driver 3.08 stable
OS: Mac OSX 10.2.6
J2SE 1.4.2
all commons libraries reside in $CATALINA_HOME/common/lib
MySQL Driver resides in $CATALINA_HOME/common/lib as well
I tried setting up a simple JNDI datasource connection but get the  
following error message:

java.sql.SQLException: Cannot load JDBC driver class 'null'
	at  
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource 
.java:529)
	at  
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja 
va:312)
	at foo.DBTest.init(DBTest.java:24)
	at foo.TestServlet.doGet(TestServlet.java:34)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 
 

The code and examples are taken from  
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource- 
examples-howto.html

I have searched through tons of archives and websites and mostly this  
error could be resolved by placing the driver and commons in the  
common/lib directory. However in my case they are there, so I cannot  
figure out what's the problem...

server.xml:

Context path=/DBTest docBase=DBTest debug=5
 reloadable=true crossContext=true
Logger className=org.apache.catalina.logger.FileLogger
 directory=logs  prefix=localhost_DBTest_log.  
suffix=.txt
timestamp=true/

 Resource name=jdbc/TestDB
   auth=Container
   type=javax.sql.DataSource/
 ResourceParams name=jdbc/TestDB
  parameter
   namedriverClassName/name
   valueorg.gjt.mm.mysql.Driver/value
  /parameter
  parameter
   nameusername/name
   valuexxx/value
  /parameter
  parameter
   namepassword/name
   valuexxx/value
  /parameter
  parameter
   nameurl/name
   valuejdbc:mysql://localhost/javatest?autoReconnect=true/value
  /parameter
 /ResourceParams
/Context
web.xml

?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app PUBLIC
-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
  descriptionMySQL Test App/description
  resource-ref
  descriptionDB Connection/description
  res-ref-namejdbc/TestDB/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  /resource-ref
  servlet
  servlet-nameDBTestServlet/servlet-name
  description
Bla...
  /description
  servlet-classfoo.TestServlet/servlet-class
  /servlet
  servlet-mapping
  servlet-nameDBTestServlet/servlet-name
  url-pattern/DBTestServlet/url-pattern
  /servlet-mapping
/web-app
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Martin Jacobson
Ilja wrote:
Ok, first some configuration information:

Tomcat 5.09
MySQL Driver 3.08 stable
OS: Mac OSX 10.2.6
J2SE 1.4.2
My config is not the same (TC 4.1.24, OSX 10.2.6, MySQL 3.07), and my 
parameters are different:
	ResourceParams name=jdbc/EuratomDB
		parameter
			namefactory/name
			valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
		/parameter
		parameter
			namemaxActive/name
			value100/value
		/parameter
		parameter
			namemaxIdle/name
			value3/value
		/parameter
		parameter
			namemaxWait/name
			value100/value
		/parameter
		parameter
			nameusername/name
			valuexxx/value
		/parameter
		parameter
			namepassword/name
			valuexxx/value
		/parameter
		parameter
			namedriverClassName/name
			valuecom.mysql.jdbc.Driver/value
		/parameter
		parameter
			nameurl/name
			valuejdbc:mysql://localhost/euratom?autoReconnect=true/value
		/parameter
	/ResourceParams

This works for me! The main diffs are (i) I specify the factory, and 
(ii), the driverClassName is com.mysql.jdbc.Driver

However, the exception seems to suggest that the correct factory is 
being used by default. Your driverClassName is the old name, and might 
not be in the jar file any more.

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


Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Ilja Hehenkamp
I think I know where lies the problem, however I still don't know how to fix 
it...

I use the sample build.xml file from Tomcat: 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/build.xml.txt to 
install, reload and distribute my sample application.

When I do an ant -install it apparantly installs the application in the 
Tomcat manager, however the application doesn't show up in the webapps 
directory. That's 1.

So maybe there's a conflict with either the context path, which I don't 
think so, since my build file has explicitly set the context path to 
/DBTest:

 property name=app.name  value=DBTest/
 property name=app.path  value=/${app.name}/
 property name=app.version   value=/
 property name=build.homevalue=${basedir}/build/
 property name=catalina.home value=/Library/Tomcat/ !-- UPDATE THIS! 
--
 property name=dist.home value=${basedir}/dist/
 property name=docs.home value=${basedir}/docs/
 property name=manager.url   value=http://localhost:8080/manager/
 property name=src.home  value=${basedir}/src/
 property name=web.home  value=${basedir}/web/

Or there's a conflict with the docbase, which I suspect... However I'm not 
sure why and how to fix it

Because when I put the generated war file (when doing an ant -dist) in the 
webapps directory the connection works! Although this works, it's not very 
convenient, since it defeats the purpose of the automated installing through 
ant...

Hope I made myself clear?

From: Martin Jacobson [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomcat, MySQL  JNDI: java.sql.SQLException: Cannot load JDBC 
driver class 'null'
Date: Mon, 15 Sep 2003 14:00:52 +0200

Ilja wrote:
Ok, first some configuration information:

Tomcat 5.09
MySQL Driver 3.08 stable
OS: Mac OSX 10.2.6
J2SE 1.4.2
My config is not the same (TC 4.1.24, OSX 10.2.6, MySQL 3.07), and my 
parameters are different:
	ResourceParams name=jdbc/EuratomDB
		parameter
			namefactory/name
			valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
		/parameter
		parameter
			namemaxActive/name
			value100/value
		/parameter
		parameter
			namemaxIdle/name
			value3/value
		/parameter
		parameter
			namemaxWait/name
			value100/value
		/parameter
		parameter
			nameusername/name
			valuexxx/value
		/parameter
		parameter
			namepassword/name
			valuexxx/value
		/parameter
		parameter
			namedriverClassName/name
			valuecom.mysql.jdbc.Driver/value
		/parameter
		parameter
			nameurl/name
			valuejdbc:mysql://localhost/euratom?autoReconnect=true/value
		/parameter
	/ResourceParams

This works for me! The main diffs are (i) I specify the factory, and 
(ii), the driverClassName is com.mysql.jdbc.Driver

However, the exception seems to suggest that the correct factory is being 
used by default. Your driverClassName is the old name, and might not be in 
the jar file any more.

HTH
Martin
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Remy Maucherat
Ilja Hehenkamp wrote:

I think I know where lies the problem, however I still don't know how to 
fix it...

I use the sample build.xml file from Tomcat: 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/build.xml.txt to 
install, reload and distribute my sample application.

When I do an ant -install it apparantly installs the application in the 
Tomcat manager, however the application doesn't show up in the webapps 
directory. That's 1.

So maybe there's a conflict with either the context path, which I don't 
think so, since my build file has explicitly set the context path to 
/DBTest:

 property name=app.name  value=DBTest/
 property name=app.path  value=/${app.name}/
 property name=app.version   value=/
 property name=build.homevalue=${basedir}/build/
 property name=catalina.home value=/Library/Tomcat/ !-- UPDATE 
THIS! --
 property name=dist.home value=${basedir}/dist/
 property name=docs.home value=${basedir}/docs/
 property name=manager.url   value=http://localhost:8080/manager/
 property name=src.home  value=${basedir}/src/
 property name=web.home  value=${basedir}/web/

Or there's a conflict with the docbase, which I suspect... However I'm 
not sure why and how to fix it

Because when I put the generated war file (when doing an ant -dist) in 
the webapps directory the connection works! Although this works, it's 
not very convenient, since it defeats the purpose of the automated 
installing through ant...

Hope I made myself clear?
That's much better.

I recommend you use the deployer package instead. The instructions from 
appdev are going to be updated or removed.

--
x
Rémy Maucherat
Senior Developer  Consultant
JBoss Group (Europe) SàRL
x
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Ilja Hehenkamp
Sorry, I don't really understand what you mean?

Do you mean I shouldn't use the build file anymore? If so: that's too bad, 
since I like the way of automated updating the tomcat manager...

But still: I don't know how to fix the problem: why doesn't the jndi 
datasource work with the through ant deployed application?


From: Remy Maucherat [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomcat, MySQL  JNDI: java.sql.SQLException: Cannot load JDBC 
driver class 'null'
Date: Mon, 15 Sep 2003 15:17:53 +0200

Ilja Hehenkamp wrote:

I think I know where lies the problem, however I still don't know how to 
fix it...

I use the sample build.xml file from Tomcat: 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/build.xml.txt to 
install, reload and distribute my sample application.

When I do an ant -install it apparantly installs the application in the 
Tomcat manager, however the application doesn't show up in the webapps 
directory. That's 1.

So maybe there's a conflict with either the context path, which I don't 
think so, since my build file has explicitly set the context path to 
/DBTest:

 property name=app.name  value=DBTest/
 property name=app.path  value=/${app.name}/
 property name=app.version   value=/
 property name=build.homevalue=${basedir}/build/
 property name=catalina.home value=/Library/Tomcat/ !-- UPDATE 
THIS! --
 property name=dist.home value=${basedir}/dist/
 property name=docs.home value=${basedir}/docs/
 property name=manager.url   value=http://localhost:8080/manager/
 property name=src.home  value=${basedir}/src/
 property name=web.home  value=${basedir}/web/

Or there's a conflict with the docbase, which I suspect... However I'm not 
sure why and how to fix it

Because when I put the generated war file (when doing an ant -dist) in the 
webapps directory the connection works! Although this works, it's not very 
convenient, since it defeats the purpose of the automated installing 
through ant...

Hope I made myself clear?
That's much better.

I recommend you use the deployer package instead. The instructions from 
appdev are going to be updated or removed.

--
x
Rémy Maucherat
Senior Developer  Consultant
JBoss Group (Europe) SàRL
x
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Remy Maucherat
Ilja Hehenkamp wrote:

Sorry, I don't really understand what you mean?

Do you mean I shouldn't use the build file anymore? If so: that's too 
bad, since I like the way of automated updating the tomcat manager...
I'm sure you do. You seem to be stuck on that particular page of the 
docs, however, which happens to be out of date, and doesn't actually 
mention what is important.
Read the deployer page instead 
(http://jakarta.apache.org/tomcat/tomcat-5.0-doc/deployer-howto.html).

But still: I don't know how to fix the problem: why doesn't the jndi 
datasource work with the through ant deployed application?
Because I don't think your stuff in server.xml is used at all.

--
x
Rémy Maucherat
Senior Developer  Consultant
JBoss Group (Europe) SàRL
x
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Ilja Hehenkamp
Sorry for being such a pain in the ass, but It's still not really clear to 
me:

What do you actually suggest? Are you talking about this client deployer 
that's listed on that page? Where can I find it? (I cannot find it, neither 
the build file that's mentioned there)

Will this fix my problem?

So for confirmation: I shouldn't use the old ant buildfile anymore?

Ilja


From: Remy Maucherat [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Subject: Re: Tomcat, MySQL  JNDI: java.sql.SQLException: Cannot load JDBC 
driver class 'null'
Date: Mon, 15 Sep 2003 15:33:13 +0200

Ilja Hehenkamp wrote:

Sorry, I don't really understand what you mean?

Do you mean I shouldn't use the build file anymore? If so: that's too bad, 
since I like the way of automated updating the tomcat manager...
I'm sure you do. You seem to be stuck on that particular page of the docs, 
however, which happens to be out of date, and doesn't actually mention what 
is important.
Read the deployer page instead 
(http://jakarta.apache.org/tomcat/tomcat-5.0-doc/deployer-howto.html).

But still: I don't know how to fix the problem: why doesn't the jndi 
datasource work with the through ant deployed application?
Because I don't think your stuff in server.xml is used at all.

--
x
Rémy Maucherat
Senior Developer  Consultant
JBoss Group (Europe) SàRL
x
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Paul
it is possible that the problem stems from Tomcat itself.  The reason  i say
that, is because i have setup a dbcp connection (using Tomcat 4.1, jdk 1.4,
oracle on win2k), and i have managed to get it to work with a particular
application, but get the same Cannot load JDBC driver class 'null' when
try to use connection with ROOT application, or with any other application.
It is weird, and i have not figured out what problem is.  Also, there are
many previous emails in this user-group pertaining to this Cannot-load-JDBC
error, esp. when associated with use as a global resource.

-paul lomack

p.s. i would be happy to report my server.xml or web.xml or jsp code for
calling connection, if you think it may be of any use to you.

- Original Message - 
From: Ilja Hehenkamp [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 15, 2003 9:10 AM
Subject: Re: Tomcat, MySQL  JNDI: java.sql.SQLException: Cannot load JDBC
driver class 'null'


 I think I know where lies the problem, however I still don't know how to
fix
 it...

 I use the sample build.xml file from Tomcat:
 http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/build.xml.txt to
 install, reload and distribute my sample application.

 When I do an ant -install it apparantly installs the application in the
 Tomcat manager, however the application doesn't show up in the webapps
 directory. That's 1.

 So maybe there's a conflict with either the context path, which I don't
 think so, since my build file has explicitly set the context path to
 /DBTest:

   property name=app.name  value=DBTest/
   property name=app.path  value=/${app.name}/
   property name=app.version   value=/
   property name=build.homevalue=${basedir}/build/
   property name=catalina.home value=/Library/Tomcat/ !-- UPDATE
THIS!
 --
   property name=dist.home value=${basedir}/dist/
   property name=docs.home value=${basedir}/docs/
   property name=manager.url   value=http://localhost:8080/manager/
   property name=src.home  value=${basedir}/src/
   property name=web.home  value=${basedir}/web/

 Or there's a conflict with the docbase, which I suspect... However I'm not
 sure why and how to fix it

 Because when I put the generated war file (when doing an ant -dist) in the
 webapps directory the connection works! Although this works, it's not very
 convenient, since it defeats the purpose of the automated installing
through
 ant...

 Hope I made myself clear?

 From: Martin Jacobson [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: Re: Tomcat, MySQL  JNDI: java.sql.SQLException: Cannot load
JDBC
 driver class 'null'
 Date: Mon, 15 Sep 2003 14:00:52 +0200
 
 Ilja wrote:
 Ok, first some configuration information:
 
 Tomcat 5.09
 MySQL Driver 3.08 stable
 OS: Mac OSX 10.2.6
 J2SE 1.4.2
 
 
 My config is not the same (TC 4.1.24, OSX 10.2.6, MySQL 3.07), and my
 parameters are different:
  ResourceParams name=jdbc/EuratomDB
  parameter
  namefactory/name
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
  namemaxActive/name
  value100/value
  /parameter
  parameter
  namemaxIdle/name
  value3/value
  /parameter
  parameter
  namemaxWait/name
  value100/value
  /parameter
  parameter
  nameusername/name
  valuexxx/value
  /parameter
  parameter
  namepassword/name
  valuexxx/value
  /parameter
  parameter
  namedriverClassName/name
  valuecom.mysql.jdbc.Driver/value
  /parameter
  parameter
  nameurl/name
  valuejdbc:mysql://localhost/euratom?autoReconnect=true/value
  /parameter
  /ResourceParams
 
 This works for me! The main diffs are (i) I specify the factory, and
 (ii), the driverClassName is com.mysql.jdbc.Driver
 
 However, the exception seems to suggest that the correct factory is being
 used by default. Your driverClassName is the old name, and might not be
in
 the jar file any more.
 
 HTH
 Martin
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

 _
 MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl


 -
 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, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'

2003-09-15 Thread Ilja Hehenkamp
It could be related, but I'm not sure.

I think the problem lies in the way the application gets deployed with this 
ant build file. Probably the docbase doesn't match (however that's just a 
wild guess)

Still waiting for some confirmation from Remy Maucherat. He was talking 
about the client deployer package, however I cannot find it...

Ilja

_
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Problem connecting to mysql database with Tomcat and JNDI

2003-08-22 Thread Scott Stewart
Well, looking at your Context definition, I'm not seeing the following
required element:

Resource name=jdbc/address 
  auth=Container 
  type=javax.sql.DataSource /

Thanks,

Scott Stewart
[Manager, Software Development]
[EMAIL PROTECTED]

ClearSky Mobile Media, Inc.
56 E. Pine Street  Suite 200
Orlando, FL  32801
USA





-Original Message-
From: Robert S. Jones [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 5:35 PM
To: [EMAIL PROTECTED]
Subject: Problem connecting to mysql database with Tomcat and JNDI


Folks, 

I'm having trouble connecting to a mysql database through Tomcat.  I'm
using Tomcat 5.0.9a with mysql 4.0.14.  I have the mysql 3.0.8 JDBC
driver in ${TOMCAT_HOME}/common/lib.  I'm running RedHat 8.0 with a
stock kernel. 

I've been able to connect to the database without JNDI services.  I
believe I have the database user set up correctly.  I have been all over
the web trying to figure out what the problem is.  It seems like
everyone is having this problem, but no two solutions are the same.

FWIW I've tried a lot of this on Tomcat 4 and have had the same results.

I've traced the problem to the following code from the JSP file below:

conn = ds.getConnection();

Any thoughts/ideas would be greatly appreciated.  I'm at the end of my
rope on this.

Here is the error message I'm getting. 

java.lang.NullPointerException 
org.apache.jsp.usingDataSource_jsp._jspService(usingDataSource_jsp.java:74) 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
20) 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 

Here is the JSP page I'm using: 

[EMAIL PROTECTED] import=java.sql.*, javax.sql.*, javax.naming.*%
html
head
titleUsing a DataSource/title
/head
body
h1Using a DataSource/h1
%
DataSource ds = null;
Connection conn = null;
ResultSet result = null;
Statement stmt = null;
ResultSetMetaData rsmd = null;

try {
Context context = new InitialContext();
Context envCtx = (Context) context.lookup(java:comp/env);
ds = (DataSource)envCtx.lookup(jdbc/address);
if (ds != null) {
conn = ds.getConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(SELECT * FROM AddressList);
}
}
catch (SQLException e) {
System.out.println(Error occurred  + e);
}
int columns = 0;
try {
rsmd = result.getMetaData(); // bad line
columns = rsmd.getColumnCount();
}
catch (SQLException e) {
System.out.println(Error occurred  + e);
}
%
table width=90% border=1
tr
% // write out the header cells containing the column labels
try {
for (int i = 1; i = columns; i++) {
out.write(th + rsmd.getColumnLabel(i) + /th);
}
%
/tr
% // now write out one row for each entry in the database table
while (result.next()) {
out.write(tr);
for (int i = 1; i = columns; i++) {
out.write(td + result.getString(i) + /td);
}
out.write(/tr);
}

// close the connection, resultset, and the statement
result.close();
stmt.close();
conn.close();
} // end of the try block
catch (SQLException e) {
System.out.println(Error  + e);
}
// ensure everything is closed
finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (SQLException e) {}
try {
if (conn != null) {
conn.close();
}
} catch (SQLException e ) {}
}
%

/table
/body
/html


Here are the changes I made to my server.xml file.  Of course, I've
changed the username/password entries here. 

Context path=/db-test docBase=db-test debug=0 reloadable=true 
  ResourceParams name=jdbc/address 
parameter 
  nameusername/name 
  valueusername/value 
/parameter 
parameter 
  namepassword/name 
  valuepassword/value 
/parameter 
parameter 
  nameurl/name 
  valuejdbc:mysql://localhost:3306/ADDRESS/value 
/parameter 
parameter 
  namedriverClassName/name 
  valuecom.mysql.jdbc.Driver/value 
/parameter 
  /ResourceParams 
/Context 

Here is the web.xml file I am using in my WEB-INF directory. 

?xml version=1.0 encoding=ISO-8859-1? 
!DOCTYPE web-app PUBLIC 
-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN 
http://java.sun.com/dtd/web-app_2_3.dtd; 
web-app 
  resource-ref 
  res-ref-namejdbc/address/res-ref-name 
  res-typejavax.sql.DataSource/res-type 
  res-authContainer/res-auth 
  /resource-ref 
/web-app 

Rob





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

RE: Problem connecting to mysql database with Tomcat and JNDI

2003-08-22 Thread Robert S. Jones
Ok, I tried that.  Same results.  Here is my new Context definition.

Context path=/db-test docBase=db-test debug=0 reloadable=true
  Resource name=jdbc/address auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/address
parameter
  nameusername/name
  valueusername/value
/parameter
parameter
  namepassword/name
  valuepassword/value
/parameter
parameter
  nameurl/name
  valuejdbc:mysql://localhost:3306/ADDRESS/value
/parameter
parameter
  namedriverClassName/name
  valuecom.mysql.jdbc.Driver/value
/parameter
  /ResourceParams
/Context

Thanks,
Rob


On Fri, 2003-08-22 at 07:09, Scott Stewart wrote:
 Well, looking at your Context definition, I'm not seeing the following
 required element:
 
 Resource name=jdbc/address 
   auth=Container 
   type=javax.sql.DataSource /
 
 Thanks,
 
 Scott Stewart
 [Manager, Software Development]
 [EMAIL PROTECTED]
 
 ClearSky Mobile Media, Inc.
 56 E. Pine Street  Suite 200
 Orlando, FL  32801
 USA
 
 
 
 
 
 -Original Message-
 From: Robert S. Jones [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 5:35 PM
 To: [EMAIL PROTECTED]
 Subject: Problem connecting to mysql database with Tomcat and JNDI
 
 
 Folks, 
 
 I'm having trouble connecting to a mysql database through Tomcat.  I'm
 using Tomcat 5.0.9a with mysql 4.0.14.  I have the mysql 3.0.8 JDBC
 driver in ${TOMCAT_HOME}/common/lib.  I'm running RedHat 8.0 with a
 stock kernel. 
 
 I've been able to connect to the database without JNDI services.  I
 believe I have the database user set up correctly.  I have been all over
 the web trying to figure out what the problem is.  It seems like
 everyone is having this problem, but no two solutions are the same.
 
 FWIW I've tried a lot of this on Tomcat 4 and have had the same results.
 
 I've traced the problem to the following code from the JSP file below:
 
 conn = ds.getConnection();
 
 Any thoughts/ideas would be greatly appreciated.  I'm at the end of my
 rope on this.
 
 Here is the error message I'm getting. 
 
 java.lang.NullPointerException 
 org.apache.jsp.usingDataSource_jsp._jspService(usingDataSource_jsp.java:74) 
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) 
 javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
 20) 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) 
 javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
 
 Here is the JSP page I'm using: 
 
 [EMAIL PROTECTED] import=java.sql.*, javax.sql.*, javax.naming.*%
 html
 head
 titleUsing a DataSource/title
 /head
 body
 h1Using a DataSource/h1
 %
 DataSource ds = null;
 Connection conn = null;
 ResultSet result = null;
 Statement stmt = null;
 ResultSetMetaData rsmd = null;
 
 try {
 Context context = new InitialContext();
 Context envCtx = (Context) context.lookup(java:comp/env);
 ds = (DataSource)envCtx.lookup(jdbc/address);
 if (ds != null) {
 conn = ds.getConnection();
 stmt = conn.createStatement();
 result = stmt.executeQuery(SELECT * FROM AddressList);
 }
 }
 catch (SQLException e) {
 System.out.println(Error occurred  + e);
 }
 int columns = 0;
 try {
 rsmd = result.getMetaData(); // bad line
 columns = rsmd.getColumnCount();
 }
 catch (SQLException e) {
 System.out.println(Error occurred  + e);
 }
 %
 table width=90% border=1
 tr
 % // write out the header cells containing the column labels
 try {
 for (int i = 1; i = columns; i++) {
 out.write(th + rsmd.getColumnLabel(i) + /th);
 }
 %
 /tr
 % // now write out one row for each entry in the database table
 while (result.next()) {
 out.write(tr);
 for (int i = 1; i = columns; i++) {
 out.write(td + result.getString(i) + /td);
 }
 out.write(/tr);
 }
 
 // close the connection, resultset, and the statement
 result.close();
 stmt.close();
 conn.close();
 } // end of the try block
 catch (SQLException e) {
 System.out.println(Error  + e);
 }
 // ensure everything is closed
 finally {
 try {
 if (stmt != null) {
 stmt.close();
 }
 } catch (SQLException e) {}
 try {
 if (conn != null) {
 conn.close();
 }
 } catch (SQLException e ) {}
 }
 %
 
 /table
 /body
 /html
 
 
 Here are the changes I made to my server.xml file.  Of course, I've
 changed the username/password entries here. 
 
 Context path=/db-test docBase=db-test debug=0 reloadable=true 
   ResourceParams name=jdbc/address 
 parameter 
   nameusername/name 
   valueusername/value 
 /parameter 
 parameter 
   namepassword/name 
   valuepassword/value

RE: Problem connecting to mysql database with Tomcat and JNDI

2003-08-22 Thread Robert S. Jones
Well Folks, the law of, the longer a problem takes to resolve, the
dumber the mistake has held true once again.  It turns out that I had
my Context definition in the wrong place in the server.xml file.  I'm
aggravated, but glad to have the problem solved.

Thanks Scott for your suggestions.  I should have posted the whole
server.xml file.  That probably would have made the problem obvious to
folks more experienced than me.

Rob

On Fri, 2003-08-22 at 09:00, Robert S. Jones wrote:
 Ok, I tried that.  Same results.  Here is my new Context definition.
 
 Context path=/db-test docBase=db-test debug=0 reloadable=true
   Resource name=jdbc/address auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/address
 parameter
   nameusername/name
   valueusername/value
 /parameter
 parameter
   namepassword/name
   valuepassword/value
 /parameter
 parameter
   nameurl/name
   valuejdbc:mysql://localhost:3306/ADDRESS/value
 /parameter
 parameter
   namedriverClassName/name
   valuecom.mysql.jdbc.Driver/value
 /parameter
   /ResourceParams
 /Context
 
 Thanks,
 Rob
 
 
 On Fri, 2003-08-22 at 07:09, Scott Stewart wrote:
  Well, looking at your Context definition, I'm not seeing the following
  required element:
  
  Resource name=jdbc/address 
auth=Container 
type=javax.sql.DataSource /
  
  Thanks,
  
  Scott Stewart
  [Manager, Software Development]
  [EMAIL PROTECTED]
  
  ClearSky Mobile Media, Inc.
  56 E. Pine Street  Suite 200
  Orlando, FL  32801
  USA
  
  
  
  
  
  -Original Message-
  From: Robert S. Jones [mailto:[EMAIL PROTECTED]
  Sent: Thursday, August 21, 2003 5:35 PM
  To: [EMAIL PROTECTED]
  Subject: Problem connecting to mysql database with Tomcat and JNDI
  
  
  Folks, 
  
  I'm having trouble connecting to a mysql database through Tomcat.  I'm
  using Tomcat 5.0.9a with mysql 4.0.14.  I have the mysql 3.0.8 JDBC
  driver in ${TOMCAT_HOME}/common/lib.  I'm running RedHat 8.0 with a
  stock kernel. 
  
  I've been able to connect to the database without JNDI services.  I
  believe I have the database user set up correctly.  I have been all over
  the web trying to figure out what the problem is.  It seems like
  everyone is having this problem, but no two solutions are the same.
  
  FWIW I've tried a lot of this on Tomcat 4 and have had the same results.
  
  I've traced the problem to the following code from the JSP file below:
  
  conn = ds.getConnection();
  
  Any thoughts/ideas would be greatly appreciated.  I'm at the end of my
  rope on this.
  
  Here is the error message I'm getting. 
  
  java.lang.NullPointerException 
  org.apache.jsp.usingDataSource_jsp._jspService(usingDataSource_jsp.java:74) 
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) 
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
  20) 
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) 
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
  
  Here is the JSP page I'm using: 
  
  [EMAIL PROTECTED] import=java.sql.*, javax.sql.*, javax.naming.*%
  html
  head
  titleUsing a DataSource/title
  /head
  body
  h1Using a DataSource/h1
  %
  DataSource ds = null;
  Connection conn = null;
  ResultSet result = null;
  Statement stmt = null;
  ResultSetMetaData rsmd = null;
  
  try {
  Context context = new InitialContext();
  Context envCtx = (Context) context.lookup(java:comp/env);
  ds = (DataSource)envCtx.lookup(jdbc/address);
  if (ds != null) {
  conn = ds.getConnection();
  stmt = conn.createStatement();
  result = stmt.executeQuery(SELECT * FROM AddressList);
  }
  }
  catch (SQLException e) {
  System.out.println(Error occurred  + e);
  }
  int columns = 0;
  try {
  rsmd = result.getMetaData(); // bad line
  columns = rsmd.getColumnCount();
  }
  catch (SQLException e) {
  System.out.println(Error occurred  + e);
  }
  %
  table width=90% border=1
  tr
  % // write out the header cells containing the column labels
  try {
  for (int i = 1; i = columns; i++) {
  out.write(th + rsmd.getColumnLabel(i) + /th);
  }
  %
  /tr
  % // now write out one row for each entry in the database table
  while (result.next()) {
  out.write(tr);
  for (int i = 1; i = columns; i++) {
  out.write(td + result.getString(i) + /td);
  }
  out.write(/tr);
  }
  
  // close the connection, resultset, and the statement
  result.close();
  stmt.close();
  conn.close();
  } // end of the try block
  catch (SQLException e) {
  System.out.println(Error  + e);
  }
  // ensure everything is closed
  finally

Problem connecting to mysql database with Tomcat and JNDI

2003-08-21 Thread Robert S. Jones
Folks, 

I'm having trouble connecting to a mysql database through Tomcat.  I'm
using Tomcat 5.0.9a with mysql 4.0.14.  I have the mysql 3.0.8 JDBC
driver in ${TOMCAT_HOME}/common/lib.  I'm running RedHat 8.0 with a
stock kernel. 

I've been able to connect to the database without JNDI services.  I
believe I have the database user set up correctly.  I have been all over
the web trying to figure out what the problem is.  It seems like
everyone is having this problem, but no two solutions are the same.

FWIW I've tried a lot of this on Tomcat 4 and have had the same results.

I've traced the problem to the following code from the JSP file below:

conn = ds.getConnection();

Any thoughts/ideas would be greatly appreciated.  I'm at the end of my
rope on this.

Here is the error message I'm getting. 

java.lang.NullPointerException 
org.apache.jsp.usingDataSource_jsp._jspService(usingDataSource_jsp.java:74) 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320) 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 

Here is the JSP page I'm using: 

[EMAIL PROTECTED] import=java.sql.*, javax.sql.*, javax.naming.*%
html
head
titleUsing a DataSource/title
/head
body
h1Using a DataSource/h1
%
DataSource ds = null;
Connection conn = null;
ResultSet result = null;
Statement stmt = null;
ResultSetMetaData rsmd = null;

try {
Context context = new InitialContext();
Context envCtx = (Context) context.lookup(java:comp/env);
ds = (DataSource)envCtx.lookup(jdbc/address);
if (ds != null) {
conn = ds.getConnection();
stmt = conn.createStatement();
result = stmt.executeQuery(SELECT * FROM AddressList);
}
}
catch (SQLException e) {
System.out.println(Error occurred  + e);
}
int columns = 0;
try {
rsmd = result.getMetaData(); // bad line
columns = rsmd.getColumnCount();
}
catch (SQLException e) {
System.out.println(Error occurred  + e);
}
%
table width=90% border=1
tr
% // write out the header cells containing the column labels
try {
for (int i = 1; i = columns; i++) {
out.write(th + rsmd.getColumnLabel(i) + /th);
}
%
/tr
% // now write out one row for each entry in the database table
while (result.next()) {
out.write(tr);
for (int i = 1; i = columns; i++) {
out.write(td + result.getString(i) + /td);
}
out.write(/tr);
}

// close the connection, resultset, and the statement
result.close();
stmt.close();
conn.close();
} // end of the try block
catch (SQLException e) {
System.out.println(Error  + e);
}
// ensure everything is closed
finally {
try {
if (stmt != null) {
stmt.close();
}
} catch (SQLException e) {}
try {
if (conn != null) {
conn.close();
}
} catch (SQLException e ) {}
}
%

/table
/body
/html


Here are the changes I made to my server.xml file.  Of course, I've
changed the username/password entries here. 

Context path=/db-test docBase=db-test debug=0 reloadable=true 
  ResourceParams name=jdbc/address 
parameter 
  nameusername/name 
  valueusername/value 
/parameter 
parameter 
  namepassword/name 
  valuepassword/value 
/parameter 
parameter 
  nameurl/name 
  valuejdbc:mysql://localhost:3306/ADDRESS/value 
/parameter 
parameter 
  namedriverClassName/name 
  valuecom.mysql.jdbc.Driver/value 
/parameter 
  /ResourceParams 
/Context 

Here is the web.xml file I am using in my WEB-INF directory. 

?xml version=1.0 encoding=ISO-8859-1? 
!DOCTYPE web-app PUBLIC 
-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN 
http://java.sun.com/dtd/web-app_2_3.dtd; 
web-app 
  resource-ref 
  res-ref-namejdbc/address/res-ref-name 
  res-typejavax.sql.DataSource/res-type 
  res-authContainer/res-auth 
  /resource-ref 
/web-app 

Rob





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



Re: Tomcat/Ant/JNDI question

2003-06-17 Thread Tim Shaw
This works for me ...

web.xml :
resource-ref
description
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
/description
res-ref-name
jdbc/SessionDB
/res-ref-name
res-type
javax.sql.DataSource
/res-type
res-auth
Container
/res-auth
/resource-ref
context.xml :
snip
  Resource name=jdbc/SessionDB auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/SessionDB
  parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
parameter
  nameusername/name
  valuetripleplay/value
/parameter
parameter
  namepassword/name
  value/value
/parameter
parameter
  namedriverClassName/name
  valuecom.mysql.jdbc.Driver/value
/parameter
parameter
  nameurl/name
  valuejdbc:mysql://vodmgr:3306/tripleplay/value
/parameter
parameter
  namemaxActive/name
  value20/value
/parameter
parameter
  namemaxIdle/name
  value20/value
/parameter
  parameter
namemaxWait/name
value5000/value
  /parameter
  /ResourceParams
/snip
Garrett Dangerfield wrote:
I tried this and it's not working.

It's saying:
Name jdbc not found in this context
In my web.xml, I put in:

 env-entry
   env-entry-namejdbc/DataWarehouse/env-entry-name
   env-entry-valuejdbc/DataWarehouse/env-entry-value
   env-entry-typejavax.sql.DataSource/env-entry-type
 /env-entry
In my server.xml, I have:

Resource auth=Container name=jdbc/DataWarehouse scope=Shareable
type=javax.sql.DataSource/
Am I missing something?

Thanks
Garrett Dangerfield.
Shapira, Yoav wrote:

Howdy,

 

- put the equivalent of ResourceEnvRef into the web.xml inside the web
  
app

See the env-entry element in the Servlet Specification, v2.3,
SRC.13.1.
Yoav Shapira



This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, 
proprietary and/or privileged.  This e-mail is intended only for the 
individual(s) to whom it is addressed, and may not be saved, copied, 
printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your 
computer system and notify the sender.  Thank you.

-
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: Tomcat/Ant/JNDI question

2003-06-17 Thread Garrett Dangerfield
I tried this and it's not giving me the not found in Context message, 
but it's now trying to pass me a null connection.

I think the problem is that it doesn't know where to get the connection 
from.

With the ResourceLink in the server.xml Context, one specifies the name 
one wants to use locally as well as the name of the global resource. The 
resource-ref doesn't allow this.

Any further thoughts?

Thanks,
Garrett Dangerfield.
Tim Shaw wrote:

This works for me ...

web.xml :
resource-ref
description
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
/description
res-ref-name
jdbc/SessionDB
/res-ref-name
res-type
javax.sql.DataSource
/res-type
res-auth
Container
/res-auth
/resource-ref
context.xml :
snip
Resource name=jdbc/SessionDB auth=Container
type=javax.sql.DataSource/
ResourceParams name=jdbc/SessionDB
parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
nameusername/name
valuetripleplay/value
/parameter
parameter
namepassword/name
value/value
/parameter
parameter
namedriverClassName/name
valuecom.mysql.jdbc.Driver/value
/parameter
parameter
nameurl/name
valuejdbc:mysql://vodmgr:3306/tripleplay/value
/parameter
parameter
namemaxActive/name
value20/value
/parameter
parameter
namemaxIdle/name
value20/value
/parameter
parameter
namemaxWait/name
value5000/value
/parameter
/ResourceParams
/snip
Garrett Dangerfield wrote:

I tried this and it's not working.

It's saying:
Name jdbc not found in this context
In my web.xml, I put in:

env-entry
env-entry-namejdbc/DataWarehouse/env-entry-name
env-entry-valuejdbc/DataWarehouse/env-entry-value
env-entry-typejavax.sql.DataSource/env-entry-type
/env-entry
In my server.xml, I have:

Resource auth=Container name=jdbc/DataWarehouse scope=Shareable
type=javax.sql.DataSource/
Am I missing something?

Thanks
Garrett Dangerfield.
Shapira, Yoav wrote:

Howdy,



- put the equivalent of ResourceEnvRef into the web.xml inside the web


app

See the env-entry element in the Servlet Specification, v2.3,
SRC.13.1.
Yoav Shapira



This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, 
proprietary and/or privileged. This e-mail is intended only for the 
individual(s) to whom it is addressed, and may not be saved, copied, 
printed, disclosed or used by anyone else. If you are not the(an) 
intended recipient, please immediately delete this e-mail from your 
computer system and notify the sender. Thank you.



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


Re: Tomcat/Ant/JNDI question

2003-06-17 Thread Tim Shaw
The Resource is specified, in the server.xml, with a name. This is the 
JNDI name and is used to refer to the resource from wherever you like.

The setup of the resource is done by the ResourceParams (I hope you 
didn't copy my example verbatim ;-)

The web.xml is just abstracting that reference for a lower-level JNDI call.

If you are now getting a null connection, the basic JNDI aspect is 
(probably) working ... and you just need to figure out the url/DB 
specific stuff. This could be the Factory (I added that param based on 
the JNDI/JDBC HOWTO - but it worked fine before, so it might be a 
default), DB permissions (grabbing a connection can fail in loadsa 
ways!), or ...

If you have coded the JNDI (InitialContext) lookup correctly it will work.

BTW I got badly bitten with 4.1.2 (haven't checked since) - every time I 
redeployed my app it rewrote the server.xml file (removing my Resource 
definitions).

If you're still stuck, some more info is needed - server.xml/web.xml 
snippets and code where you get the ref and the connection for starters.

G'luck

tim

Garrett Dangerfield wrote:
I tried this and it's not giving me the not found in Context message, 
but it's now trying to pass me a null connection.

I think the problem is that it doesn't know where to get the connection 
from.

With the ResourceLink in the server.xml Context, one specifies the name 
one wants to use locally as well as the name of the global resource. The 
resource-ref doesn't allow this.

Any further thoughts?

Thanks,
Garrett Dangerfield.
Tim Shaw wrote:

This works for me ...

web.xml :
resource-ref
description
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
/description
res-ref-name
jdbc/SessionDB
/res-ref-name
res-type
javax.sql.DataSource
/res-type
res-auth
Container
/res-auth
/resource-ref
context.xml :
snip
Resource name=jdbc/SessionDB auth=Container
type=javax.sql.DataSource/
ResourceParams name=jdbc/SessionDB
parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
nameusername/name
valuetripleplay/value
/parameter
parameter
namepassword/name
value/value
/parameter
parameter
namedriverClassName/name
valuecom.mysql.jdbc.Driver/value
/parameter
parameter
nameurl/name
valuejdbc:mysql://vodmgr:3306/tripleplay/value
/parameter
parameter
namemaxActive/name
value20/value
/parameter
parameter
namemaxIdle/name
value20/value
/parameter
parameter
namemaxWait/name
value5000/value
/parameter
/ResourceParams
/snip
Garrett Dangerfield wrote:

I tried this and it's not working.

It's saying:
Name jdbc not found in this context
In my web.xml, I put in:

env-entry
env-entry-namejdbc/DataWarehouse/env-entry-name
env-entry-valuejdbc/DataWarehouse/env-entry-value
env-entry-typejavax.sql.DataSource/env-entry-type
/env-entry
In my server.xml, I have:

Resource auth=Container name=jdbc/DataWarehouse scope=Shareable
type=javax.sql.DataSource/
Am I missing something?

Thanks
Garrett Dangerfield.
Shapira, Yoav wrote:

Howdy,



- put the equivalent of ResourceEnvRef into the web.xml inside the web


app

See the env-entry element in the Servlet Specification, v2.3,
SRC.13.1.
Yoav Shapira



This e-mail, including any attachments, is a confidential business 
communication, and may contain information that is confidential, 
proprietary and/or privileged. This e-mail is intended only for the 
individual(s) to whom it is addressed, and may not be saved, copied, 
printed, disclosed or used by anyone else. If you are not the(an) 
intended recipient, please immediately delete this e-mail from your 
computer system and notify the sender. Thank you.




-
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]


Tomcat/Ant/JNDI question

2003-06-17 Thread Garrett Dangerfield
I have defined a GlobalNamingResource for a database connection and that 
works great if I put a ResourceEnvRef in the Context in the server.xml.

However, I have a problem.  If I deploy my app using ant and it's deply 
task, it removes the ResourceEnvRef portion of my Context.

I see two possible ways to resolve this:
- have ant's deploy task inlcue the ResourceEnvRef
- put the equivalent of ResourceEnvRef into the web.xml inside the web app
Any idea on how to do either/both of these?

Thanks,
Garrett Dangerfield.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Tomcat/Ant/JNDI question

2003-06-17 Thread Shapira, Yoav

Howdy,

- put the equivalent of ResourceEnvRef into the web.xml inside the web
app

See the env-entry element in the Servlet Specification, v2.3,
SRC.13.1.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: Tomcat/Ant/JNDI question

2003-06-17 Thread Garrett Dangerfield
I tried this and it's not working.

It's saying:
Name jdbc not found in this context
In my web.xml, I put in:

 env-entry
   env-entry-namejdbc/DataWarehouse/env-entry-name
   env-entry-valuejdbc/DataWarehouse/env-entry-value
   env-entry-typejavax.sql.DataSource/env-entry-type
 /env-entry
In my server.xml, I have:

Resource auth=Container name=jdbc/DataWarehouse scope=Shareable
type=javax.sql.DataSource/
Am I missing something?

Thanks
Garrett Dangerfield.
Shapira, Yoav wrote:

Howdy,

 

- put the equivalent of ResourceEnvRef into the web.xml inside the web
   

app

See the env-entry element in the Servlet Specification, v2.3,
SRC.13.1.
Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged.  This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender.  Thank you.

-
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]


Tomcat and JNDI - Basic Question

2003-06-10 Thread Renato Romano
In the tomcat documentation it is said that to configure a new JNDI
resource you should put a Resource entry in the Context portion of my
app, and a following ResourceParams, indicating the java class name of
the factory (the class that must implement ObjectFactory). This seems
quite correct: in order to build an object, I need a Factory!! But I
noticed it works fine even if the ResourceParams is not present ?? The
conclusion is: I'm surely missing something !! How can Tomcat know how
to build my object if I don't give the name of the factory class ???


Context path=/dg3s docBase=dg3s reloadable=true
Resource name=myJndiName type=com.blabla.MyType/
!-- The following is not useful ?
ResourceParams name=myJndiName
parameter
namefactory/name
valuecom.blabla.MyTypeFactory/value
/parameter
/ResourceParams
--
/Context

Any Help Appreciated!!
Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_




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



Re: [tomcat] RE: JNDI datasource non available in ServletContextListener.contextInitialized

2003-06-10 Thread Federico Spinazzi
James Lewis wrote:

always perform such a lookup successfully, but when I try from a
ContextListener contextInitialized method it fails: the same code WILL
NOT FAIL contextDestroyed !!!
   

Hmmm, odd. This is *exactly* what I do pretty much. I have a
LifeCycleListener specified in the webapps/app/WEB-INF/web.xml like this:
 listener
listener-classmy.foo.bar.package.LifeCycleListener/listener-class
 /listener
and then in the contextInitialized method of the LifeCycleListener I do a
bunch of calls to jndiContext.lookup().
Hmm, hmmm, hmmm. You are correctly specifying the listener in web.xml?

This is the web.xml entry:

   listener
 
listener-classit.masterhouse.termopoli.web.startup.Init/listener-class
   /listener

   resource-ref
 description
   JNDI resource reference to a factory for java.sql.Connection
   instances that may be used for talking to Babele
   database (configured in the server.xml file).
 /description
 res-ref-name
   jdbc/Babele
 /res-ref-name
 res-type
   javax.sql.Datasource
 /res-type
 res-auth
   Container
 /res-auth
   /resource-ref
and this is the context:

Context path=/termopoli docBase=termopoli debug=0 
reloadable=true crossContext=true

   Logger className=org.apache.catalina.logger.FileLogger
   prefix=localhost_termopoli_log.
   suffix=.txt
   timestamp=true/
   !-- Pool JNDI per DB2/Babele --
   Resource name=jdbc/Babele auth=Container 
type=javax.sql.DataSource/

   ResourceParams name=jdbc/Babele
   parameter
 nameusername/name
 valuefoo/value
   /parameter
   parameter
 namepassword/name
 valuefoo/value
   /parameter
   parameter
 namedriverClassName/name
 valuecom.ibm.db2.jcc.DB2Driver/value
   /parameter
   parameter
 nameurl/name
 valuejdbc:db2://foo:/BABELE/value
   /parameter
   parameter
 namemaxActive/name
 value8/value
   /parameter
   parameter
 namemaxIdle/name
 value4/value
   /parameter
  
   parameter
 nameremoveAbandoned/name
 valuetrue/value
   /parameter
   parameter
 nameremoveAbandonedTimeout/name
 value60/value
   /parameter
   parameter
 namelogAbandoned/name
 valuetrue/value
   /parameter   
   /ResourceParams
  

/Context

I can list the JNDI datasource like this:
INFO : [06/06/2003 11:56:50]: 
it.masterhouse.termopoli.web.startup.Init.printBindings(Init.java:86): 
Babele: 
ResourceRef[className=javax.sql.Datasource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory
.ResourceFactory,{type=description,content=JNDI resource reference to a 
factory for java.sql.Connection
   instances that may be used for talking to Babele
   database (configured in the server.xml 
file).},{type=scope,content=Shareable},{type=auth,content=Conta
iner}]
INFO : [06/06/2003 11:56:50]: 
it.masterhouse.termopoli.web.startup.Init.printBindings(Init.java:88): 
context j
ava:comp/env/jdbc enumerated

but then:

FATAL: [06/06/2003 11:56:50]: 
it.masterhouse.termopoli.web.startup.Init.contextInitialized(Init.java:55): 
Nami
ngException during lookup
javax.naming.NamingException: Cannot create resource instance
   at 
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:189)
   at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
   at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
   at 
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
   at javax.naming.InitialContext.lookup(InitialContext.java:347)
   at 
it.masterhouse.termopoli.web.startup.Init.contextInitialized(Init.java:37)

I think the problem is that I cannot get the ResourceParameters: look at 
a succesfull call:

INFO : [06/06/2003 14:38:31]: 
it.masterhouse.termopoli.web.startup.Init.printBindings(Init.java:86): 
Babele: R
esourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory
.ResourceFactory,{type=scope,content=Shareable},{type=auth,content=Container},{type=url,content=jdbc:db2://foo:/BABELE},
{type=maxIdle,content=4},{type=maxActive,content=8},{type=driverClassName,content=c
om.ibm.db2.jcc.DB2Driver},{type=removeAbandoned,content=true},{type=username,content=foo},{type=logAbando
ned,content=true},{type=removeAbandonedTimeout,content=60},{type=password,content=foo}]
INFO : [06/06/2003 14:38:31]: 

Re: Tomcat and JNDI - Basic Question

2003-06-10 Thread Yoav Shapira
Howdy,
It might be that the fallback behavior is to use a public no-args constructor,
ala JavaBeans.

Yoav Shapira

--- Renato Romano [EMAIL PROTECTED] wrote:
 In the tomcat documentation it is said that to configure a new JNDI
 resource you should put a Resource entry in the Context portion of my
 app, and a following ResourceParams, indicating the java class name of
 the factory (the class that must implement ObjectFactory). This seems
 quite correct: in order to build an object, I need a Factory!! But I
 noticed it works fine even if the ResourceParams is not present ?? The
 conclusion is: I'm surely missing something !! How can Tomcat know how
 to build my object if I don't give the name of the factory class ???
 
 
   Context path=/dg3s docBase=dg3s reloadable=true
   Resource name=myJndiName type=com.blabla.MyType/
   !-- The following is not useful ?
   ResourceParams name=myJndiName
   parameter
   namefactory/name
   valuecom.blabla.MyTypeFactory/value
   /parameter
   /ResourceParams
   --
   /Context
 
 Any Help Appreciated!!
 Renato
 
 
 Renato Romano
 Sistemi e Telematica S.p.A.
 Calata Grazie - Vial Al Molo Giano
 16127 - GENOVA
 
 e-mail: [EMAIL PROTECTED]
 Tel.:   010 2712603
 _
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


=
Yoav Shapira
[EMAIL PROTECTED]

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



Re: [tomcat] RE: JNDI datasource non available in ServletContextListener.contextInitialized

2003-06-09 Thread Federico Spinazzi
James Lewis wrote:

- define the resource in server.xml (this is a little 'limitating' for me)
 

- deploy the applications in unpacked format (i.e. not from a war file:
this is quite limiting, however)
   

Yep, not good to stick them in server.xml.

Your application.xml file containing your resources should be in the
webapps/ directory along with your packed or unpacked application
You can then access your resources using:
snip jndiContext.lookup(java:comp/env/resource name);
Is this what you are doing? Are you using the correct Context
(java:comp/env)?
Yes, and this is my trouble: when the application is running I can 
always perform such a lookup successfully, but when I try from a 
ContextListener contextInitialized method it fails: the same code WILL 
NOT FAIL contextDestroyed !!!
I experience the same failure from the init method of a servlet
Thanks.
Federico

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


RE: [tomcat] RE: JNDI datasource non available in ServletContextListener.contextInitialized

2003-06-09 Thread James Lewis
 always perform such a lookup successfully, but when I try from a
 ContextListener contextInitialized method it fails: the same code WILL
 NOT FAIL contextDestroyed !!!

Hmmm, odd. This is *exactly* what I do pretty much. I have a
LifeCycleListener specified in the webapps/app/WEB-INF/web.xml like this:

  listener
listener-classmy.foo.bar.package.LifeCycleListener/listener-class
  /listener

and then in the contextInitialized method of the LifeCycleListener I do a
bunch of calls to jndiContext.lookup().

Hmm, hmmm, hmmm. You are correctly specifying the listener in web.xml?


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



RE: [tomcat] RE: JNDI datasource non available in ServletContextListener.contextInitialized

2003-06-09 Thread Shapira, Yoav

Howdy,
FYI, I do the same thing: JNDI calls from a ServletContextListener's
contextInitialized() event -- no problems.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: James Lewis [mailto:[EMAIL PROTECTED]
Sent: Monday, June 09, 2003 11:43 AM
To: Tomcat Users List
Subject: RE: [tomcat] RE: JNDI datasource non available in
ServletContextListener.contextInitialized

 always perform such a lookup successfully, but when I try from a
 ContextListener contextInitialized method it fails: the same code
WILL
 NOT FAIL contextDestroyed !!!

Hmmm, odd. This is *exactly* what I do pretty much. I have a
LifeCycleListener specified in the webapps/app/WEB-INF/web.xml like
this:

  listener

listener-classmy.foo.bar.package.LifeCycleListener/listener-
class
  /listener

and then in the contextInitialized method of the LifeCycleListener I do
a
bunch of calls to jndiContext.lookup().

Hmm, hmmm, hmmm. You are correctly specifying the listener in web.xml?


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




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Tomcat and JNDI - Basic Question

2003-06-06 Thread Renato Romano
In the tomcat documentation it is said that to configure a new JNDI
resource you shoul put a Resource entry in the Context portion of my
app, and a following ResourceParams, indicating the java class name of
the factory (the class that must implement ObjectFactory). This seems
quite correct: in order to build an object, I need a Factory!! But I
noticed it works fine even if the ResourceParams is not present ?? The
conclusion is: I'm surely missing something !! How can Tomcat know how
to build my object if I don't give the name of the factory class ???


Context path=/dg3s docBase=dg3s reloadable=true
Resource name=myJndiName type=com.blabla.MyType/
!-- The following is not useful ?
ResourceParams name=myJndiName
parameter
namefactory/name
valuecom.blabla.MyTypeFactory/value
/parameter
/ResourceParams
--
/Context

Any Help Appreciated!!
Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_




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



Tomcat and JNDI

2003-01-13 Thread Randy Paries
Hello,

I am trying to get tomcat and jndi working. 

I am just looking for some direction in troubleshooting. I have
configured the server.xml and web.xml as given in the examples of the
tomcat docs for oracle.

In the code I am trying to get working.
//snippet//
initNamingContext= new InitialContext ();
envNamingContext= (Context) initNamingContext.lookup
(java:comp/env);
envNamingContext.bind (JNDINames.userDataDtdJndiName,
userDataDTDName);

When it does the envNamingContext.bind it throws and exception (see
below)
Any help would be greatly appreciated
Thanks
Randy Paries

javax.naming.NamingException: Context is read only
at
org.apache.naming.NamingContext.checkWritable(NamingContext.java:942)
at org.apache.naming.NamingContext.bind(NamingContext.java:870)
at org.apache.naming.NamingContext.bind(NamingContext.java:212)
at org.apache.naming.NamingContext.bind(NamingContext.java:228)
at
com.mc.pc.struts.plugins.PrintCenterPlugin.init(PrintCenterPlugin.java:1
10)
at
org.apache.struts.action.ActionServlet.initApplicationPlugIns(ActionServ
let.java:991)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:471)
at com.mc.action.MCActionServlet.init(MCActionServlet.java:22)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:918)
at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.j
ava:3279)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3421
)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at
org.apache.catalina.core.StandardService.start(StandardService.java:388)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at
org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
DEBUG [01-13-03 12:56:28,750]
mc.servlets.MCContextListener.contextInitialized():28 : ServletContext
Listener was Called
P:\webapp\



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




Tomcat 3.3 , JNDI, DataSource, Web.xml, Server.xml

2002-11-22 Thread Jeovanny Mejia
Does anyone know how to get a DataSource configured in the Server.xml file, 
reference it in the web.xml as a resource, and pull the DataSource using 
JNDI in an external application?

I am stumped.



_
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


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



Re: Tomcat 3.3 , JNDI, DataSource, Web.xml, Server.xml

2002-11-22 Thread Craig R. McClanahan


On Sat, 23 Nov 2002, Jeovanny Mejia wrote:

 Date: Sat, 23 Nov 2002 01:32:01 +
 From: Jeovanny Mejia [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Tomcat 3.3 , JNDI, DataSource, Web.xml, Server.xml

 Does anyone know how to get a DataSource configured in the Server.xml file,
 reference it in the web.xml as a resource, and pull the DataSource using
 JNDI in an external application?

 I am stumped.


AFAIK the JNDI resources stuff is not supported by Tomcat 3.3.  You should
still be able to use things like PoolMan within a webapp, configuring them
as described in the docs.

For 4.0 and 4.1, the appropriate docs are in the tomcat-docs webapp, and
also available online:

  http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html

  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

For 4.1, there are also some specific examples for data sources:

  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Craig


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




Re: Tomcat 3.3 , JNDI, DataSource, Web.xml, Server.xml

2002-11-22 Thread Bill Barker

Craig R. McClanahan [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


 On Sat, 23 Nov 2002, Jeovanny Mejia wrote:

  Date: Sat, 23 Nov 2002 01:32:01 +
  From: Jeovanny Mejia [EMAIL PROTECTED]
  Reply-To: Tomcat Users List [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: Tomcat 3.3 , JNDI, DataSource, Web.xml, Server.xml
 
  Does anyone know how to get a DataSource configured in the Server.xml
file,
  reference it in the web.xml as a resource, and pull the DataSource using
  JNDI in an external application?
 
  I am stumped.
 

 AFAIK the JNDI resources stuff is not supported by Tomcat 3.3.  You should
 still be able to use things like PoolMan within a webapp, configuring them
 as described in the docs.


Craig is correct: Tomcat 3.3 is only a Servlet/JSP container.  It doesn't
add the JNDI resources stuff.  From some of the things going on in the
Tomcat development, this may change in the future, but I would doubt that it
would be before 3.3.3 (which is +2 from the current release).

 For 4.0 and 4.1, the appropriate docs are in the tomcat-docs webapp, and
 also available online:


http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html


http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

 For 4.1, there are also some specific examples for data sources:


http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
to.html

 Craig





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




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread Martin Jacobson

[EMAIL PROTECTED] wrote:

 Vance,
 
 Good eye.  It use to be driverName but got changed along the way to URL.
 Probably when I started following the 4.1 how-to.  In any case, I changed
 back to driverName and, alas, same problem.
 
 Vance, do you get the same error?
 
 javax.naming.NamingException: Exception creating DataSource:
 org.hsql.jdbcDriver
  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
  at foo.DBTest1.init(DBTest1.java:20)
  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)
 


Hi, I had this problem for ages, and resolved it by retrofitting the 
DataSource factory ( connection pool) from tc4.1. The basic problem is 
that Tyrex is broken; it happened to work for some people, but not for 
me and many others :-(

At this point, Craig will probably come in and say to move to tc 4.1, 
and I'd say, 'fine, as long as you don't use SSL with a standalone 
tomcat, because the Coyote connector is broken in this respect.'

What you can do is download 4.1.9, remove tyrex...jar from common/lib in 
4.0.4, and drop in the commons-*.jar files from 4.1.

Here is what I have in /usr/local/tomcat/common/lib
activation.jar
commons-collections.jar
commons-dbcp.jar
commons-pool.jar
jdbc2_0-stdext.jar
jndi.jar
jta-spec1_0_1.jar
mail.jar
mm.mysql-2.0.14-bin.jar
naming-common.jar
naming-factory.jar
naming-resources.jar
servlet.jar
xerces.jar

HTH
Martin

PS: dont forget that the user parameter is username with DBCP



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




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread stevem


Martin,

You are using mm.mysql-2.0.14-bin.jar.  I am using
mysql-connector-java-2.0.14-bin.jar from the MySQL Connector/J2 download.
Do know if there is any difference or was the name just changed when it
became the official driver of MySQL?





.  Where did your driver come from?


   
   Martin Jacobson 
   [EMAIL PROTECTED]  
   t   To 
 Tomcat Users List 
   08/30/2002 06:01  [EMAIL PROTECTED]  
   AM   cc 
   
   Subject 
   Please respond to Re: Trouble configuring Tomcat 4.0.4  
 Tomcat Users   JNDI connection to MySQL  
 List 
   tomcat-user@jakar  
 ta.apache.org
   
   
   




[EMAIL PROTECTED] wrote:

 Vance,

 Good eye.  It use to be driverName but got changed along the way to URL.
 Probably when I started following the 4.1 how-to.  In any case, I changed
 back to driverName and, alas, same problem.

 Vance, do you get the same error?

 javax.naming.NamingException: Exception creating DataSource:
 org.hsql.jdbcDriver
  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
  at foo.DBTest1.init(DBTest1.java:20)
  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)



Hi, I had this problem for ages, and resolved it by retrofitting the
DataSource factory ( connection pool) from tc4.1. The basic problem is
that Tyrex is broken; it happened to work for some people, but not for
me and many others :-(

At this point, Craig will probably come in and say to move to tc 4.1,
and I'd say, 'fine, as long as you don't use SSL with a standalone
tomcat, because the Coyote connector is broken in this respect.'

What you can do is download 4.1.9, remove tyrex...jar from common/lib in
4.0.4, and drop in the commons-*.jar files from 4.1.

Here is what I have in /usr/local/tomcat/common/lib
activation.jar
commons-collections.jar
commons-dbcp.jar
commons-pool.jar
jdbc2_0-stdext.jar
jndi.jar
jta-spec1_0_1.jar
mail.jar
mm.mysql-2.0.14-bin.jar
naming-common.jar
naming-factory.jar
naming-resources.jar
servlet.jar
xerces.jar

HTH
Martin

PS: dont forget that the user parameter is username with DBCP



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





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




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread stevem
   To 
 Tomcat Users List 
   08/30/2002 06:01  [EMAIL PROTECTED]  
   AM   cc 
   
   Subject 
   Please respond to Re: Trouble configuring Tomcat 4.0.4  
 Tomcat Users   JNDI connection to MySQL  
 List 
   tomcat-user@jakar  
 ta.apache.org
   
   
   




[EMAIL PROTECTED] wrote:

 Vance,

 Good eye.  It use to be driverName but got changed along the way to URL.
 Probably when I started following the 4.1 how-to.  In any case, I changed
 back to driverName and, alas, same problem.

 Vance, do you get the same error?

 javax.naming.NamingException: Exception creating DataSource:
 org.hsql.jdbcDriver
  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
  at foo.DBTest1.init(DBTest1.java:20)
  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)



Hi, I had this problem for ages, and resolved it by retrofitting the
DataSource factory ( connection pool) from tc4.1. The basic problem is
that Tyrex is broken; it happened to work for some people, but not for
me and many others :-(

At this point, Craig will probably come in and say to move to tc 4.1,
and I'd say, 'fine, as long as you don't use SSL with a standalone
tomcat, because the Coyote connector is broken in this respect.'

What you can do is download 4.1.9, remove tyrex...jar from common/lib in
4.0.4, and drop in the commons-*.jar files from 4.1.

Here is what I have in /usr/local/tomcat/common/lib
activation.jar
commons-collections.jar
commons-dbcp.jar
commons-pool.jar
jdbc2_0-stdext.jar
jndi.jar
jta-spec1_0_1.jar
mail.jar
mm.mysql-2.0.14-bin.jar
naming-common.jar
naming-factory.jar
naming-resources.jar
servlet.jar
xerces.jar

HTH
Martin

PS: dont forget that the user parameter is username with DBCP



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





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




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread Craig R. McClanahan



On Fri, 30 Aug 2002, Martin Jacobson wrote:


 At this point, Craig will probably come in and say to move to tc 4.1,
 and I'd say, 'fine, as long as you don't use SSL with a standalone
 tomcat, because the Coyote connector is broken in this respect.'


I hope you've reported your issues to the bug tracking system -- we're
trying to get a stable release out the door, and any real problems with
SSL support would be pretty significant.

  http://nagoya.apache.org/bugzilla/


Craig


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




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread Vance Christiaanse

You need to set driverClassName to the proper value,
com.mysql.jdbc.Driver, not driverName.

- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Cc: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, August 30, 2002 12:20 PM
Subject: Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL



 Martin's advice made a difference.  When I pulled in the tc 4.1 common/lib
 jars to my tc 4.04 common/lib I got past my problem for the first time.
 The new contents of common/lib are: activation.jar,
 commons-collections.jar, commons-dbcp.jar, commons-pool.jar,
 jdbc2_0-stdext.jar, jndi.jar, jta-spec1_0_1.jar, mail.jar,
 mysql-connector-java-2.0.14-bin.jar, naming-common.jar,
naming-factory.jar,
 naming-resources.jar, servlet.jar, tools.jar, xerces.jar.

 Now I have a new problem which hopefully is easy to correct:

 java.sql.SQLException: Cannot load JDBC driver class 'null'
  at

org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav
a:529)
  at

org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3
12)
  at foo.DBTest.init(DBTest.java:32)

 I've tried setting driverName to  com.mysql.jdbc.Driver,
 org.gjt.mm.mysql.Driver, and even to
 com.mysql.jdbc.jdbc2.optional.MysqlDataSource. I also tried adding
 Class.forName(...).newInstance() to my code, but it was no help either.

 Here is my code:
 Class.forName(com.mysql.jdbc.Driver).newInstance();
 Context ctx = new InitialContext();
   ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
org.apache.naming.factory.DbcpDataSourceFactory);
 //com.sun.jndi.fscontext.RefFSContextFactory);
   if(ctx == null )throw new Exception(Boom - No Context);
   DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/TestDB);
   if (ds != null) {
 Connection conn = ds.getConnection();   --- Blows
 up here

 Here is my host/context:
 ...
 Host name=localhost debug=0 appBase=webapps unpackWARs=true
 Valve className=org.apache.catalina.valves.AccessLogValve
  directory=logs  prefix=localhost_access_log. suffix
 =.txt
  pattern=common/
 Logger className=org.apache.catalina.logger.FileLogger
  directory=logs  prefix=localhost_log. suffix=.txt
  timestamp=true/
 !-- Tomcat Root Context --
 !--
   Context path= docBase=ROOT debug=0/
 --

 !-- Tomcat Manager Context --
 Context path=/manager docBase=manager
  debug=0 privileged=true/

 !-- Security Test --
  Context path=/stewart docBase=stewart debug=0
   reloadable=true crossContext=true
Logger className=org.apache.catalina.logger.FileLogger
   prefix=localhost_examples_log. suffix=.txt
 timestamp=true/
   Manager className
 =org.apache.catalina.session.PersistentManager
   debug=0
   saveOnRestart=true
   maxActiveSessions=-1
   minIdleSwap=-1
   maxIdleSwap=-1
   maxIdleBackup=-1
 Store className=org.apache.catalina.session.FileStore/
   /Manager
 /Context
 !-- Test JDBC to MySql --
 Context path=/DBTest docBase=DBTest
 debug=5 reloadable=true crossContext=true

   Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_DBTest_log. suffix=.txt
  timestamp=true/

   Resource name=jdbc/TestDB
auth=Container
type=javax.sql.DataSource/
   ResourceParams name=jdbc/TestDB
 parameter
   namefactory/name

 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
 parameter
   namemaxActive/name
   value100/value
 /parameter
 parameter
   namemaxIdle/name
   value3/value
 /parameter
 parameter
   namemaxWait/name
   value100/value
 /parameter
 parameter
  nameusername/name
  valuejavauser/value
 /parameter
 parameter
  namepassword/name
  valuejavadude/value
 /parameter
 parameter
namedriverClassName/name
  !-- valueorg.gjt.mm.mysql.Driver/value--
 !-- value
 com.mysql.jdbc.jdbc2.optional.MysqlDataSource/value--
valuecom.mysql.jdbc.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:mysql://localhost:3306

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread stevem


Thanks, Vance.  Actually, the parameter above that is driverClassName
the one you are looking at use to be url, but in some server.xml files
the second parameter is driverName instead of url.

If you look at the 4.0 JNDI how-to it uses the driverName parameter below
driverClassName; however, in the 4.1 JNDI how-to it used url after the
driverClassName.  Maybe the 4.0 how-to has an error in it.

I found the bug, I think, after I uninstalled 4.0.4 and install 4.1.9.  My
closing tag was /content instead of /context.  For some reason 4.0.4
did not complain about it (or else I missed the message).

Now, I have another learning issue with the 4.1.9 manager.  I'll cover that
in a new thread.



   
   Vance  
   Christiaanse   
   [EMAIL PROTECTED]   To 
   com  Tomcat Users List   
 [EMAIL PROTECTED]  
   08/30/2002 02:34 cc 
   PM  
   Subject 
 Re: Trouble configuring Tomcat 4.0.4  
   Please respond to JNDI connection to MySQL  
 Tomcat Users 
 List 
   tomcat-user@jakar  
 ta.apache.org
   
   




You need to set driverClassName to the proper value,
com.mysql.jdbc.Driver, not driverName.

- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Cc: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, August 30, 2002 12:20 PM
Subject: Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL



 Martin's advice made a difference.  When I pulled in the tc 4.1
common/lib
 jars to my tc 4.04 common/lib I got past my problem for the first time.
 The new contents of common/lib are: activation.jar,
 commons-collections.jar, commons-dbcp.jar, commons-pool.jar,
 jdbc2_0-stdext.jar, jndi.jar, jta-spec1_0_1.jar, mail.jar,
 mysql-connector-java-2.0.14-bin.jar, naming-common.jar,
naming-factory.jar,
 naming-resources.jar, servlet.jar, tools.jar, xerces.jar.

 Now I have a new problem which hopefully is easy to correct:

 java.sql.SQLException: Cannot load JDBC driver class 'null'
  at

org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav

a:529)
  at

org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3

12)
  at foo.DBTest.init(DBTest.java:32)

 I've tried setting driverName to  com.mysql.jdbc.Driver,
 org.gjt.mm.mysql.Driver, and even to
 com.mysql.jdbc.jdbc2.optional.MysqlDataSource. I also tried adding
 Class.forName(...).newInstance() to my code, but it was no help either.

 Here is my code:
 Class.forName(com.mysql.jdbc.Driver).newInstance();
 Context ctx = new InitialContext();
   ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
org.apache.naming.factory.DbcpDataSourceFactory);
 //com.sun.jndi.fscontext.RefFSContextFactory);
   if(ctx == null )throw new Exception(Boom - No Context);
   DataSource ds = (DataSource)ctx.lookup
(java:comp/env/jdbc/TestDB);
   if (ds != null) {
 Connection conn = ds.getConnection();   ---
Blows
 up here

 Here is my host/context:
 ...
 Host name=localhost debug=0 appBase=webapps unpackWARs=true
 Valve className=org.apache.catalina.valves.AccessLogValve
  directory=logs  prefix=localhost_access_log. suffix
 =.txt
  pattern=common/
 Logger className=org.apache.catalina.logger.FileLogger
  directory=logs  prefix=localhost_log. suffix=.txt
  timestamp=true/
 !-- Tomcat Root Context --
 !--
   Context path= docBase=ROOT debug=0/
 --

 !-- Tomcat Manager Context --
 Context path=/manager docBase=manager
  debug=0 privileged=true/

 !-- Security Test --
  Context path=/stewart docBase=stewart debug=0
   reloadable=true crossContext=true
Logger className=org.apache.catalina.logger.FileLogger
   prefix=localhost_examples_log. suffix=.txt
 timestamp=true/
   Manager className
 =org.apache.catalina.session.PersistentManager
   debug=0

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL ***PROBLEMSOLVED***

2002-08-30 Thread stevem


Thank you to everyone who helped with this.  I am now able to use a JNDI
MySQL DataSource.

The last problem I had, after moving to 4.1.9, was caused by a typo in my
closing /Context tag.

I do not know if that was the problem all along with 4.0.4.




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




Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-29 Thread stevem

After reading something in another post this morning I realized I was
mixing instructions from the 4.1 JNDI How-to.  I've reposted this message
with updated information after making sure I was ONLY following the 4.0
JNDI How to.

I have deleted my server.xml and started with a fresh copy.  First, I made
sure I could connect to MySQL with a regular JDBC connection.  Next, I
added a JDBC Realm using MySQL.  That works fine.  Finally, I added a JDBC
resource and tried to use it.  That is when I get the error below.

The error I have, and have always had, even before the 4.1 detour, is the
following:

javax.naming.NamingException: Exception creating DataSource:
org.hsql.jdbcDriver
 at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
 at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
 at javax.naming.InitialContext.lookup(InitialContext.java:351)
 at foo.DBTest1.init(DBTest1.java:19)
 at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)

Why would Tomcat be looking for a Hypersonic SQL driver?  I took a shot and
copied Hypersonic 1.61 hsqldb.jar to /common/lib, but when it had no effect
I removed it.

I'm currently running
Windows 2000
J2SE 1.4.0
J2SE 1.3.1
Tomcat 4.04
MySQL 4.0.2-Alpha
MySQL Connector 2.0.14. (I copied mysql-connector-java-2.0.14-bin.jar to
$TOMCAT_HOME/common/lib,)

I get the same error no matter what code I run.  For example, Both code
blocks below result in the same error:
 Context ctx = new InitialContext();
 ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
  com.sun.jndi.fscontext.RefFSContextFactory);
 Connection conn = ds.getConnection();
 if(ctx == null )
  throw new Exception(Boom - No Context);
 DataSource ds = (DataSource)ctx.lookup(
  java:comp/env/jdbc/TestDB);   -- Blows up here
--- AND ---
  Context initCtx = new InitialContext();
  Context envCtx = (Context) initCtx.lookup(java:comp/env);
  if(envCtx == null )
  throw new Exception(Boom - No Context);
  DataSource ds =
  (DataSource)envCtx.lookup(jdbc/TestDB);  --- Blows up here

I added the following to the web.xml file:
resource-ref id=ResourceRef_TestDB
  descriptionDB Connection/description
 res-ref-namejdbc/TestDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainer/res-auth
/resource-ref

Here is my server.xml file:

Server port=8005 shutdown=SHUTDOWN debug=0
  Service name=Tomcat-Standalone
!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --
Connector className=org.apache.catalina.connector.http.HttpConnector
   port=8080 minProcessors=5 maxProcessors=75
   enableLookups=true redirectPort=8443
   acceptCount=10 debug=0 connectionTimeout=6/
!-- Define the top level container in our container hierarchy --
Engine name=Standalone defaultHost=localhost debug=0
  !-- Global logger unless overridden at lower levels --
  Logger className=org.apache.catalina.logger.FileLogger
  prefix=catalina_log. suffix=.txt
  timestamp=true/
  Realm  className=org.apache.catalina.realm.JDBCRealm debug=99
 driverName=org.gjt.mm.mysql.Driver
  connectionURL
=jdbc:mysql://localhost/authority?user=javauser;password=javadude
  userTable=users userNameCol=user_name userCredCol
=user_pass
  userRoleTable=user_roles roleNameCol=role_name /
  !-- Define the default virtual host --
  Host name=localhost debug=0 appBase=webapps unpackWARs=true
Valve className=org.apache.catalina.valves.AccessLogValve
 directory=logs  prefix=localhost_access_log. suffix
=.txt
 pattern=common/
Logger className=org.apache.catalina.logger.FileLogger
 directory=logs  prefix=localhost_log. suffix=.txt
 timestamp=true/
!-- Tomcat Root Context --
!--
  Context path= docBase=ROOT debug=0/
--

!-- Tomcat Manager Context --
Context path=/manager docBase=manager
 debug=0 privileged=true/

!-- Security Test --
 Context path=/stewart docBase=stewart debug=0
  reloadable=true crossContext=true
   Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_examples_log. suffix=.txt
timestamp=true/
  Manager className

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-29 Thread Vance Christiaanse

Steve,

I'm stuck in a similar situation. Here's one thing I noticed about your
server.xml file:

The 4.1 JNDI How-to uses a parameter name of url for the URL but the 4.0
JNDI How-to uses a parameter name of driverName for the URL.

Your server.xml file is using url for the parameter name but you're trying
to use 4.0.

I don't know if this is significant or not.

Vance

- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, August 29, 2002 10:31 AM
Subject: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL


 After reading something in another post this morning I realized I was
 mixing instructions from the 4.1 JNDI How-to.  I've reposted this message
 with updated information after making sure I was ONLY following the 4.0
 JNDI How to.

 I have deleted my server.xml and started with a fresh copy.  First, I made
 sure I could connect to MySQL with a regular JDBC connection.  Next, I
 added a JDBC Realm using MySQL.  That works fine.  Finally, I added a JDBC
 resource and tried to use it.  That is when I get the error below.

 The error I have, and have always had, even before the 4.1 detour, is the
 following:

 javax.naming.NamingException: Exception creating DataSource:
 org.hsql.jdbcDriver
  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
  at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
  at javax.naming.InitialContext.lookup(InitialContext.java:351)
  at foo.DBTest1.init(DBTest1.java:19)
  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)

 Why would Tomcat be looking for a Hypersonic SQL driver?  I took a shot
and
 copied Hypersonic 1.61 hsqldb.jar to /common/lib, but when it had no
effect
 I removed it.

 I'm currently running
 Windows 2000
 J2SE 1.4.0
 J2SE 1.3.1
 Tomcat 4.04
 MySQL 4.0.2-Alpha
 MySQL Connector 2.0.14. (I copied mysql-connector-java-2.0.14-bin.jar to
 $TOMCAT_HOME/common/lib,)

 I get the same error no matter what code I run.  For example, Both code
 blocks below result in the same error:
  Context ctx = new InitialContext();
  ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
   com.sun.jndi.fscontext.RefFSContextFactory);
  Connection conn = ds.getConnection();
  if(ctx == null )
   throw new Exception(Boom - No Context);
  DataSource ds = (DataSource)ctx.lookup(
   java:comp/env/jdbc/TestDB);   -- Blows up here
 --- AND ---
   Context initCtx = new InitialContext();
   Context envCtx = (Context) initCtx.lookup(java:comp/env);
   if(envCtx == null )
   throw new Exception(Boom - No Context);
   DataSource ds =
   (DataSource)envCtx.lookup(jdbc/TestDB);  --- Blows up here

 I added the following to the web.xml file:
 resource-ref id=ResourceRef_TestDB
   descriptionDB Connection/description
  res-ref-namejdbc/TestDB/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
 /resource-ref

 Here is my server.xml file:

 Server port=8005 shutdown=SHUTDOWN debug=0
   Service name=Tomcat-Standalone
 !-- Define a non-SSL HTTP/1.1 Connector on port 8080 --
 Connector
className=org.apache.catalina.connector.http.HttpConnector
port=8080 minProcessors=5 maxProcessors=75
enableLookups=true redirectPort=8443
acceptCount=10 debug=0 connectionTimeout=6/
 !-- Define the top level container in our container hierarchy --
 Engine name=Standalone defaultHost=localhost debug=0
   !-- Global logger unless overridden at lower levels --
   Logger className=org.apache.catalina.logger.FileLogger
   prefix=catalina_log. suffix=.txt
   timestamp=true/
   Realm  className=org.apache.catalina.realm.JDBCRealm debug=99
  driverName=org.gjt.mm.mysql.Driver
   connectionURL
 =jdbc:mysql://localhost/authority?user=javauser;password=javadude
   userTable=users userNameCol=user_name userCredCol
 =user_pass
   userRoleTable=user_roles roleNameCol=role_name /
   !-- Define the default virtual host --
   Host name=localhost debug=0 appBase=webapps
unpackWARs=true
 Valve className=org.apache.catalina.valves.AccessLogValve
  directory=logs  prefix=localhost_access_log. suffix
 =.txt
  pattern=common/
 Logger className=org.apache.catalina.logger.FileLogger

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-29 Thread stevem


Vance,

Good eye.  It use to be driverName but got changed along the way to URL.
Probably when I started following the 4.1 how-to.  In any case, I changed
back to driverName and, alas, same problem.

Vance, do you get the same error?

javax.naming.NamingException: Exception creating DataSource:
org.hsql.jdbcDriver
 at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
 at foo.DBTest1.init(DBTest1.java:20)
 at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)




   
   Vance  
   Christiaanse   
   [EMAIL PROTECTED]   To 
   com  Tomcat Users List   
 [EMAIL PROTECTED]  
   08/29/2002 11:16 cc 
   AM  
   Subject 
 Re: Trouble configuring Tomcat 4.0.4  
   Please respond to JNDI connection to MySQL  
 Tomcat Users 
 List 
   tomcat-user@jakar  
 ta.apache.org
   
   




Steve,

I'm stuck in a similar situation. Here's one thing I noticed about your
server.xml file:

The 4.1 JNDI How-to uses a parameter name of url for the URL but the 4.0
JNDI How-to uses a parameter name of driverName for the URL.

Your server.xml file is using url for the parameter name but you're
trying
to use 4.0.

I don't know if this is significant or not.

Vance

- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, August 29, 2002 10:31 AM
Subject: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL


 After reading something in another post this morning I realized I was
 mixing instructions from the 4.1 JNDI How-to.  I've reposted this message
 with updated information after making sure I was ONLY following the 4.0
 JNDI How to.

 I have deleted my server.xml and started with a fresh copy.  First, I
made
 sure I could connect to MySQL with a regular JDBC connection.  Next, I
 added a JDBC Realm using MySQL.  That works fine.  Finally, I added a
JDBC
 resource and tried to use it.  That is when I get the error below.

 The error I have, and have always had, even before the 4.1 detour, is the
 following:

 javax.naming.NamingException: Exception creating DataSource:
 org.hsql.jdbcDriver
  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
  at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
  at javax.naming.InitialContext.lookup(InitialContext.java:351)
  at foo.DBTest1.init(DBTest1.java:19)
  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)

 Why would Tomcat be looking for a Hypersonic SQL driver?  I took a shot
and
 copied Hypersonic 1.61 hsqldb.jar to /common/lib, but when it had no
effect
 I removed it.

 I'm currently running
 Windows 2000
 J2SE 1.4.0
 J2SE 1.3.1
 Tomcat 4.04
 MySQL 4.0.2-Alpha
 MySQL Connector 2.0.14. (I copied mysql-connector-java-2.0.14-bin.jar to
 $TOMCAT_HOME/common/lib,)

 I get the same error no matter what code I run.  For example, Both code
 blocks below result in the same error:
  Context ctx = new InitialContext();
  ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
   com.sun.jndi.fscontext.RefFSContextFactory);
  Connection conn = ds.getConnection();
  if(ctx == null )
   throw new Exception(Boom - No Context);
  DataSource ds = (DataSource)ctx.lookup(
   java:comp/env/jdbc/TestDB);   -- Blows up here
 --- AND ---
   Context initCtx = new

Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-11 Thread peter . catania

hello Przemyslaw, les,

On Wed, 03 Jul 2002 05:11:44 -0700 , Przemyslaw wrote:
On Tuesday 02 July 2002 16:27, Les Hughes wrote:
 Ok. Summary time.

 Martin reflects my experience - I dumped tyrex and used DBCP as well. But
 aren't we trying to go direct without a pool? Having said that I've only
 ever managed to get datasources working when DBCP is being used...

 Check that your driver jarfile does not contain the javax.sql extension
 classes. If it does, delete them and rejar. Some versions of Tomcat will
 ignore any jar that has these classes present. Be careful with this
thought
 - I work with jdk1.4 which has these built in.

 Also, you don't specify a DataSourceFactory in your server.xml - see
below.


 Here's a known (well as far as I know...) good postgres solution using
 DBCP.

And that's the path I'll follow. Despite huge support from the list (I
applied 
all suggested changes and patches) I was unable to make it work. Now I will

try to understand the new model of DBCP.

Thank you all for your support.

przem

i checked your idea to use DBCP and it is working, but i was not
willing to give up on the problem.

so i entered exactly the same jndi url as read on your example
and voila no problem. so it seems we are not read the complete
naming conventions or did not understand the doc. i could not
find a hint what you have to type:

 java:comp/env/jdbc/Database instead of jdbc/Database.
  
^
so for now it's solved and i went back to find out what
is better with DBCP.

BTW: i changed server.xml and global web.xml !!

best reagrds
 peter ;-)

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




tomcat 4.0.4, JNDI, Datasource.getConnection() - No suitable driver,[Oracle]

2002-07-05 Thread Pedro Salazar

Greetings,

I'm moving a webservice from tomcat 4.1.2 (WSDP 1.0) -- tomcat 4.0.4
because I want to go to production environment and instead of using the
tomcat bundled with WebServiceDevelopmentPack 1.0 (WSDP 1.0), I want to
use a conventional/isolated tomcat. I choose the tomcat 4.0.4 (latest
stable version).

I added a default context in tomcat isolated service section on
conf/server.xml with my jdbc resources, and I deploy my oracle driver
package in common/lib/ directory (renamed as a jar file).

PROBLEM:
--
I'm having problems using a connection manager from JNDI! I'm
getting an exception java.sql.SQLException: No suitable driver when I
try to get a connection from datasource:

ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/crumpetdb);
ds.getConnection(); //EXCEPTION!!


It appears that tomcat 4.0.4 uses tyrex connection manager
(tyrex-0.9.7.0.jar). What is connection manager of tomcat 4.1.2 (WSDP
1.0)? I tried the tyrex's latest version (1.0), but still have the same
problem. In tomcat 4.1.2 I didn't have this problem!

Please, anyone figures what is my problem?

PS. By the way, how to insert a zip file with classes to a tomcat's lib
directory but without renaming it to a jar file? What should I change in
catalina startup script?

thanks,
Pedro Salazar





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




RE: tomcat 4.0.4, JNDI, Datasource.getConnection() - No suitable driver, [Oracle]

2002-07-05 Thread Andrew Conrad

Tomcat 4.1.2 uses the Commons-dbcp connection pool.  You can download it
at 

http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-dbcp/

It does not have a release build yet.


-Andrew

-Original Message-
From: Pedro Salazar [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 05, 2002 7:00 AM
To: [EMAIL PROTECTED]
Subject: tomcat 4.0.4, JNDI, Datasource.getConnection() - No suitable
driver, [Oracle]


Greetings,

I'm moving a webservice from tomcat 4.1.2 (WSDP 1.0) -- tomcat 4.0.4
because I want to go to production environment and instead of using the
tomcat bundled with WebServiceDevelopmentPack 1.0 (WSDP 1.0), I want to
use a conventional/isolated tomcat. I choose the tomcat 4.0.4 (latest
stable version).

I added a default context in tomcat isolated service section on
conf/server.xml with my jdbc resources, and I deploy my oracle driver
package in common/lib/ directory (renamed as a jar file).

PROBLEM:
--
I'm having problems using a connection manager from JNDI! I'm getting an
exception java.sql.SQLException: No suitable driver when I try to get
a connection from datasource:

ds = (DataSource)initCtx.lookup(java:comp/env/jdbc/crumpetdb);
ds.getConnection(); //EXCEPTION!!


It appears that tomcat 4.0.4 uses tyrex connection manager
(tyrex-0.9.7.0.jar). What is connection manager of tomcat 4.1.2 (WSDP
1.0)? I tried the tyrex's latest version (1.0), but still have the same
problem. In tomcat 4.1.2 I didn't have this problem!

Please, anyone figures what is my problem?

PS. By the way, how to insert a zip file with classes to a tomcat's lib
directory but without renaming it to a jar file? What should I change in
catalina startup script?

thanks,
Pedro Salazar





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


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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-04 Thread Les Hughes


The model is very simple and as a coder you never see that DBCP is there
instead of Tyrex or a direct connection.

Let me know how you get on an I'll patch the documentation accordingly. Also
I noticed that my howto has made it into CVS (thanks guys!) so if you grab a
nightly build (probably tomorrow now) then you can follow those
instructions.

Good luck!

Les



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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-03 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 16:27, Les Hughes wrote:
 Ok. Summary time.

 Martin reflects my experience - I dumped tyrex and used DBCP as well. But
 aren't we trying to go direct without a pool? Having said that I've only
 ever managed to get datasources working when DBCP is being used...

 Check that your driver jarfile does not contain the javax.sql extension
 classes. If it does, delete them and rejar. Some versions of Tomcat will
 ignore any jar that has these classes present. Be careful with this thought
 - I work with jdk1.4 which has these built in.

 Also, you don't specify a DataSourceFactory in your server.xml - see below.


 Here's a known (well as far as I know...) good postgres solution using
 DBCP.

And that's the path I'll follow. Despite huge support from the list (I applied 
all suggested changes and patches) I was unable to make it work. Now I will 
try to understand the new model of DBCP.

Thank you all for your support.

przem


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




Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

Hi

I've just started to write servlets. Servlets that only do processing, without 
connecting to database work fine, but I have some problems to get the 
connection with postgresql via jdbc work.

Tomcat: 4.0.4   (on linux)
Postgresql: 7.2.1 (on linux)
Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)

The servlet is quite simple:

import java.io.*;
import java.util.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class InfoServlet extends HttpServlet {

Connection con;
private boolean conFree = true;

public void init() throws ServletException {
try  {
Context initCtx = new InitialContext();
Context envCtx = 
(Context)initCtx.lookup(java:comp/env);
DataSource ds = (DataSource)
envCtx.lookup(jdbc/BookDB);
Connection con = ds.getConnection();
} catch (Exception ex) {
throw new ServletException(Couldn't open connection 
to database:  + ex.getMessage());
}
}

public void destroy() {
try {
con.close();
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}

public void doGet (HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {

HttpSession session = request.getSession();

// set content-type header before accessing the Writer
response.setContentType(text/html);
response.setBufferSize(8192);
PrintWriter out = response.getWriter();

// then write the data of the response
out.println(html +
headtitleDuke's Bookstore/title/head);
}
}

in web/WEB-INF/web.xml I defined:


!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
display-nameCurrency Converter Application/display-name
description
Test servlet
/description
servlet
servlet-nameinfo/servlet-name
display-nameinfo/display-name
descriptionno description/description
servlet-classInfoServlet/servlet-class
/servlet
servlet-mapping
servlet-nameinfo/servlet-name
url-pattern/info/url-pattern
/servlet-mapping
session-config
session-timeout30/session-timeout
/session-config
resource-ref
res-ref-namejdbc/BookDB/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainter/res-auth
/resource-ref
/web-app

And in server.xml in the contex of the application:

   Context path=/bookstore docBase=bookstore debug=0
 reloadable=true crossContext=true
  Logger className=org.apache.catalina.logger.FileLogger
 prefix=localhost_bookstore_log. suffix=.txt
  timestamp=true/
  Resource name=jdbc/BookDB auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/BookDB
parameter
  nameuser/name
  valuejava/value
/parameter
parameter
  namepassword/name
  valuejava/value
/parameter
parameter
  namedriverClassName/name
  valueorg.postgresql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:postgresql:public/value
/parameter
  /ResourceParams
/Context

I've tried a few different driverName parameters: (restarting Tomcat after 
each change)
jdbc:postgresql://localhost/public
jdbc:postgresql://full.server.name/public
jdbc:postgresql:public
jdbc:postgresql://localhost/

But, despite the parameters, I always get the following error:

exception 
javax.servlet.ServletException: Couldn't open connection to database: 
Exception creating DataSource: org.hsql.jdbcDriver
at InfoServlet.init(Unknown Source)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)


{cut}

I have no idea why Tomcat wants to connect using hsql driver. I grepped 
through tomcat directory and found only one reference to this driver (in 
examples section). I removed event the sample section, restarted Tomcat but 
it didn't help. 

Does anyone know what is wrong? 

regards
Przem


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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Two things,

In your server.xml
user I think should be username
and
driverName has been deprecated in favour of url which needs the servername
and DB name as well
(as in something like jdbc:postgresql://full.server.name/mybookdb - or
whatever the DB is called)

Are you *sure* you're using the right install of TC and that the server.xml
has no reference to the hsql driver?

BTW - only got this working with Oracle and mySQL so most of this is
guesswork based on those two exercises. 

Bye,

Les
P.S. You shouldn't open the connection in init() nor cache the connection
BTW - use a pool instead :)

 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 11:09
 To: 'Tomcat Users List'
 Subject: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 Hi
 
 I've just started to write servlets. Servlets that only do 
 processing, without 
 connecting to database work fine, but I have some problems to get the 
 connection with postgresql via jdbc work.
 
 Tomcat: 4.0.4 (on linux)
 Postgresql: 7.2.1 (on linux)
 Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)
 
 The servlet is quite simple:
 
 import java.io.*;
 import java.util.*;
 import java.sql.*;
 import javax.sql.*;
 import javax.naming.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 
 public class InfoServlet extends HttpServlet {
 
 Connection con;
 private boolean conFree = true;
 
 public void init() throws ServletException {
 try  {
 Context initCtx = new InitialContext();
 Context envCtx = 
 (Context)initCtx.lookup(java:comp/env);
 DataSource ds = (DataSource)
 envCtx.lookup(jdbc/BookDB);
 Connection con = ds.getConnection();
 } catch (Exception ex) {
 throw new ServletException(Couldn't 
 open connection 
 to database:  + ex.getMessage());
 }
 }
 
 public void destroy() {
 try {
 con.close();
 } catch (SQLException ex) {
 System.out.println(ex.getMessage());
 }
 }
 
 public void doGet (HttpServletRequest request, 
 HttpServletResponse 
 response) throws ServletException, IOException {
 
 HttpSession session = request.getSession();
 
 // set content-type header before accessing the Writer
 response.setContentType(text/html);
 response.setBufferSize(8192);
 PrintWriter out = response.getWriter();
 
 // then write the data of the response
 out.println(html +
 headtitleDuke's Bookstore/title/head);
 }
 }
 
 in web/WEB-INF/web.xml I defined:
 
 
 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;
 web-app
 display-nameCurrency Converter Application/display-name
 description
 Test servlet
 /description
 servlet
 servlet-nameinfo/servlet-name
 display-nameinfo/display-name
 descriptionno description/description
 servlet-classInfoServlet/servlet-class
 /servlet
 servlet-mapping
 servlet-nameinfo/servlet-name
 url-pattern/info/url-pattern
 /servlet-mapping
 session-config
 session-timeout30/session-timeout
 /session-config
 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref
 /web-app
 
 And in server.xml in the contex of the application:
 
Context path=/bookstore docBase=bookstore debug=0
  reloadable=true crossContext=true
   Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_bookstore_log. suffix=.txt
   timestamp=true/
   Resource name=jdbc/BookDB auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/BookDB
 parameter
   nameuser/name
   valuejava/value
 /parameter
 parameter
   namepassword/name
   valuejava/value
 /parameter
 parameter
   namedriverClassName/name
   valueorg.postgresql.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:postgresql:public/value
 /parameter
   /ResourceParams
 /Context
 
 I've tried a few different driverName parameters: (restarting 
 Tomcat after 
 each change)
 jdbc:postgresql://localhost/public
 jdbc:postgresql

Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 14:00, Les Hughes wrote:
 Two things,

 In your server.xml
 user I think should be username
 and
 driverName has been deprecated in favour of url which needs the servername
 and DB name as well
 (as in something like jdbc:postgresql://full.server.name/mybookdb - or
 whatever the DB is called)

Ok. Now my configuration file looks as follows:

Context path=/bookstore1 docBase=bookstore1 debug=0
 reloadable=true crossContext=true
  Logger className=org.apache.catalina.logger.FileLogger
 prefix=localhost_bookstore1_log. suffix=.txt
  timestamp=true/
  Resource name=jdbc/BookDB auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/BookDB
parameter
 nameusername/name
  valuejava/value
/parameter
parameter
  namepassword/name
  valuejava/value
/parameter
parameter
  namedriverClassName/name
  valueorg.postgresql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:postgresql://willow.forest/public/value
/parameter
  /ResourceParams
/Context


 Are you *sure* you're using the right install of TC and that the server.xml
 has no reference to the hsql driver?

I'm absolutely sure. I even reinstalled whole tomcat (to cleanup everything)

 BTW - only got this working with Oracle and mySQL so most of this is
 guesswork based on those two exercises.

 Bye,

 Les
 P.S. You shouldn't open the connection in init() nor cache the connection
 BTW - use a pool instead :)

For sure I will, but now all that I want is to connect my servlet to database.

regards
przem

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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread andre . powroznik

Would you have other applications running in tomcat?

-Original Message-
From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
Sent: 02 July 2002 14:54
To: Tomcat Users List
Subject: Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]


On Tuesday 02 July 2002 14:00, Les Hughes wrote:
 Two things,

 In your server.xml
 user I think should be username
 and
 driverName has been deprecated in favour of url which needs the servername
 and DB name as well
 (as in something like jdbc:postgresql://full.server.name/mybookdb - or
 whatever the DB is called)

Ok. Now my configuration file looks as follows:

Context path=/bookstore1 docBase=bookstore1 debug=0
 reloadable=true crossContext=true
  Logger className=org.apache.catalina.logger.FileLogger
 prefix=localhost_bookstore1_log. suffix=.txt
  timestamp=true/
  Resource name=jdbc/BookDB auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/BookDB
parameter
 nameusername/name
  valuejava/value
/parameter
parameter
  namepassword/name
  valuejava/value
/parameter
parameter
  namedriverClassName/name
  valueorg.postgresql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:postgresql://willow.forest/public/value
/parameter
  /ResourceParams
/Context


 Are you *sure* you're using the right install of TC and that the server.xml
 has no reference to the hsql driver?

I'm absolutely sure. I even reinstalled whole tomcat (to cleanup everything)

 BTW - only got this working with Oracle and mySQL so most of this is
 guesswork based on those two exercises.

 Bye,

 Les
 P.S. You shouldn't open the connection in init() nor cache the connection
 BTW - use a pool instead :)

For sure I will, but now all that I want is to connect my servlet to database.

regards
przem

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

 DISCLAIMER  
This e-mail and any attachments thereto may contain information 
which is confidential and/or protected by intellectual property 
rights and are intended for the sole use of the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, 
total or partial reproduction, communication or distribution in any form) 
by persons other than the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either 
by telephone or by e-mail and delete the material from any computer. 
Thank you for your cooperation.


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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 14:53, Przemyslaw Kowalczyk wrote:

I came to another conclusion. Even if there was some reference to hsql driver 
in my server.xml it shouldn't affect my own servlet, as it uses its own 
context. Am I right?

przem


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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread andre . powroznik

Is this normal :

  resource-ref
res-ref-namejdbc/BookDB/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainter/res-auth
/resource-ref

More especially : res-authContainter/res-auth : CONTAINTER?

Andre Powroznik

-Original Message-
From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
Sent: 02 July 2002 12:09
To: 'Tomcat Users List'
Subject: Tomcat 4.0.4, jndi, jdbc and postgresql [long]


Hi

I've just started to write servlets. Servlets that only do processing, without 
connecting to database work fine, but I have some problems to get the 
connection with postgresql via jdbc work.

Tomcat: 4.0.4   (on linux)
Postgresql: 7.2.1 (on linux)
Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)

The servlet is quite simple:

import java.io.*;
import java.util.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class InfoServlet extends HttpServlet {

Connection con;
private boolean conFree = true;

public void init() throws ServletException {
try  {
Context initCtx = new InitialContext();
Context envCtx = 
(Context)initCtx.lookup(java:comp/env);
DataSource ds = (DataSource)
envCtx.lookup(jdbc/BookDB);
Connection con = ds.getConnection();
} catch (Exception ex) {
throw new ServletException(Couldn't open connection 
to database:  + ex.getMessage());
}
}

public void destroy() {
try {
con.close();
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}

public void doGet (HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {

HttpSession session = request.getSession();

// set content-type header before accessing the Writer
response.setContentType(text/html);
response.setBufferSize(8192);
PrintWriter out = response.getWriter();

// then write the data of the response
out.println(html +
headtitleDuke's Bookstore/title/head);
}
}

in web/WEB-INF/web.xml I defined:


!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
display-nameCurrency Converter Application/display-name
description
Test servlet
/description
servlet
servlet-nameinfo/servlet-name
display-nameinfo/display-name
descriptionno description/description
servlet-classInfoServlet/servlet-class
/servlet
servlet-mapping
servlet-nameinfo/servlet-name
url-pattern/info/url-pattern
/servlet-mapping
session-config
session-timeout30/session-timeout
/session-config
resource-ref
res-ref-namejdbc/BookDB/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainter/res-auth
/resource-ref
/web-app

And in server.xml in the contex of the application:

   Context path=/bookstore docBase=bookstore debug=0
 reloadable=true crossContext=true
  Logger className=org.apache.catalina.logger.FileLogger
 prefix=localhost_bookstore_log. suffix=.txt
  timestamp=true/
  Resource name=jdbc/BookDB auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/BookDB
parameter
  nameuser/name
  valuejava/value
/parameter
parameter
  namepassword/name
  valuejava/value
/parameter
parameter
  namedriverClassName/name
  valueorg.postgresql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:postgresql:public/value
/parameter
  /ResourceParams
/Context

I've tried a few different driverName parameters: (restarting Tomcat after 
each change)
jdbc:postgresql://localhost/public
jdbc:postgresql://full.server.name/public
jdbc:postgresql:public
jdbc:postgresql://localhost/

But, despite the parameters, I always get the following error:

exception 
javax.servlet.ServletException: Couldn't open connection to database: 
Exception creating DataSource: org.hsql.jdbcDriver
at InfoServlet.init(Unknown Source)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at 
org.apache.catalina.core.StandardWrapper.loadServlet

RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Yep :-)

Oh, I think there's a typo in the URL - remove the two // - this is all
driver specific so it's a case of RTM :-)

 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:00
 To: Tomcat Users List
 Subject: Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 On Tuesday 02 July 2002 14:53, Przemyslaw Kowalczyk wrote:
 
 I came to another conclusion. Even if there was some 
 reference to hsql driver 
 in my server.xml it shouldn't affect my own servlet, as it 
 uses its own 
 context. Am I right?
 
 przem
 
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 

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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes

web-app  
  resource-ref
  descriptionDB Connection/description
  res-ref-namejdbc/TestDB/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  /resource-ref
/web-app

The description is missing (but I dont have a DTD to had to tell whether
this is optional) but other than that it's fine.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:00
 To: [EMAIL PROTECTED]
 Subject: RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 Is this normal :
 
 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref
 
 More especially : res-authContainter/res-auth : CONTAINTER?
 
 Andre Powroznik
 
 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 12:09
 To: 'Tomcat Users List'
 Subject: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 Hi
 
 I've just started to write servlets. Servlets that only do 
 processing, without 
 connecting to database work fine, but I have some problems to get the 
 connection with postgresql via jdbc work.
 
 Tomcat: 4.0.4 (on linux)
 Postgresql: 7.2.1 (on linux)
 Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)
 
 The servlet is quite simple:
 
 import java.io.*;
 import java.util.*;
 import java.sql.*;
 import javax.sql.*;
 import javax.naming.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 
 public class InfoServlet extends HttpServlet {
 
 Connection con;
 private boolean conFree = true;
 
 public void init() throws ServletException {
 try  {
 Context initCtx = new InitialContext();
 Context envCtx = 
 (Context)initCtx.lookup(java:comp/env);
 DataSource ds = (DataSource)
 envCtx.lookup(jdbc/BookDB);
 Connection con = ds.getConnection();
 } catch (Exception ex) {
 throw new ServletException(Couldn't 
 open connection 
 to database:  + ex.getMessage());
 }
 }
 
 public void destroy() {
 try {
 con.close();
 } catch (SQLException ex) {
 System.out.println(ex.getMessage());
 }
 }
 
 public void doGet (HttpServletRequest request, 
 HttpServletResponse 
 response) throws ServletException, IOException {
 
 HttpSession session = request.getSession();
 
 // set content-type header before accessing the Writer
 response.setContentType(text/html);
 response.setBufferSize(8192);
 PrintWriter out = response.getWriter();
 
 // then write the data of the response
 out.println(html +
 headtitleDuke's Bookstore/title/head);
 }
 }
 
 in web/WEB-INF/web.xml I defined:
 
 
 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;
 web-app
 display-nameCurrency Converter Application/display-name
 description
 Test servlet
 /description
 servlet
 servlet-nameinfo/servlet-name
 display-nameinfo/display-name
 descriptionno description/description
 servlet-classInfoServlet/servlet-class
 /servlet
 servlet-mapping
 servlet-nameinfo/servlet-name
 url-pattern/info/url-pattern
 /servlet-mapping
 session-config
 session-timeout30/session-timeout
 /session-config
 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref
 /web-app
 
 And in server.xml in the contex of the application:
 
Context path=/bookstore docBase=bookstore debug=0
  reloadable=true crossContext=true
   Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_bookstore_log. suffix=.txt
   timestamp=true/
   Resource name=jdbc/BookDB auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/BookDB
 parameter
   nameuser/name
   valuejava/value
 /parameter
 parameter
   namepassword/name
   valuejava/value
 /parameter
 parameter
   namedriverClassName/name
   valueorg.postgresql.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:postgresql:public/value

Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 14:56, [EMAIL PROTECTED] wrote:
 Would you have other applications running in tomcat?

No, I've just started to learn, so there are other apps.

przem


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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 15:00, [EMAIL PROTECTED] wrote:
 Is this normal :

 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref

 More especially : res-authContainter/res-auth : CONTAINTER?


You are right, there is a misseling, but correcting it didn't help much :-(

I'm still curious why tomcat wants a hsql driver even though it's not 
mentioned in any configuration file.

przem




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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Ignore the remove // comment - I was looking at my oracle notes :-)
I really have no idea why it's trying to load the hsql driver if there's no
ref in your
server.xml

Post your server.xml and web.xml and we'll both have a look.



 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:13
 To: Tomcat Users List
 Subject: Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 On Tuesday 02 July 2002 15:00, [EMAIL PROTECTED] wrote:
  Is this normal :
 
resource-ref
  res-ref-namejdbc/BookDB/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainter/res-auth
  /resource-ref
 
  More especially : res-authContainter/res-auth : CONTAINTER?
 
 
 You are right, there is a misseling, but correcting it didn't 
 help much :-(
 
 I'm still curious why tomcat wants a hsql driver even though it's not 
 mentioned in any configuration file.
 
 przem
 
 
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 15:06, Les Hughes wrote:
 web-app
   resource-ref
   descriptionDB Connection/description
   res-ref-namejdbc/TestDB/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
   /resource-ref
 /web-app

 The description is missing (but I dont have a DTD to had to tell whether
 this is optional) but other than that it's fine.

Neither adding description nor removing slashes helped.
I've checked the path in manual:
jdbc:postgresql:database
jdbc:postgresql://host/database
jdbc:postgresql://host:port/database

I wonder if there is a way to debug what exactly Tomcat does. What section of 
server.xml does it parse etc.

Does anyone tried to connect to postgresql and succeeded?

przem




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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread andre . powroznik

Do you have already connected to a postgresql db using a java app? Are you sure the 
parameters are correct? What is public?
Where did you put the postgresql.jar?
Do you have a file named hsql.jar? Can you remove it?

-Original Message-
From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
Sent: 02 July 2002 12:09
To: 'Tomcat Users List'
Subject: Tomcat 4.0.4, jndi, jdbc and postgresql [long]


Hi

I've just started to write servlets. Servlets that only do processing, without 
connecting to database work fine, but I have some problems to get the 
connection with postgresql via jdbc work.

Tomcat: 4.0.4   (on linux)
Postgresql: 7.2.1 (on linux)
Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)

The servlet is quite simple:

import java.io.*;
import java.util.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class InfoServlet extends HttpServlet {

Connection con;
private boolean conFree = true;

public void init() throws ServletException {
try  {
Context initCtx = new InitialContext();
Context envCtx = 
(Context)initCtx.lookup(java:comp/env);
DataSource ds = (DataSource)
envCtx.lookup(jdbc/BookDB);
Connection con = ds.getConnection();
} catch (Exception ex) {
throw new ServletException(Couldn't open connection 
to database:  + ex.getMessage());
}
}

public void destroy() {
try {
con.close();
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}

public void doGet (HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {

HttpSession session = request.getSession();

// set content-type header before accessing the Writer
response.setContentType(text/html);
response.setBufferSize(8192);
PrintWriter out = response.getWriter();

// then write the data of the response
out.println(html +
headtitleDuke's Bookstore/title/head);
}
}

in web/WEB-INF/web.xml I defined:


!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
display-nameCurrency Converter Application/display-name
description
Test servlet
/description
servlet
servlet-nameinfo/servlet-name
display-nameinfo/display-name
descriptionno description/description
servlet-classInfoServlet/servlet-class
/servlet
servlet-mapping
servlet-nameinfo/servlet-name
url-pattern/info/url-pattern
/servlet-mapping
session-config
session-timeout30/session-timeout
/session-config
resource-ref
res-ref-namejdbc/BookDB/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainter/res-auth
/resource-ref
/web-app

And in server.xml in the contex of the application:

   Context path=/bookstore docBase=bookstore debug=0
 reloadable=true crossContext=true
  Logger className=org.apache.catalina.logger.FileLogger
 prefix=localhost_bookstore_log. suffix=.txt
  timestamp=true/
  Resource name=jdbc/BookDB auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/BookDB
parameter
  nameuser/name
  valuejava/value
/parameter
parameter
  namepassword/name
  valuejava/value
/parameter
parameter
  namedriverClassName/name
  valueorg.postgresql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:postgresql:public/value
/parameter
  /ResourceParams
/Context

I've tried a few different driverName parameters: (restarting Tomcat after 
each change)
jdbc:postgresql://localhost/public
jdbc:postgresql://full.server.name/public
jdbc:postgresql:public
jdbc:postgresql://localhost/

But, despite the parameters, I always get the following error:

exception 
javax.servlet.ServletException: Couldn't open connection to database: 
Exception creating DataSource: org.hsql.jdbcDriver
at InfoServlet.init(Unknown Source)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)


{cut}

I have no idea why Tomcat wants to connect

Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Martin Jacobson

Les Hughes wrote:

 Ignore the remove // comment - I was looking at my oracle notes :-)
 I really have no idea why it's trying to load the hsql driver if there's no
 ref in your
 server.xml
 
 Post your server.xml and web.xml and we'll both have a look.
 

I struggled for weeks (on and off) trying to figure out why Tyrex ALWAYS 
tries to load the hsql driver - in vain.

Don't bother trying to get Tyrex to work - it just doesn't! (And neither 
does it pool connections) - you should try TC 4.1, which uses the 
jakarta-commons DBCP. DBCP works, and pools connections!

Martin



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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 15:16, Les Hughes wrote:
 Ignore the remove // comment - I was looking at my oracle notes :-)
 I really have no idea why it's trying to load the hsql driver if there's no
 ref in your
 server.xml

Ok, the full versions (I cut off all comments):

przem


server.xml

---cut---here
Server port=8005 shutdown=SHUTDOWN debug=0
  Service name=Tomcat-Standalone

Connector className=org.apache.catalina.connector.http.HttpConnector
   port=8080 minProcessors=5 maxProcessors=75
   enableLookups=true redirectPort=8443
   acceptCount=10 debug=0 connectionTimeout=6/
Engine name=Standalone defaultHost=localhost debug=0

  Logger className=org.apache.catalina.logger.FileLogger
  prefix=catalina_log. suffix=.txt
  timestamp=true/


  Realm className=org.apache.catalina.realm.MemoryRealm /

  Host name=localhost debug=0 appBase=webapps unpackWARs=true

Valve className=org.apache.catalina.valves.AccessLogValve
 directory=logs  prefix=localhost_access_log. 
suffix=.txt
 pattern=common/

Logger className=org.apache.catalina.logger.FileLogger
 directory=logs  prefix=localhost_log. suffix=.txt
timestamp=true/

Context path=/manager docBase=manager 
 debug=0 privileged=true/

Context path=/bookstore1 docBase=bookstore1 debug=0
 reloadable=true crossContext=true
  Logger className=org.apache.catalina.logger.FileLogger
 prefix=localhost_bookstore1_log. suffix=.txt
  timestamp=true/
  Resource name=jdbc/BookDB auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/BookDB
parameter
 nameusername/name
  valuejava/value
/parameter
parameter
  namepassword/name
  valuejava/value
/parameter   
parameter
  namedriverClassName/name
  valueorg.postgresql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:postgresql:/localhost/public/value
/parameter
  /ResourceParams
/Context 

  /Host

/Engine

  /Service


  Service name=Tomcat-Apache

Connector className=org.apache.catalina.connector.warp.WarpConnector
 port=8008 minProcessors=5 maxProcessors=75
 enableLookups=true
 acceptCount=10 debug=0/

Engine className=org.apache.catalina.connector.warp.WarpEngine
 name=Apache defaultHost=localhost debug=0 appBase=webapps

  Logger className=org.apache.catalina.logger.FileLogger
  prefix=apache_log. suffix=.txt
  timestamp=true/

  Realm className=org.apache.catalina.realm.MemoryRealm /

/Engine

  /Service

/Server

---cut---here

web.xml

---cut---here
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app
display-nameInfo Application/display-name
description
Just test application
/description
servlet
servlet-nameinfo/servlet-name
display-nameinfo/display-name
descriptionno description/description
servlet-classInfoServlet/servlet-class
/servlet
servlet-mapping
servlet-nameinfo/servlet-name
url-pattern/info/url-pattern
/servlet-mapping
session-config
session-timeout30/session-timeout
/session-config
resource-ref
descriptionDatabase Connection/description
res-ref-namejdbc/BookDB/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
/web-app
---cut---here---

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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Przemyslaw Kowalczyk

On Tuesday 02 July 2002 15:43, [EMAIL PROTECTED] wrote:
 Do you have already connected to a postgresql db using a java app? Are you
 sure the parameters are correct? What is public? Where did you put the
 postgresql.jar?

Yes, without any problems from 'standalone' application. I'm able to query and 
update database, so parameters (url, username and password) are ok.

There is no postgresql.jar, only pgjdbc2.jar. I put it in ${tomcat-root}/lib 
directory.  I tried first to add a link named postgresql.jar and then I've 
renamed it but it didn't help :-(

 Do you have a file named hsql.jar? Can you remove it?

I don't have such file.


przem


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




RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Ok. Summary time.

Martin reflects my experience - I dumped tyrex and used DBCP as well. But
aren't we trying to go direct without a pool? Having said that I've only
ever managed to get datasources working when DBCP is being used...

Check that your driver jarfile does not contain the javax.sql extension
classes. If it does, delete them and rejar. Some versions of Tomcat will
ignore any jar that has these classes present. Be careful with this thought
- I work with jdk1.4 which has these built in.

Also, you don't specify a DataSourceFactory in your server.xml - see below.


Here's a known (well as far as I know...) good postgres solution using DBCP.
See
http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2
for my original mysql post as well.



Resource name=jdbc/postgres auth=Container
  type=javax.sql.DataSource/ 

ResourceParams name=jdbc/postgres
  parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
namedriverClassName/name
valueorg.postgresql.Driver/value
  /parameter
  parameter
nameurl/name
valuejdbc:postgresql://127.0.0.1:5432/mydb/value
  /parameter
  parameter
nameusername/name
valuemyuser/value
  /parameter
  parameter
namepassword/name
valuemypasswd/value
  /parameter
  parameter
namemaxActive/name
value20/value
  /parameter
  parameter
namemaxIdle/name
value10/value
  /parameter
  parameter
namemaxWait/name
value-1/value
  /parameter
/ResourceParams 




 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:53
 To: Tomcat Users List
 Subject: Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 On Tuesday 02 July 2002 15:43, [EMAIL PROTECTED] wrote:
  Do you have already connected to a postgresql db using a 
 java app? Are you
  sure the parameters are correct? What is public? Where 
 did you put the
  postgresql.jar?
 
 Yes, without any problems from 'standalone' application. I'm 
 able to query and 
 update database, so parameters (url, username and password) are ok.
 
 There is no postgresql.jar, only pgjdbc2.jar. I put it in 
 ${tomcat-root}/lib 
 directory.  I tried first to add a link named postgresql.jar 
 and then I've 
 renamed it but it didn't help :-(
 
  Do you have a file named hsql.jar? Can you remove it?
 
 I don't have such file.
 
 
 przem
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Brian P. Millett

On Tue, 2002-07-02 at 08:47, Przemyslaw Kowalczyk wrote:
 On Tuesday 02 July 2002 15:16, Les Hughes wrote:
  Ignore the remove // comment - I was looking at my oracle notes :-)
  I really have no idea why it's trying to load the hsql driver if there's no
  ref in your
  server.xml
 
 Ok, the full versions (I cut off all comments):
 
 przem

Przem,
 Here are the setting I have used with Tomcat 4.0.4, postgresql 7.2.1 
jdk1.4

I had to put the postgresql.jar, commons-dbcp.jar, commons-pool.jar into
the DIR/common/lib directory.

SERVER.XML:

Resource name=jdbc/tropicos auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/tropicos
  parameter
 namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
   
parameternamemaxActive/namevalue100/value/parameter
   
parameternamemaxIdle/namevalue3/value/parameter
   
parameternamemaxWait/namevalue100/value/parameter
   
parameternameusername/namevalueX/value/parameter
   
parameternamepassword/namevalue/value/parameter
parameter
namedriverClassName/name
valueorg.postgresql.Driver/value
/parameter
parameter
nameurl/name
   
valuejdbc:postgresql://localhost:5432/ids_tropicos/value
/parameter
  /ResourceParams

Then the web.xml cruft:
resource-ref
  descriptionPostgreSQL DB Connection/description
  res-ref-namejdbc/tropicos/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

-- 
Brian Millett
Enterprise Consulting Group   Shifts in paradigms
(314) 205-9030   often cause nose bleeds.
[EMAIL PROTECTED]   Greg Glenn


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




Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Arshad Mahmood

Hi,

I notice that you are doing the JDBC lookup in the init function. This
doesn't appear to work properly (at least on 4.1.6), move the initialisation
code to the doGet/doPost and see if that helps. This cured my JNDI/JDBC
problems.

Regards.

- Original Message -
From: Przemyslaw Kowalczyk [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, July 02, 2002 11:08 AM
Subject: Tomcat 4.0.4, jndi, jdbc and postgresql [long]


 Hi

 I've just started to write servlets. Servlets that only do processing,
without
 connecting to database work fine, but I have some problems to get the
 connection with postgresql via jdbc work.

 Tomcat: 4.0.4 (on linux)
 Postgresql: 7.2.1 (on linux)
 Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)

 The servlet is quite simple:

 import java.io.*;
 import java.util.*;
 import java.sql.*;
 import javax.sql.*;
 import javax.naming.*;
 import javax.servlet.*;
 import javax.servlet.http.*;

 public class InfoServlet extends HttpServlet {

 Connection con;
 private boolean conFree = true;

 public void init() throws ServletException {
 try  {
 Context initCtx = new InitialContext();
 Context envCtx =
 (Context)initCtx.lookup(java:comp/env);
 DataSource ds = (DataSource)
 envCtx.lookup(jdbc/BookDB);
 Connection con = ds.getConnection();
 } catch (Exception ex) {
 throw new ServletException(Couldn't open
connection
 to database:  + ex.getMessage());
 }
 }

 public void destroy() {
 try {
 con.close();
 } catch (SQLException ex) {
 System.out.println(ex.getMessage());
 }
 }

 public void doGet (HttpServletRequest request, HttpServletResponse
 response) throws ServletException, IOException {

 HttpSession session = request.getSession();

 // set content-type header before accessing the Writer
 response.setContentType(text/html);
 response.setBufferSize(8192);
 PrintWriter out = response.getWriter();

 // then write the data of the response
 out.println(html +
 headtitleDuke's Bookstore/title/head);
 }
 }

 in web/WEB-INF/web.xml I defined:


 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd;
 web-app
 display-nameCurrency Converter Application/display-name
 description
 Test servlet
 /description
 servlet
 servlet-nameinfo/servlet-name
 display-nameinfo/display-name
 descriptionno description/description
 servlet-classInfoServlet/servlet-class
 /servlet
 servlet-mapping
 servlet-nameinfo/servlet-name
 url-pattern/info/url-pattern
 /servlet-mapping
 session-config
 session-timeout30/session-timeout
 /session-config
 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref
 /web-app

 And in server.xml in the contex of the application:

Context path=/bookstore docBase=bookstore debug=0
  reloadable=true crossContext=true
   Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_bookstore_log. suffix=.txt
   timestamp=true/
   Resource name=jdbc/BookDB auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/BookDB
 parameter
   nameuser/name
   valuejava/value
 /parameter
 parameter
   namepassword/name
   valuejava/value
 /parameter
 parameter
   namedriverClassName/name
   valueorg.postgresql.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:postgresql:public/value
 /parameter
   /ResourceParams
 /Context

 I've tried a few different driverName parameters: (restarting Tomcat after
 each change)
 jdbc:postgresql://localhost/public
 jdbc:postgresql://full.server.name/public
 jdbc:postgresql:public
 jdbc:postgresql://localhost/

 But, despite the parameters, I always get the following error:

 exception
 javax.servlet.ServletException: Couldn't open connection to database:
 Exception creating DataSource: org.hsql.jdbcDriver
 at InfoServlet.init(Unknown Source)
 at javax.servlet.GenericServlet.init

Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Nikola Milutinovic

 Neither adding description nor removing slashes helped.
 I've checked the path in manual:
 jdbc:postgresql:database
 jdbc:postgresql://host/database
 jdbc:postgresql://host:port/database

This last form is the most complete one. Anyway, that will not make a difference, 
since it is up to JDBC driver to parse this URL AND JDBC DRIVER WORKS.

 I wonder if there is a way to debug what exactly Tomcat does. What section of 
 server.xml does it parse etc.

I've tried running Tomcat under JBuilder. I did get into debugging session, but when 
it came to XML parser, it just, sort of, dropped into a hole. I needed sources for XML 
parser, too. At that point I've had had too much and decided to wait for DBCP.

 Does anyone tried to connect to postgresql and succeeded?

Craig has done it and although he is one of the developers, he was unable to help us. 
I guess it is not just for fashion, that they have decided to drop Tyrex in favour of 
DBCP.

Nix.



Re: Tomcat 4 JNDI

2002-06-18 Thread giluka


I've tried that but it does not still works ...
It is correct to put jndi.properties (with information that point to my ejb
server) file in my classpath ?

- Original Message -
From: Richard Plukker [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, June 18, 2002 9:27 AM
Subject: Re: Tomcat 4  JNDI


 In tomcat 4 you can also use the ejb-ref element in the server.xml
 look at the tomcat examples, hope it will work.
 good luck

 On Tuesday 18 June 2002 08:56, you wrote:
  I've a problem:
  i want to call my EJB resource (running on a remote machine on JBoss
3.0)
  from a servlet (running on my local machine).
  I've tried to put in classpath jndi.properties file like this:
 
  java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
  java.naming.provider.url=remote-machine
  java.naming.factory.url.pkgs=org.jboss.naming.org.jnp.interfaces
 
  and to modify web-xml file:
 
  resource-env-ref
  resource-env-ref-nameAddressEJBHome/resource-env-ref-name
 
 
resource-env-ref-typecom.sun.j2ee.blueprints.address.ejb.AddressEJBBean/
 r esource-env-ref-type
  /resource-env-ref
 
  can you help me ?

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



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




Re: Tomcat 4 JNDI

2002-06-18 Thread Richard Plukker

giluka wrote:

I've tried that but it does not still works ...
It is correct to put jndi.properties (with information that point to my ejb
server) file in my classpath ?

- Original Message -
From: Richard Plukker [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, June 18, 2002 9:27 AM
Subject: Re: Tomcat 4  JNDI


  

In tomcat 4 you can also use the ejb-ref element in the server.xml
look at the tomcat examples, hope it will work.
good luck

On Tuesday 18 June 2002 08:56, you wrote:


I've a problem:
i want to call my EJB resource (running on a remote machine on JBoss
  

3.0)
  

from a servlet (running on my local machine).
I've tried to put in classpath jndi.properties file like this:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=remote-machine
java.naming.factory.url.pkgs=org.jboss.naming.org.jnp.interfaces

and to modify web-xml file:

resource-env-ref
resource-env-ref-nameAddressEJBHome/resource-env-ref-name


  



resource-env-ref-typecom.sun.j2ee.blueprints.address.ejb.AddressEJBBean/
  

r esource-env-ref-type
/resource-env-ref

can you help me ?
  

--
To unsubscribe, e-mail:


mailto:[EMAIL PROTECTED]
  

For additional commands, e-mail:


mailto:[EMAIL PROTECTED]
  



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

  


You should try to start tomcat with a

# java -Djava.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory \
  -Djava.naming.provider.url=ldap://localhost:389/o=jnditutorial \
  List
# java -Djava.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory \
  -Djava.naming.provider.url=file:/tmp \
  List 
  

You should take a look at the jndi 
tutorial:http://java.sun.com/products/jndi/tutorial/beyond/env/source.html



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




Tomcat / JBoss / JNDI lookup not working - HELP!

2002-06-03 Thread Miller, Andy

I have seperate instances of Tomcat and JBoss running on the same
machine.  I'm trying to do a JNDI lookup of a JMS queue that's
configured in JBoss from Tomcat but cannot get it to work.  I can see
the JNDI tree from the JBoss' JNDIView and all looks fine, here's a a
snapshot of the Global JNDI Namespace:
 

Global JNDI Namespace

  +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
  +- jmx:miller-dp:rmi (class: org.jboss.jmx.server.RMIConnectorImpl)
  +- TopicConnectionFactory[link - ConnectionFactory] (class:
javax.naming.LinkRef)
  +- UserTransactionSessionFactory (class:
org.jboss.tm.usertx.server.UserTransactionSessionFactoryImpl)
  +- RMIXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
  +- QueueConnectionFactory[link - ConnectionFactory] (class:
javax.naming.LinkRef)
  +- topic (class: org.jnp.interfaces.NamingContext)
  |   +- example (class: org.jboss.mq.SpyTopic)
  |   +- testTopic (class: org.jboss.mq.SpyTopic)
  |   +- bob (class: org.jboss.mq.SpyTopic)
  +- queue (class: org.jnp.interfaces.NamingContext)
  |   +- D (class: org.jboss.mq.SpyQueue)
  |   +- C (class: org.jboss.mq.SpyQueue)
  |   +- loggingQueue (class: org.jboss.mq.SpyQueue)
  |   +- B (class: org.jboss.mq.SpyQueue)
  |   +- A (class: org.jboss.mq.SpyQueue)
  |   +- controlQueue (class: org.jboss.mq.SpyQueue)
  |   +- testQueue (class: org.jboss.mq.SpyQueue)
  |   +- ex (class: org.jboss.mq.SpyQueue)
  |   +- DLQ (class: org.jboss.mq.SpyQueue)
  |   +- F (class: org.jboss.mq.SpyQueue)
  |   +- E (class: org.jboss.mq.SpyQueue)
  +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
  +- RMIConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
  +- UserTransaction (class:
org.jboss.tm.usertx.client.ClientUserTransaction)
  +- jmx (class: org.jboss.jmx.server.JMXAdaptorImpl)
  +- servercollector (class: org.jboss.management.ServerDataCollector)
  +- UILXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
  +- UILConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)

I've copied the JNDI Properties to the tomcat/common/classes directory,
and copied all the client JARS to the tomcat/classes/lib directory.
Froma JSP running under Tomcat,  I do a new InitialContext() and then do
a  lookup on QueueConnectionFactory I get:
 
javax.servlet.ServletException: Name QueueConnectionFactory is not bound
in this Context
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:463)
at
org.apache.jsp.test_0005fjndi$jsp._jspService(test_0005fjndi$jsp.java:17
3)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
t.java:202)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

When i I do execute the following code:
 
Hashtable env = ctx.getEnvironment();
Enumeration enum = env.keys();
System.out.println(displayEnv number of keys +env.size());
while (enum.hasMoreElements()) {
String key = (String)enum.nextElement();
Object value = env.get(key);
System.out.println(key+=+value);
}
I get:


java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory
java.naming.provider.url=localhost:1099

java.naming.factory.url.pkgs=org.apache.naming:org.jboss.naming:org.jnp.
interfaces

 
What am I doing wrong??? I've been banging my head against a wall for
three days over this.  Does anyone have any clues??? Oh, btw, I tried
changing the JBoss JNDI port to 1066, but it made no difference. Thanks.
 
Andy Miller
[EMAIL PROTECTED]
HP Invent



Re: Tomcat / JBoss / JNDI lookup not working - HELP!

2002-06-03 Thread Håkon Hansen

On Mon, 3 Jun 2002 11:48:14 -0500
Miller, Andy [EMAIL PROTECTED] wrote:

 I have seperate instances of Tomcat and JBoss running on the same
 machine.  I'm trying to do a JNDI lookup of a JMS queue that's
 configured in JBoss from Tomcat but cannot get it to work.

I have not taken the time to fully analyze your problem, but I have 
had similar problems with JNDI lookups JBoss 3.0 / Tomcat 4.0. 

What I had to do, was to set the initial factory as a System property
before creating the InitialContext for the first time, like this:

System.setProperty(java.naming.factory.initial, 
org.jnp.interfaces.NamingContextFactory);


Good luck!


Yours, Haakon Hansen, Norway

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




RE: Tomcat / JBoss / JNDI lookup not working - HELP!

2002-06-03 Thread Miller, Andy

That was all it took! Thanks a million!

-Original Message-
From: Håkon Hansen [mailto:[EMAIL PROTECTED]] 
Sent: Monday, June 03, 2002 11:23 AM
To: Tomcat Users List
Subject: Re: Tomcat / JBoss / JNDI lookup not working - HELP!


On Mon, 3 Jun 2002 11:48:14 -0500
Miller, Andy [EMAIL PROTECTED] wrote:

 I have seperate instances of Tomcat and JBoss running on the same 
 machine.  I'm trying to do a JNDI lookup of a JMS queue that's 
 configured in JBoss from Tomcat but cannot get it to work.

I have not taken the time to fully analyze your problem, but I have 
had similar problems with JNDI lookups JBoss 3.0 / Tomcat 4.0. 

What I had to do, was to set the initial factory as a System property before creating 
the InitialContext for the first time, like this:

System.setProperty(java.naming.factory.initial, 
org.jnp.interfaces.NamingContextFactory);


Good luck!


Yours, Haakon Hansen, Norway

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


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




Re: Tomcat / JBoss / JNDI lookup not working - HELP!

2002-06-03 Thread Håkon Hansen

On Mon, 3 Jun 2002 12:32:11 -0500
Miller, Andy [EMAIL PROTECTED] wrote:

You are very welcome :-)


Yours, Haakon Hansen, Norway

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




Accessing Tomcat 4.03 JNDI service from LoginModule

2002-05-31 Thread Salonen, Aki

Hi!

I'm following problem:

I have JAAS LoginModule that uses JNDI to lookup DataSource object.
My LoginModule and LoginConfiguration implementation classes are located
in Tomcat's classpath. 

I tried first to put JAAS related classes under [TOMCAT-HOME]/common/lib,
but that caused exception:Unable to load LoginConfiguration.

I'm using JAAS authentication directly from a servlet, so I'm using no
Tomcat realms in authentication.
Servlet just calls:

LoginContext lc = new LoginContext( jaasApplName,
customUserPasswordCallbackHandler );
lc.login( );

Everything works fine until LoginModule tries to lookup datasource
after obtaining InitialContext with 

InitialContext initCtx = new InitialContext( );
DataSource ds = (javax.sql.DataSource) initCtx.lookup(
dataSourceName );

I got exception with message : Name MIPCoreDS is not bound in this
context..

MIPCoreDS is configured in Tomcats configuration file server.xml under
GlobalNamingResources tag. 

Should this be visible for JAAS Login module or not?
When servlet's make same lookup under Tomcat, datasource is found fine.
It seems that loginModules have no visibility to JNDI objects configured
under Tomcat. 
Is this right?

Any help is appreciated.

Best Regards,

Aki








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




Tomcat 4.1 JNDI Novell

2002-04-08 Thread todd tredeau

Hi;
I am looking for a project participant to;

Integrate our revision, NWJNDIRealm which is a modified 'JNDIRealm';

What I think is needed is;

1. Standardize compatiblized code
2. Implement a simpler way to manage virtual hosts 
ie:mulitple sites/instances with minimal config
this might be implemented by group access control, etc..

Some other stuff and ideas if there is interested, feel free to 
contact me directly. The point of this is to put compatible code, back 
into the project.

thanks

todd
http://www.wiserlabz.com
collaborative effort to promote Novell and Open Source solutions




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Tomcat/Poolman/JNDI (was RMI/JNDI problem w/tomcat 3.3)

2001-12-07 Thread Mike Comb

OK, let me make this simpler since I have only received one response.  Has 
anybody gotten poolman 2.04 to work with tomcat 3.3 using JNDI?  How?

Thanks,
-Mike

--On Friday, December 7, 2001 10:08 AM -0800 Mike Comb [EMAIL PROTECTED] 
wrote:

 Yes, I know it ignores the CLASSPATH.  I tried puting jndi.properties in
 my webapps classes directory as well as modifying tomcat.sh so it uses
 the system CLASSPATH.  Neither had any effect.  I am not getting any
 error, RMI just never starts up.  Has anybody gotten this to work with
 tc3.3?  Can someone try?  I want to know if this is a TC bug or just a
 configuration error with my setup.

 Thanks,
 -Mike

 --On Friday, December 7, 2001 8:04 AM -0500 Larry Isaacs
 [EMAIL PROTECTED] wrote:

 I assume you noticed in the documentation that Tomcat 3.3
 startup scripts ignore your CLASSPATH.  Did you modify
 the tomcat.bat/tomcat.sh file to include the jndi.properties
 file?  If so, what is the error you are seeing?

 Cheers,
 Larry

 -Original Message-
 From: Mike Comb [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 06, 2001 10:37 PM
 To: [EMAIL PROTECTED]
 Subject: RMI/JNDI problem w/tomcat 3.3


 Hi, I am trying to upgrade from tomcat 3.2.3 to 3.3 and I am having a
 problem.  Under 3.2.3 I was able to get tomcat to act as a
 JNDI server by
 adding a jndi.properties file to my classpath with the
 following contents...

 
 java.naming.factory.initial=com.sun.jndi.rmi.registry.Registry
 ContextFactory
 java.naming.provider.url=rmi://localhost:1099
 

 an RMI server was automatically started on port 1099 as part
 of the tomcat
 process.  With TC 3.3 this no longer works.  I found a couple
 of old emails
 mentioning that tc3.3 may not be able to open that file, but no real
 details.  Can someone please tell me what is going on and if
 there is any
 work around?

 Thanks,
 -Mike


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Tomcat/Poolman/JNDI (was RMI/JNDI problem w/tomcat 3.3)

2001-12-07 Thread Mike Comb

Sorry to keep replying to myself, but I have confirmed that this problem 
happens with tomcat 3.3 and the latest 3.3.1 development build.  Both 3.2.3 
and 3.2.4 work as expected.

I am getting rather frustrated here, I have the semi-common problem where 
tomcat 3.2.3's CPU load jumps to nearly 100% for no obvious reason, but I 
can't upgrade.  3.3 had this problem and 4.0.1 does not support 
loadbalancing which we have to have.

Help?
-Mike

--On Friday, December 7, 2001 11:48 AM -0800 Mike Comb [EMAIL PROTECTED] 
wrote:

 OK, let me make this simpler since I have only received one response.
 Has anybody gotten poolman 2.04 to work with tomcat 3.3 using JNDI?  How?

 Thanks,
 -Mike

 --On Friday, December 7, 2001 10:08 AM -0800 Mike Comb
 [EMAIL PROTECTED] wrote:

 Yes, I know it ignores the CLASSPATH.  I tried puting jndi.properties in
 my webapps classes directory as well as modifying tomcat.sh so it uses
 the system CLASSPATH.  Neither had any effect.  I am not getting any
 error, RMI just never starts up.  Has anybody gotten this to work with
 tc3.3?  Can someone try?  I want to know if this is a TC bug or just a
 configuration error with my setup.

 Thanks,
 -Mike

 --On Friday, December 7, 2001 8:04 AM -0500 Larry Isaacs
 [EMAIL PROTECTED] wrote:

 I assume you noticed in the documentation that Tomcat 3.3
 startup scripts ignore your CLASSPATH.  Did you modify
 the tomcat.bat/tomcat.sh file to include the jndi.properties
 file?  If so, what is the error you are seeing?

 Cheers,
 Larry

 -Original Message-
 From: Mike Comb [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 06, 2001 10:37 PM
 To: [EMAIL PROTECTED]
 Subject: RMI/JNDI problem w/tomcat 3.3


 Hi, I am trying to upgrade from tomcat 3.2.3 to 3.3 and I am having a
 problem.  Under 3.2.3 I was able to get tomcat to act as a
 JNDI server by
 adding a jndi.properties file to my classpath with the
 following contents...

 
 java.naming.factory.initial=com.sun.jndi.rmi.registry.Registry
 ContextFactory
 java.naming.provider.url=rmi://localhost:1099
 

 an RMI server was automatically started on port 1099 as part
 of the tomcat
 process.  With TC 3.3 this no longer works.  I found a couple
 of old emails
 mentioning that tc3.3 may not be able to open that file, but no real
 details.  Can someone please tell me what is going on and if
 there is any
 work around?

 Thanks,
 -Mike


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Tomcat/Poolman/JNDI (was RMI/JNDI problem w/tomcat 3.3)

2001-12-07 Thread Mike Comb

OK, last time responding to myself.  I finally found the problem with TC3.3 
and it really was a CLASSPATH issue.  My database drivers where not in my 
CLASSPATH which apparently was keeping poolman from starting up which was 
in turn keeping RMI from starting.  Unfortunately nothing threw an 
exception or logged any errors until I tried to access the DB (at which 
point it threw an exception trying to connect to the RMI server).  I don't 
understand why nothing threw an exception while starting poolman or 
creating the pool, but I have learned to be very careful with paths with 
the new classpath layout under tc3.3.

Thanks,
-Mike


--On Friday, December 7, 2001 12:59 PM -0800 Mike Comb [EMAIL PROTECTED] 
wrote:

 Sorry to keep replying to myself, but I have confirmed that this problem
 happens with tomcat 3.3 and the latest 3.3.1 development build.  Both
 3.2.3 and 3.2.4 work as expected.

 I am getting rather frustrated here, I have the semi-common problem where
 tomcat 3.2.3's CPU load jumps to nearly 100% for no obvious reason, but I
 can't upgrade.  3.3 had this problem and 4.0.1 does not support
 loadbalancing which we have to have.

 Help?
 -Mike

 --On Friday, December 7, 2001 11:48 AM -0800 Mike Comb
 [EMAIL PROTECTED] wrote:

 OK, let me make this simpler since I have only received one response.
 Has anybody gotten poolman 2.04 to work with tomcat 3.3 using JNDI?  How?

 Thanks,
 -Mike

 --On Friday, December 7, 2001 10:08 AM -0800 Mike Comb
 [EMAIL PROTECTED] wrote:

 Yes, I know it ignores the CLASSPATH.  I tried puting jndi.properties in
 my webapps classes directory as well as modifying tomcat.sh so it uses
 the system CLASSPATH.  Neither had any effect.  I am not getting any
 error, RMI just never starts up.  Has anybody gotten this to work with
 tc3.3?  Can someone try?  I want to know if this is a TC bug or just a
 configuration error with my setup.

 Thanks,
 -Mike

 --On Friday, December 7, 2001 8:04 AM -0500 Larry Isaacs
 [EMAIL PROTECTED] wrote:

 I assume you noticed in the documentation that Tomcat 3.3
 startup scripts ignore your CLASSPATH.  Did you modify
 the tomcat.bat/tomcat.sh file to include the jndi.properties
 file?  If so, what is the error you are seeing?

 Cheers,
 Larry

 -Original Message-
 From: Mike Comb [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 06, 2001 10:37 PM
 To: [EMAIL PROTECTED]
 Subject: RMI/JNDI problem w/tomcat 3.3


 Hi, I am trying to upgrade from tomcat 3.2.3 to 3.3 and I am having a
 problem.  Under 3.2.3 I was able to get tomcat to act as a
 JNDI server by
 adding a jndi.properties file to my classpath with the
 following contents...

 
 java.naming.factory.initial=com.sun.jndi.rmi.registry.Registry
 ContextFactory
 java.naming.provider.url=rmi://localhost:1099
 

 an RMI server was automatically started on port 1099 as part
 of the tomcat
 process.  With TC 3.3 this no longer works.  I found a couple
 of old emails
 mentioning that tc3.3 may not be able to open that file, but no real
 details.  Can someone please tell me what is going on and if
 there is any
 work around?

 Thanks,
 -Mike


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Apache, Tomcat and JNDI problem...

2001-10-23 Thread JTurner

Hi,

I have been developing an application that does a JNDI lookup for a
DataSource and then does a database query. Everything works great when I
just use Tomcat 4.0.1. But when I use Apache as the front end and use the
Warp Connector to connect Apache and Tomcat, I am then unable to retrieve
the DataSource from the JNDI tree.

I receive the exception: javax.naming.NameNotFoundException: Name testDB is
not bound in this Context

I did some digging and found that there is the same problem with the Tomcat
example: /examples/servlet/JndiServlet

This is what I receive when running the example using only Tomcat on port
8080:
(http://localhost:8080/examples/servlet/JndiServlet)

Simple lookup test :
Max exemptions value : 15
list() on /comp/env Context :
Binding : mail: org.apache.naming.NamingContext
Binding : maxExemptions: java.lang.Integer
Binding : minExemptions: java.lang.Integer
Binding : jdbc: org.apache.naming.NamingContext
Binding : ejb: org.apache.naming.NamingContext
Binding : name3: java.lang.Integer
Binding : foo: org.apache.naming.NamingContext
listBindings() on /comp/env Context :
Binding : mail:
org.apache.naming.NamingContext:org.apache.naming.NamingContext@7a1bb6
Binding : maxExemptions: java.lang.Integer:15
Binding : minExemptions: java.lang.Integer:1
Binding : jdbc:
org.apache.naming.NamingContext:org.apache.naming.NamingContext@315d34
Binding : ejb:
org.apache.naming.NamingContext:org.apache.naming.NamingContext@5e256f
Binding : name3: java.lang.Integer:1
Binding : foo:
org.apache.naming.NamingContext:org.apache.naming.NamingContext@6bd8ea


But when I connect Apache and Tomcat using the Warp Connector I receive:
(http://localhost/examples/servlet/JndiServlet)

JNDI lookup failed : javax.naming.NameNotFoundException: Name maxExemptions
is not bound in this Context
list() on /comp/env Context :
Binding : mail: org.apache.naming.NamingContext
Binding : minExemptions: java.lang.Integer
Binding : ejb: org.apache.naming.NamingContext
Binding : name3: java.lang.Integer
Binding : foo: org.apache.naming.NamingContext
listBindings() on /comp/env Context :
Binding : mail:
org.apache.naming.NamingContext:org.apache.naming.NamingContext@2da3d
Binding : minExemptions: java.lang.Integer:1
Binding : ejb:
org.apache.naming.NamingContext:org.apache.naming.NamingContext@45f743
Binding : name3: java.lang.Integer:1
Binding : foo:
org.apache.naming.NamingContext:org.apache.naming.NamingContext@6c8909


I have tested this on Apache 1.3.20, Apache 1.3.22, Tomcat 4.0, Tomcat 4.0.1
and Tomcat 4.1-dev (nightly build).

Has anyone come across this problem before, or know how to correct this?

Justin.



Re: Tomcat / J2EE - JNDI Help!!!

2001-08-13 Thread Aditya Anand

Okie... just pondering if tomcat provides a directory
service standalone i tried binding regular
serializable java objects to the  directory and get a
security exception saying the context is read-only!

--- Sophie [EMAIL PROTECTED] wrote:
 Hi,
 
 I am not working with your configuration, but I was
 wondering whether you had set your
 JNDI parameters correctly. For the tomcat server
 there is a need to update tomcat.sh
 (or tomcat.bat) and also your EJB server needs to
 have the correct address. Please let
 me know if the statements I am using would be useful
 for you.
 Sophie
 
 Papo Napolitano schreef:
 
  Hi all!
 
  I't trying to make a webapp with JSP and Session
 Beans.
  I've written my own EJB called usermanager and it
 was tested in my machine
  (localhost). I've made the deploy with deploytool
 from sun and works fine.
 
  Now, I want to install it on my server (Tomcat
 4.06b / J2EE). I made the
  deploy with the and application but I don't know
 how must I do to bound this
  EJB to a JNDI name to use it from JSP.
 
  This is my JSP code:
 
  %
  InitialContext ctx = new InitialContext();
  Object objref = ctx.lookup(usermanager);
  UserManagerHome homeuser =
 
 (UserManagerHome)PortableRemoteObject.narrow(objref,
 UserManagerHome.class);
  UserManager UsrMgr = homeuser.create();
  .
  .
  %
 
  When I run it from my browser I get the following
 error:
 
  javax.servlet.ServletException: Name usermanager
 is not bound in this
  Context
  at
 

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
  l.java:452)
  at
 

org.apache.jsp._0002fuserfunc_jsp._jspService(_0002fuserfunc_jsp.java:121)
  at

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

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

org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
  va:200)
  at

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

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

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

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
  FilterChain.java:247)
  at
 

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
  ain.java:193)
  at
 

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
  va:243)
  at
 

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
  66)
  at
 

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
  va:219)
  at
 

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
  66)
  at
 

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 

org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2251)
  at
 

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
  )
  at
 

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
  66)
  at
 

org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
  at
 

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
  64)
  at
 

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
  :163)
  at
 

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
  66)
  at
 

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at
 

org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
  984)
  at
 

org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1074
  )
  at java.lang.Thread.run(Thread.java:484)
 
  Cheers,
  Papo
 


__
Do You Yahoo!?
Send instant messages  get email alerts with Yahoo! Messenger.
http://im.yahoo.com/



Adding contextPpath and realPath to tomcat environment jndi

2001-08-08 Thread Roytman, Alex

Hello

I would like to propose to add several things to tomcat's context's
environment jndi when a context gets created
Specifically I am interested in context path, context real path and any
other tomcat context runtime info
If it will not violate security I would be happy if Context itself can
be looked up via jndi. One of the uses of this kind of information will
be to help jndi object factories which need this info to read its
metadata from WEB-INF directory (i.e. many Object/Relational mappers
need access to their metadata to be initialized). It is possible to use
Environment entries for this purpose but it will be deployment nightmare
because we will need to hardcode real path to context. If you think that
this case is well justified it would be great if we could add it to
Servlet specs

Alex



Re: Adding contextPpath and realPath to tomcat environment jndi

2001-08-08 Thread Craig R. McClanahan



On Wed, 8 Aug 2001, Roytman, Alex wrote:

 Hello
 
 I would like to propose to add several things to tomcat's context's
 environment jndi when a context gets created

Sounds like a good discussion for TOMCAT-DEV ...

 Specifically I am interested in context path, context real path and any
 other tomcat context runtime info
 If it will not violate security I would be happy if Context itself can
 be looked up via jndi. One of the uses of this kind of information will
 be to help jndi object factories which need this info to read its
 metadata from WEB-INF directory (i.e. many Object/Relational mappers
 need access to their metadata to be initialized). It is possible to use
 Environment entries for this purpose but it will be deployment nightmare
 because we will need to hardcode real path to context. If you think that
 this case is well justified it would be great if we could add it to
 Servlet specs
 

Adding it to the servlet specs would be pretty problematic ... the
org.apache.catalina.Context interface is very much specific to Tomcat 4.
However, making additional info available to these resource factories
(which are already Tomcat-specific anyway) sounds reasonable.

Alex, could you put in a Bugzilla report for an enhancement, outlining the
specific things you'd like to see available to an object factory?  That
way the idean won't get lost in the mailing lists.

  http://nagoya.apache.org/bugzilla/


 Alex
 

Craig