tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@pivotal.io>
Subject Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55
Date Wed, 03 Sep 2014 15:46:09 GMT
On Wed, Sep 3, 2014 at 11:36 AM, Robert Anderson <ranomail@gmail.com> wrote:

> Hi,
>
>
> In a privileged context, a have the following jsp to test a global jndi
> resource:
>
> <%@ page session="false" import="java.util.*,java.sql.*,javax.naming.*,
> javax.sql.*,org.apache.commons.dbcp.*" contentType="text/html" %>
> <%!
>
> protected void doLookup(JspWriter out) throws ServletException, IOException
> {
>  Context ctx;
>  try {
>   ctx = new InitialContext();
>   Object o = ctx.lookup("java:jdbc/cacheapp");
>   out.println(o);
>
>
>  } catch (NamingException e) {
>   out.println(e.getMessage());
>  } catch (Exception e) {
>  }
>  }
>
> %>
>
> <html>
> <head>
>   <title>Test JNDI</title>
> </head>
> <body>
>
> <h1>Teste JNDI</h1>
> <hr/>
> <%
> doLookup(out);
> %>
> <hr/>
>
> </body>
> </html>
>
>
> Versions earlier than 6.0.41:
>
> org.apache.tomcat.jdbc.pool.DataSource@29050dfd
> {ConnectionPool[defaultAutoCommit=null;
> defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null;
> driverClassName=com.intersys.jdbc.CacheDriver; maxActive=10; maxIdle=2;
> minIdle=1; initialSize=10; maxWait=10000; testOnBorrow=true;
> testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=60000;
> testWhileIdle=false; testOnConnect=false; password=********;
> url=jdbc:Cache://localhost:1972/USER; username=tomcat;
> validationQuery=select 1 from dual; validationQueryTimeout=-1;
> validatorClassName=null; validationInterval=0;
> accessToUnderlyingConnectionAllowed=true; removeAbandoned=true;
> removeAbandonedTimeout=300; logAbandoned=false; connectionProperties=null;
> initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true;
> useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false;
> dataSource=null; dataSourceJNDI=null; suspectTimeout=0;
> alternateUsernameAllowed=true; commitOnReturn=false;
> rollbackOnReturn=false; useDisposableConnectionFacade=true;
> logValidationErrors=false; propagateInterruptState=false;
> ignoreExceptionOnPreLoad=false; }
>
>
> 6.0.41 and 7.0.55:
>
> Name jdbc is not bound in this Context
>

You'll usually see this when the resource is not successfully created for
some reason.  Do you see any errors in the logs that might indicate a
problem with the resource?  Connection issue, missing JDBC driver, etc...

You can also see if the resource exists by looking for it through jconsole
or jvisualvm.  Can you confirm it exists?

Lastly you mentioned it's a global resource.  Can you confirm that there's
a resource link setup?

Dan


>
> That is a bug?
>
>
> We are having a issue in psi-probe because this behavior change (
> https://code.google.com/p/psi-probe/issues/detail?id=411).
>
>
> Thanks in advance.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message