tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik <fi...@hanik.com>
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 18:25:34 GMT
On Wed, Sep 3, 2014 at 11:09 AM, Robert Anderson <ranomail@gmail.com> wrote:

> Thanks, Daniel. But my question the question is why that was working in
> 6.0.39 and the firsts releases of 7.0.x?
> Tomcat is not bind in java:<global name> anymore. Was it a feature request
> or is it a bug?
>

‚ÄčNot sure, the resource links have been around for a long time. It may have
been a security feature to not expose .
However, I'm sure there was a reason for it, and very unlikely it will
change back
You can get around it by adding a <ResourceLink> element in your
conf/context.xml, as this setting will apply to all your apps deployed.

Filip



> Em 03/09/2014 13:48, "Daniel Mikusa" <dmikusa@pivotal.io> escreveu:
>
> > On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson <ranomail@gmail.com>
> > wrote:
> >
> > > Ok! :)
> > >
> > > Steps to reproduce:
> > >
> > > 1)Download and unpack 6.0.39
> > >
> > >
> > >
> >
> http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.39/bin/apache-tomcat-6.0.39.tar.gz
> > >
> > > 2) Create a global jndi resouce in server.xml
> > >
> > > ....
> > > <GlobalNamingResources>
> > >         <Resource name="jdbc/cacheapp" auth="Container"
> > > type="javax.sql.DataSource" removeAbandoned="true"
> > > removeAbandonedTimeout="300"
> > >                                    maxActive="10" maxIdle="2"
> minIdle="1"
> > > maxWait="10000"
> > >                    validationQuery="select 1 from dual"
> > >                    testOnBorrow="true"
> > >                                    validationInterval="0"
> > >                                    username="_system" password="SYS"
> > > driverClassName="com.intersys.jdbc.CacheDriver"
> > >
> > url="jdbc:Cache://localhost:1972/USER"/>
> > >
> > >   </GlobalNamingResources>
> > > ...
> > >
> > > 3) Install psi-probe:
> > >
> >
> https://code.google.com/p/psi-probe/downloads/detail?name=probe-2.3.3.zip,
> > > unpack and copy probe.war to webapps dir;
> > >
> > > 4)  Edit tomcat-users.xml
> > >
> > > <role rolename="probeuser" />
> > >   <role rolename="poweruser" />
> > >   <role rolename="poweruserplus" />
> > >   <role rolename="manager" />
> > >
> > >   <user username="admin" password="t0psecret" roles="manager" />
> > >
> > > 5) Start tomcat and go to  http://localhost:8080/probe/datasources.htm
> > >
> > > It will list global jndi resources.
> > >
> >
> > I think the question is how does it list these?  You haven't added any
> > resource links, so technically there are no resources available to your
> > application through JNDI.  See the Introduction section here, which
> states
> > why resource links are necessary.
> >
> >
> >
> >
> http://tomcat.apache.org/tomcat-7.0-doc/config/globalresources.html#Introduction
> >
> > Have you tried looking at your running 6.0.41 server, connecting with JMX
> > and looking at the MBeans?  Is your database connection pool resources
> > actually available?
> >
> > Dan
> >
> >
> > > Instead of Tomcat 6.0.39, use 6.0.41 and probe will not list global
> jndi
> > > resources anymore.
> > >
> > >
> > > Thanks.
> > >
> > >
> > >
> > > 2014-09-03 12:39 GMT-03:00 Filip Hanik <filip@hanik.com>:
> > >
> > > > can you post your configuration file. that will be the only way we
> can
> > > help
> > > > you fix it, as I doubt tomcat will go back to pre 6.0.41 days :)
> > > >
> > > > Filip
> > > >
> > > >
> > > >
> > > > On Wed, Sep 3, 2014 at 9: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
> > > > >
> > > > > 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