Fran Varin wrote:
Well, let me see if I can paint an accurate picture...The application as it
is currently running in WAS uses a properties file to externalize everything
we need to connect to a datasource. The code itself will add the initial
context class name to the properties file that is handed to
javax.naming.initialcontext at the time the context object is constructed.
We use WAS' admin console to define the datasources and it really is that
simple.
I don't think you need to manually specify the initial context factory,
Tomcat prepares the environment for you:
java.naming.factory.url.pkgs = org.apache.naming
java.naming.factory.initial = o.a.naming.java.javaURLContextFactory
If you configure a global resource, you'll need to put a ResourceLink in
the context to make it accessible. There are some things to look out
for when specifying contexts*.
Setup a GlobalNamingResources/Resource, with your driver & db details
(e.g. with MySQL, using DBCP):
<GlobalNamingResources>
<Resource
driverClassName="com.mysql.jdbc.Driver"
username="database_user"
password="database_password"
url="jdbc:mysql://server:port/databasename"
validationQuery="select count(*) from a_table"
name="jdbc/GlobalDatabase"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
maxActive="10"
maxIdle="10"
maxWait="5000"
minIdle="1"
initialSize="20"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
/>
</GlobalNamingResources>
Place the ResourceLink in the context, and put the context config in
it's own file.
<Context ... >
<ResourceLink
name="jdbc/Database"
global="jdbc/GlobalDatabase"
type="javax.sql.DataSource"/>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
conf/server.xml
conf/Catalina/testhostname/ROOT.xml (ROOT context)
If/when this doesn't work, we'll know your config and will be able to
debug the remaining problems.
p
*The default/root context must be called ROOT.xml
I've looked at so many resources from the apache Tomcat site (as well as
googled a bunch) and everything seems to dance around the specific steps
necessary for accomplishing this. I have to be missing something...this
can't be this hard. As I mentioned in a previous response...frustration with
Tomcat is at an all time high here as everything we do, no matter how simple
it seems, turns into an adventure. We are basically new users of Tomcat and
like the idea of using it for testing purposes and possibly for some smaller
apps in production. But, at this point we cannot begin to support it mostly
because of the lack of accessible, thorough documentation that does not
assume you understand the internal structure.
Sorry for the rant! :(
Fran
Nelson, Tracy M. wrote:
| From: Fran Varin [mailto:[EMAIL PROTECTED]
| Sent: Thursday, 01 February, 2007 08:05
|
| It boils down to my attempt at using
| "org.apache.naming.java.javaURLContextFactory". However, when I do I
| receive "javax.naming.NameNotFoundException: Name jdbc is not bound
| in this Context:".
Are you using the initial context returned from getInitialContext()
directly, or are you obtaining a root context from the initial context?
Have you tried both methods of associating the "java" URL prefix with this
factory? (Both adding a property to your jndi.properties file, and
defining
an environment variable.)
If the IBM factory returns a root context, you will probably want to write
a
simple wrapper that gets an initial context from javaURLContextFactory,
then
looks up a root context and returns that.
-----------------------------------------
------------------------------------------------------------
The information contained in this message is confidential
proprietary property of Nelnet, Inc. and its affiliated
companies (Nelnet) and is intended for the recipient only.
Any reproduction, forwarding, or copying without the express
permission of Nelnet is strictly prohibited. If you have
received this communication in error, please notify us
immediately by replying to this e-mail.
------------------------------------------------------------
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]