tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Propes, Barry L " <barry.l.pro...@citi.com>
Subject RE: DB connection error -Tomcat 6 config
Date Tue, 16 Mar 2010 23:03:33 GMT
Well, I'm at a loss.

After even downloading 6.0.24 with the Windows Installer service and cleaning up the context.xml
and web.xml files in the respective places:
/webapps/META-INF/context.xml
And /webapps/WEB-INF/web.xml

Still, the errors I get:
javax.servlet.ServletException: javax.naming.NameNotFoundException: Name jdbc is not bound
in this Context
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
	org.apache.jsp.chgctrl_005fdetails_jsp._jspService(chgctrl_005fdetails_jsp.java:942)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause 
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
	org.apache.naming.NamingContext.lookup(NamingContext.java:770)
	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
	org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:97)
	javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
	org.apache.naming.NamingContext.lookup(NamingContext.java:793)
	org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	org.apache.naming.NamingContext.lookup(NamingContext.java:781)
	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
 

My META-INF/context.xml file's contents:

<Context>
<Resource name="jdbc/myoracle" 
auth="Container" 
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.DataSourceConnectionFactory"
driverClassName="oracle.jdbc.driver.OracleDriver"
 maxActive="125" 
 maxIdle="15" 
 maxWait="70000"
 removeAbandoned="true"
 removeAbandonedTimeout="300"
 logAbandoned="true"
username="usernm" 
password="pwd" 
url="jdbc:oracle:thin:@servername100:1526:SID"
minEvictableIdleTimeMillis="5000"
timeBetweenEvictionRunsMillis = "10000"
testWhileIdle="true" />
</Context>

And WEB-INF/web.xml
<resource-ref>
    <description>Change Ctrl App</description>
    <res-ref-name>jdbc/myoracle</res-ref-name>
    <res-ref-type>javax.sql.DataSource</res-ref-type>
    <res-auth>Container</res-auth>
  </resource-ref>

In addition to the previous servlet mappings that were on there before with version 4.1.31

How/why would it not find the naming context?

Uuuuuggggghhh!!



-----Original Message-----
From: Propes, Barry L [GCG-NAOT] 
Sent: Thursday, February 25, 2010 3:53 PM
To: 'Tomcat Users List'
Subject: RE: DB connection error -Tomcat 6 config

I'll totally remove factory. It was necessary in my 4.1 build.

I'll also tweak the other ms time settings, and the WhileIdle - to borrow, like you suggest
and see if that works better, of if at all.

I'll also try removing the resource-ref and see what occurs.

Thanks, Chris.


-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net]
Sent: Thursday, February 25, 2010 3:26 PM
To: Tomcat Users List
Subject: Re: DB connection error -Tomcat 6 config

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry,

On 2/25/2010 3:45 PM, Propes, Barry L wrote:
> Should be noted: for the factory type in the params below, I tried 
> both factory="org.apache.commons.dbcp.BasicDataSourceFactory" and 
> factory="org.apache.dbcp.BasicDataSourceFactory", each to no avail.

How about either factory="org.apache.tomcat.dbcp.BasicDataSourceFactory"
or specifying no factory at all and accepting the default (which is that shown above)?

> I removed the commons ref to test out since there's no commons/lib dir 
> in TC 6.0.24, unlike in TC 4.1.31


Right: common/lib, server/lib, and shared/lib are essentially all merged into a single /lib
in Tomcat 6. You can play with catalina.properties and make all kinds of ClassLoader hierarchies,
but it's usually not worth it.

> <Context>
>   <!-- omitting - factory="oracle.jdbc.pool.OracleDataSourceFactory" 
> below--> <Resource name="jdbc/myoracle"
> auth="Container" 
> type="javax.sql.DataSource"
> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>  maxActive="125" 
>  maxIdle="15" 
>  maxWait="7000"
>  removeAbandoned="true"
>  removeAbandonedTimeout="30"
>  logAbandoned="true"
> username="user_name" 
> password="pass_word" 
> driverClassName="oracle.jdbc.OracleDriver"
> url="jdbc:oracle:thin:@159.177.102.100:1526:MYSID"
> minEvictableIdleTimeMillis="5000"
> timeBetweenEvictionRunsMillis = "10000"
> testWhileIdle="true"
> />
> </Context>

All that looks okay to me, although 700ms isn't a long time to wait for a connection to come
back from the pool: my guess is that you'd rather wait for a while for a connection and give
the user a complete, if late, response rather than just giving them an error screen.

My position is that testWhildIdle isn't really useful: if you test on borrow, that's usually
sufficient unless you want to basically eliminate the possibility that a connection will have
to be re-established during a user request.

Finally, 30 seconds is a very short "abandoned timeout", though only you can determine what
is appropriate in your environment. If you have some code which executes 3 10-second queries,
then your connection is considered abandoned :(

> in webapps/WEB-INF/web.xml
> 
> <resource-ref>
> <description>My Ora datasource</description> 
> <res-ref-name>jdbc/myoracle</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>

In my experience, <resource-ref> is not necessary in web.xml but does follow the spec.

So, still getting this error, then:
> javax.servlet.ServletException: javax.naming.NameNotFoundException: 
> Name jdbc is not bound in this Context

?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuG6v8ACgkQ9CaO5/Lv0PACzQCgjVa3oW+0SH14un73MsEFj5k6
yKwAoKSyLVqESWo4CxgiLOgMqXy+0ZNR
=GAHw
-----END PGP SIGNATURE-----

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


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


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


Mime
View raw message