Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2015-04-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Robert,

On 4/17/15 5:04 PM, Robert Anderson wrote:
> Issue fixed:
> 
> https://github.com/psi-probe/psi-probe/commit/9f233d0f0ccb02062f2b0947
10897b2a551d0ca5

Thanks
> 
for following-up with this one.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v2
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVMoYJAAoJEBzwKT+lPKRY0k4QAL1w2xUQ8bBWt3QzYwXVW1XV
iShhugwpHIc0FyjGftjMssneHDEAQwnfUAj8DiDY+SGejiEXnQj49/oYYA8tHZE5
r2dXW6KC5S1XD98OFI+04IjaTFlt+PzmpfYD45qedKfMzt5Yoc1qs8W3RYsEgPa2
CGnekbzjFy7t83wOxFoqKRMj6TMGSdkPT2OMkanlHuobd8tGxVCzo+MWSc7XCx8T
X2pHPVxZgo+pXsHBeVKh1S8L0aAEbd4GHO0yNEzhEawagQWALByTzGZIakq3HRuU
HzFOqTg1qUK+RxgAat7R/BTxY5SEg2dqW385/sujQ5Ka5J/XS6FlYjw481P+kA0a
kmjWcxad/TlLEdveZlvs85hehsgk5s1ukEbRGTrsPeoJk88jYOP8SaT8qXJlx0E9
3+Fa+vi2DNpjnddjG6dr0c6X/EqpHPYa1i4xZ3hwswLWBshioAPrn6nx2P6wqcP8
EzSj558TfBLrqm0n1kqdSSfSuXEWUt1NgPZKPve3nOvzfjZGCIASvRKwR04p2ZEy
YmpsPGVKM3BrZuy3Qbr6f5kVq5WpysRVLKLja8GRNwE4CYo4ejFhdrwWyWderFoI
vtN1B1VQnyOnpYHDY0k80FMiNavzTszH5Lxr6pmIdyQxF1hJAVQEeYMqaDjAQJIG
yncO+P1+2g0J4bzSqBQC
=2epX
-END PGP SIGNATURE-

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



Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2015-04-17 Thread Robert Anderson
Issue fixed:

https://github.com/psi-probe/psi-probe/commit/9f233d0f0ccb02062f2b094710897b2a551d0ca5



2014-09-04 11:07 GMT-03:00 Robert Anderson :

>
> 2014-09-04 10:57 GMT-03:00 Christopher Schultz <
> ch...@christopherschultz.net>:
>
>> I don't know. You could inspect a Subversion log between the two. It's
>> no fun, but it will show you what actually changed instead of what was
>> documented to have been changed.
>>
>
> It's exactly what I'm doing at this moment. :)
>


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-04 Thread Robert Anderson
2014-09-04 10:57 GMT-03:00 Christopher Schultz :

> I don't know. You could inspect a Subversion log between the two. It's
> no fun, but it will show you what actually changed instead of what was
> documented to have been changed.
>

It's exactly what I'm doing at this moment. :)


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Robert,

On 9/3/14 7:47 PM, Robert Anderson wrote:
> Does anybody here use psi-probe for monitoring the Tomcat?

Possibly, but your subject doesn't say anything about psi-probe, so
perhaps it's being ignored by those folks. I think it's more likely
that very few people use global JNDI resources.

> I just wanna know what changed in JNDI implemention of Tomcat.
> Where is the request in the bugzilla?

I don't know. You could inspect a Subversion log between the two. It's
no fun, but it will show you what actually changed instead of what was
documented to have been changed.

> Chris, global datasources (java:/name) and application datasources 
> (java:/comp/env/name) are differents in probe.

Gotcha - I didn't catch the global versus local in your OP.

> Application datasources are working very well in any version of
> Tomcat.

Good to know.

> Only the psi-probe cannot find global datasources to show in the 
> datasources.html.

:(

> Please read the issue: 
> https://code.google.com/p/psi-probe/issues/detail?id=411

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUCG+9AAoJEBzwKT+lPKRYQ4IQAMaWQt+3Vs+HADVERe0/JfIj
7Q0P1LSZc48+ta6C1swKJKeN9DNhmVSLGMWi0RZVGsmxz7lRzr59SY2OV9slc6lT
NaIvx0HR+4ctthFGWPXUSlurH8ys+eFN+amRwzccpzCRfU3dpyldiyO7vsTugYoP
Itlb74SVgUxsOJiyAyCJBGUK++rJW8PUFYZN0IzbKegSAyCYAqJC91ZYF10V/74L
2WuhxPn9x4LB6EIF8ZLepzxSLfidiufbD3KbtUZ6T05LJhQdQl/Qz0o/A7e08Zba
Dm01OPlvXdgHFwjjlZ0xzjXw/NZYfrCRN0jpwQ8vSb2uvCz7dZuXAnZwLEFskVd9
+PH262cjNytYW+ZSV2N4CTBf4PFTtvXOmiVy0VnnlCBTzXvbQqlp/gI7MuXByMtw
KsEtchdskFmypMa1bgk0Q/zeLkMaTmsGTjQdTHaAyy78neR/UUAyaJkuBKtOTmUt
lSx3LbL1oJvVAInJYNfLDvfrOZMSUBkAWPgfUNQ+I5hiRLwr6rFr5jKn5qgxhU9O
iZbpl/4yfQB1IyOormpy1pzdbEpbJZbvqk0gGBvs0OJVVULORAxtcUCE4B8YSx8A
Xv+1X10MwLlbSdRYqOeo1kzA+j0Z9uVsapgYwhpx2S5txxZjk4SZy2/6eZqIZlGQ
CYMiEe7gsAZcUA9uWKW1
=OzAk
-END PGP SIGNATURE-

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



Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Robert Anderson
Does anybody here use psi-probe for monitoring the Tomcat?

I just wanna know what changed in JNDI implemention of Tomcat. Where is the
request in the bugzilla?

Chris, global datasources (java:/name) and application datasources
(java:/comp/env/name) are differents in probe.

Application datasources are working very well in any version of Tomcat.
Only the psi-probe cannot find global datasources to show in the
datasources.html.

Please read the issue:
https://code.google.com/p/psi-probe/issues/detail?id=411

Thanks.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Robert,

On 9/3/14 11:36 AM, Robert Anderson wrote:
> 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");

All of the JNDI resources I've ever used have the name format like this:

  java:/comp/env/jdbc/cacheapp

Could the problem be that simple?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUB5EgAAoJEBzwKT+lPKRYsBMP/3lZJQvzshDraT+1ZzzoEK3I
s4QIGxew7m/9iquIqf1+SopPqG1aXMlNWhtG21iP6vYjx8jiZrsxL4TXCp8euoKY
ADF76yXrEO3A6WotAUPwQVAZKiXuS8QNv4XATzaEuf/RRPfJB8CDV4HDgX1b5e/9
Q/CAU/Z1+2yUTkVnBzKmdjtVbSlINU+V/rvzJswlW8Z7dBKMGMaBAFh+TQiW70u4
zYK3Oix2cWBV04iCJkmRpf0pPGu++UReZGWsfJ54wkkqSwYQmHPnTuwtcQDSGd06
MCQalbx4kilJqz8ISqyjG5++DINKbG/7EpnD85mDdl9g7YwguxlJKAIZ5A96CkTn
czjIhOytJ7JG2RLzAQ71JciXbI6QNePC9/BtVWLLILovCNMuPf+ij4CDfK5hEgBb
r0gIuJUI290qUFcIOoYAQPYRvFWapr0tRRD0O+IMqRK65z8uNWqLiYokyM/46Xd/
vWqIhsT7MLed1cJy+akYft85PX1OEq2UnBXkf9UY07q4ytWCaM9+Ll68TgJWH9QX
7aTe2enhwqptvs0+JgO8x1xUI7D8aE67PeH69SsHnIYxniRVP+9YS5kpCyimBN15
BEzOo/TpOkti1m2epMPJcOf3IlhglcTQKgHLHDb6SkfF2J9nhJM8gu88sJ/xxWlB
fep/qWNNtYJplVip82Hz
=P63B
-END PGP SIGNATURE-

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


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Robert,

On 9/3/14 11:36 AM, Robert Anderson wrote:
> 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");

All of the JNDI resources I've ever used have the name format like this:

  java:/comp/env/jdbc/cacheapp

Could the problem be that simple?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUB5EgAAoJEBzwKT+lPKRYsBMP/3lZJQvzshDraT+1ZzzoEK3I
s4QIGxew7m/9iquIqf1+SopPqG1aXMlNWhtG21iP6vYjx8jiZrsxL4TXCp8euoKY
ADF76yXrEO3A6WotAUPwQVAZKiXuS8QNv4XATzaEuf/RRPfJB8CDV4HDgX1b5e/9
Q/CAU/Z1+2yUTkVnBzKmdjtVbSlINU+V/rvzJswlW8Z7dBKMGMaBAFh+TQiW70u4
zYK3Oix2cWBV04iCJkmRpf0pPGu++UReZGWsfJ54wkkqSwYQmHPnTuwtcQDSGd06
MCQalbx4kilJqz8ISqyjG5++DINKbG/7EpnD85mDdl9g7YwguxlJKAIZ5A96CkTn
czjIhOytJ7JG2RLzAQ71JciXbI6QNePC9/BtVWLLILovCNMuPf+ij4CDfK5hEgBb
r0gIuJUI290qUFcIOoYAQPYRvFWapr0tRRD0O+IMqRK65z8uNWqLiYokyM/46Xd/
vWqIhsT7MLed1cJy+akYft85PX1OEq2UnBXkf9UY07q4ytWCaM9+Ll68TgJWH9QX
7aTe2enhwqptvs0+JgO8x1xUI7D8aE67PeH69SsHnIYxniRVP+9YS5kpCyimBN15
BEzOo/TpOkti1m2epMPJcOf3IlhglcTQKgHLHDb6SkfF2J9nhJM8gu88sJ/xxWlB
fep/qWNNtYJplVip82Hz
=P63B
-END PGP SIGNATURE-

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



Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Daniel Mikusa
On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson  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
>
> 
> 
>  type="javax.sql.DataSource" removeAbandoned="true"
> removeAbandonedTimeout="300"
>maxActive="10" maxIdle="2" minIdle="1"
> maxWait="1"
>validationQuery="select 1 from dual"
>testOnBorrow="true"
>validationInterval="0"
>username="_system" password="SYS"
> driverClassName="com.intersys.jdbc.CacheDriver"
>url="jdbc:Cache://localhost:1972/USER"/>
>
>   
> ...
>
> 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
>
> 
>   
>   
>   
>
>   
>
> 5) Start tomcat and go to  http://localhost:8080/probe/datasources.htm
>
> It will list global jndi resources.
>
>
> Instead of Tomcat 6.0.39, use 6.0.41 and probe will not list global jndi
> resources anymore.
>

I tried these steps with Tomcat 7.0.55 and was able to replicate the
problem.  I was also able to resolve the problem by adding a ResourceLink
tag.






I'm going to try with Tomcat 6.0.39 and 6.0.41 as well.

Dan



>
> Thanks.
>
>
>
> 2014-09-03 12:39 GMT-03:00 Filip Hanik :
>
> > 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 
> > 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) {
> > >  }
> > >  }
> > >
> > > %>
> > >
> > > 
> > > 
> > >   Test JNDI
> > > 
> > > 
> > >
> > > Teste JNDI
> > > 
> > > <%
> > > doLookup(out);
> > > %>
> > > 
> > >
> > > 
> > > 
> > >
> > >
> > > 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=1; testOnBorrow=true;
> > > testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> > > numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> > > 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.
> > >
> >
>


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Robert Anderson
2014-09-03 16:13 GMT-03:00 Daniel Mikusa :

> Do you see this being logged?


Yes.

Thanks, Felix. We'll analyze this solution.


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Daniel Mikusa
On Wed, Sep 3, 2014 at 2:33 PM, Robert Anderson  wrote:

> This is the complete code that was working:
>
> https://code.google.com/p/psi-probe/source/browse/trunk/core/src/main/java/com/googlecode/psiprobe/beans/ResourceResolverBean.java
>
>
> public List getApplicationResources() throws NamingException {
> logger.info("Reading GLOBAL resources");
> List resources = new ArrayList();
>
> MBeanServer server = getMBeanServer();
> if (server != null) {
> try {
> Set dsNames = server.queryNames(new ObjectName(
> "Catalina:type=Resource,resourcetype=Global,*"), null);
> for (Iterator it = dsNames.iterator(); it.hasNext();) {
> ObjectName objectName = (ObjectName) it.next();
> ApplicationResource resource = new ApplicationResource
> ();
>
> logger.info("reading resource: " + objectName);
>

Do you see this being logged?

Dan



> resource.setName(getStringAttribute(server, objectName,
> "name"));
> resource.setType(getStringAttribute(server, objectName,
> "type"));
> resource.setScope(getStringAttribute(server,
> objectName,
> "scope"));
> resource.setAuth(getStringAttribute(server, objectName,
> "auth"));
> resource.setDescription(getStringAttribute(server,
> objectName, "description"));
>
> lookupResource(resource, true, true);
>
> resources.add(resource);
> }
> } catch (Exception e) {
> logger.error("There was an error querying JMX server:", e);
> }
> }
> return resources;
> } public void lookupResource(ApplicationResource resource, boolean
> contextBound, boolean global) {
> DataSourceInfo dataSourceInfo = null;
> if (contextBound) {
> try {
> String jndiName = resolveJndiName(resource.getName(),
> global
> );
> Object o = new InitialContext().lookup(jndiName); //The
> exception is here
> resource.setLookedUp(true);
> for (Iterator it = datasourceMappers.iterator(); it.hasNext
> ();) {
> DatasourceAccessor accessor = (DatasourceAccessor) it.
> next();
> dataSourceInfo = accessor.getInfo(o);
> if (dataSourceInfo != null) {
> break;
> }
> }
>
> } catch (Throwable e) {
> resource.setLookedUp(false);
> dataSourceInfo = null;
> logger.error("Failed to lookup: " + resource.getName(), e);
> //
> // make sure we always re-throw ThreadDeath
> //
> if (e instanceof ThreadDeath) {
> throw (ThreadDeath) e;
> }
> }
> } else {
> resource.setLookedUp(false);
> }
>
> We are suspecting that this fix broke something:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=56451.
>
>
>
> 2014-09-03 15:25 GMT-03:00 Filip Hanik :
>
> > On Wed, Sep 3, 2014 at 11:09 AM, Robert Anderson 
> > 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: 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  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"  escreveu:
> > >
> > > > On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson  >
> > > > 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
> > > > >
> > > > > 
> > > > > 
> > > > >  > > > > type="javax.sql.DataSource" removeAbandoned="true"
> > > > > removeAbandonedTimeout="300"
> > > > >maxActive="10" maxIdle="2"
> > > minIdle="1"
> > > > > maxWait="1"
> > > > >validationQuery="select 1 from dual"
> > > > >testOnBorrow="true"
> > > > >validationInterval="0"
> > > > >username="_system"
> password="SYS"
> > > > > driverClassName="com.intersys.jdbc.CacheDriver"
> > > > >
> > > > url="jdbc:Cache://localhost:1972/USER"/>
> > > > >
> 

Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Felix Schumacher

Am 03.09.2014 um 20:33 schrieb Robert Anderson:

This is the complete code that was working:
https://code.google.com/p/psi-probe/source/browse/trunk/core/src/main/java/com/googlecode/psiprobe/beans/ResourceResolverBean.java


public List getApplicationResources() throws NamingException {
 logger.info("Reading GLOBAL resources");
 List resources = new ArrayList();

 MBeanServer server = getMBeanServer();
 if (server != null) {
 try {
 Set dsNames = server.queryNames(new ObjectName(
"Catalina:type=Resource,resourcetype=Global,*"), null);
 for (Iterator it = dsNames.iterator(); it.hasNext();) {
 ObjectName objectName = (ObjectName) it.next();
 ApplicationResource resource = new ApplicationResource
();

 logger.info("reading resource: " + objectName);
 resource.setName(getStringAttribute(server, objectName,
"name"));
 resource.setType(getStringAttribute(server, objectName,
"type"));
 resource.setScope(getStringAttribute(server, objectName,
"scope"));
 resource.setAuth(getStringAttribute(server, objectName,
"auth"));
 resource.setDescription(getStringAttribute(server,
objectName, "description"));

 lookupResource(resource, true, true);

 resources.add(resource);
 }
 } catch (Exception e) {
 logger.error("There was an error querying JMX server:", e);
 }
 }
 return resources;
 } public void lookupResource(ApplicationResource resource, boolean
contextBound, boolean global) {
 DataSourceInfo dataSourceInfo = null;
 if (contextBound) {
 try {
 String jndiName = resolveJndiName(resource.getName(), global
);
 Object o = new InitialContext().lookup(jndiName); //The
exception is here
 resource.setLookedUp(true);
 for (Iterator it = datasourceMappers.iterator(); it.hasNext
();) {
 DatasourceAccessor accessor = (DatasourceAccessor) it.
next();
 dataSourceInfo = accessor.getInfo(o);
 if (dataSourceInfo != null) {
 break;
 }
 }

 } catch (Throwable e) {
 resource.setLookedUp(false);
 dataSourceInfo = null;
 logger.error("Failed to lookup: " + resource.getName(), e);
 //
 // make sure we always re-throw ThreadDeath
 //
 if (e instanceof ThreadDeath) {
 throw (ThreadDeath) e;
 }
 }
 } else {
 resource.setLookedUp(false);
 }

We are suspecting that this fix broke something:
https://issues.apache.org/bugzilla/show_bug.cgi?id=56451.
You could use the code from the ManagerServlet which is a 
ContainerServlet and gets access to the Context (catalina not servlet).


Or you could use a valve and get the context from the request (both 
catalina ones). From that context you can get to its parent (a host) to 
its parent (an engine) and from there to the service and its server. 
From that server you can get the global naming context which might be 
what you want.


The code from ManagerServlet looks like this

// Acquire global JNDI resources if available
Server server = 
((Engine)host.getParent()).getService().getServer();

if (server != null) {
global = server.getGlobalNamingContext();
}

In a Valve you can get it the host in the invoke(Request req, Response 
res) method with


  Host host = (Host) req.getContext().getParent();

Regards
 Felix




2014-09-03 15:25 GMT-03:00 Filip Hanik :


On Wed, Sep 3, 2014 at 11:09 AM, Robert Anderson 
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: 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  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"  escreveu:


On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson 
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



 
minIdle="1"

maxWait="1"
validationQuery="select 1 from dual"
testOnBorrow="true"
 

Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Robert Anderson
This behavior began in versions 6.0.41 and 7.0.54. Before that, everything
worked as expected.


2014-09-03 15:33 GMT-03:00 Robert Anderson :

> This is the complete code that was working:
> https://code.google.com/p/psi-probe/source/browse/trunk/core/src/main/java/com/googlecode/psiprobe/beans/ResourceResolverBean.java
>
>
>  public List getApplicationResources() throws NamingException {
> logger.info("Reading GLOBAL resources");
> List resources = new ArrayList();
>
> MBeanServer server = getMBeanServer();
> if (server != null) {
> try {
> Set dsNames = server.queryNames(new ObjectName(
> "Catalina:type=Resource,resourcetype=Global,*"), null);
> for (Iterator it = dsNames.iterator(); it.hasNext();) {
> ObjectName objectName = (ObjectName) it.next();
> ApplicationResource resource = new ApplicationResource
> ();
>
> logger.info("reading resource: " + objectName);
> resource.setName(getStringAttribute(server, objectName
> , "name"));
> resource.setType(getStringAttribute(server, objectName
> , "type"));
> resource.setScope(getStringAttribute(server,
> objectName, "scope"));
> resource.setAuth(getStringAttribute(server, objectName
> , "auth"));
> resource.setDescription(getStringAttribute(server,
> objectName, "description"));
>
> lookupResource(resource, true, true);
>
> resources.add(resource);
> }
> } catch (Exception e) {
> logger.error("There was an error querying JMX server:", e
> );
> }
> }
> return resources;
> } public void lookupResource(ApplicationResource resource, boolean
> contextBound, boolean global) {
> DataSourceInfo dataSourceInfo = null;
> if (contextBound) {
> try {
> String jndiName = resolveJndiName(resource.getName(),
> global);
> Object o = new InitialContext().lookup(jndiName); //The
> exception is here
> resource.setLookedUp(true);
> for (Iterator it = datasourceMappers.iterator(); it.
> hasNext();) {
> DatasourceAccessor accessor = (DatasourceAccessor) it.
> next();
> dataSourceInfo = accessor.getInfo(o);
> if (dataSourceInfo != null) {
> break;
> }
> }
>
> } catch (Throwable e) {
> resource.setLookedUp(false);
> dataSourceInfo = null;
> logger.error("Failed to lookup: " + resource.getName(), e
> );
> //
> // make sure we always re-throw ThreadDeath
> //
> if (e instanceof ThreadDeath) {
> throw (ThreadDeath) e;
> }
> }
> } else {
> resource.setLookedUp(false);
> }
>
> We are suspecting that this fix broke something:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=56451.
>
>
>
> 2014-09-03 15:25 GMT-03:00 Filip Hanik :
>
> On Wed, Sep 3, 2014 at 11:09 AM, Robert Anderson 
>> 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: 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  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"  escreveu:
>> >
>> > > On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson 
>> > > 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
>> > > >
>> > > > 
>> > > > 
>> > > > > > > > type="javax.sql.DataSource" removeAbandoned="true"
>> > > > removeAbandonedTimeout="300"
>> > > >maxActive="10" maxIdle="2"
>> > minIdle="1"
>> > > > maxWait="1"
>> > > >validationQuery="select 1 from dual"
>> > > >testOnBorrow="true"
>> > > >validationInterval="0"
>> > > >username="_system" password="SYS"
>> > > > driverClassName="com.intersys.jdbc.CacheDriver"
>> > > >
>> > > url="jdbc:Cache://localhost:1972/USER"/>
>> > > >
>> > > >   
>> >

Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Robert Anderson
This is the complete code that was working:
https://code.google.com/p/psi-probe/source/browse/trunk/core/src/main/java/com/googlecode/psiprobe/beans/ResourceResolverBean.java


public List getApplicationResources() throws NamingException {
logger.info("Reading GLOBAL resources");
List resources = new ArrayList();

MBeanServer server = getMBeanServer();
if (server != null) {
try {
Set dsNames = server.queryNames(new ObjectName(
"Catalina:type=Resource,resourcetype=Global,*"), null);
for (Iterator it = dsNames.iterator(); it.hasNext();) {
ObjectName objectName = (ObjectName) it.next();
ApplicationResource resource = new ApplicationResource
();

logger.info("reading resource: " + objectName);
resource.setName(getStringAttribute(server, objectName,
"name"));
resource.setType(getStringAttribute(server, objectName,
"type"));
resource.setScope(getStringAttribute(server, objectName,
"scope"));
resource.setAuth(getStringAttribute(server, objectName,
"auth"));
resource.setDescription(getStringAttribute(server,
objectName, "description"));

lookupResource(resource, true, true);

resources.add(resource);
}
} catch (Exception e) {
logger.error("There was an error querying JMX server:", e);
}
}
return resources;
} public void lookupResource(ApplicationResource resource, boolean
contextBound, boolean global) {
DataSourceInfo dataSourceInfo = null;
if (contextBound) {
try {
String jndiName = resolveJndiName(resource.getName(), global
);
Object o = new InitialContext().lookup(jndiName); //The
exception is here
resource.setLookedUp(true);
for (Iterator it = datasourceMappers.iterator(); it.hasNext
();) {
DatasourceAccessor accessor = (DatasourceAccessor) it.
next();
dataSourceInfo = accessor.getInfo(o);
if (dataSourceInfo != null) {
break;
}
}

} catch (Throwable e) {
resource.setLookedUp(false);
dataSourceInfo = null;
logger.error("Failed to lookup: " + resource.getName(), e);
//
// make sure we always re-throw ThreadDeath
//
if (e instanceof ThreadDeath) {
throw (ThreadDeath) e;
}
}
} else {
resource.setLookedUp(false);
}

We are suspecting that this fix broke something:
https://issues.apache.org/bugzilla/show_bug.cgi?id=56451.



2014-09-03 15:25 GMT-03:00 Filip Hanik :

> On Wed, Sep 3, 2014 at 11:09 AM, Robert Anderson 
> 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: 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  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"  escreveu:
> >
> > > On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson 
> > > 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
> > > >
> > > > 
> > > > 
> > > >  > > > type="javax.sql.DataSource" removeAbandoned="true"
> > > > removeAbandonedTimeout="300"
> > > >maxActive="10" maxIdle="2"
> > minIdle="1"
> > > > maxWait="1"
> > > >validationQuery="select 1 from dual"
> > > >testOnBorrow="true"
> > > >validationInterval="0"
> > > >username="_system" password="SYS"
> > > > driverClassName="com.intersys.jdbc.CacheDriver"
> > > >
> > > url="jdbc:Cache://localhost:1972/USER"/>
> > > >
> > > >   
> > > > ...
> > > >
> > > > 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
> > > >
> > > > 
> > > >   
> > > >   
> > > >   
> > > >
> > > >   
> > > >
> > > > 5) Start tomcat and go to
> http://localhos

Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Filip Hanik
On Wed, Sep 3, 2014 at 11:09 AM, Robert Anderson  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: 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  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"  escreveu:
>
> > On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson 
> > 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
> > >
> > > 
> > > 
> > >  > > type="javax.sql.DataSource" removeAbandoned="true"
> > > removeAbandonedTimeout="300"
> > >maxActive="10" maxIdle="2"
> minIdle="1"
> > > maxWait="1"
> > >validationQuery="select 1 from dual"
> > >testOnBorrow="true"
> > >validationInterval="0"
> > >username="_system" password="SYS"
> > > driverClassName="com.intersys.jdbc.CacheDriver"
> > >
> > url="jdbc:Cache://localhost:1972/USER"/>
> > >
> > >   
> > > ...
> > >
> > > 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
> > >
> > > 
> > >   
> > >   
> > >   
> > >
> > >   
> > >
> > > 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 :
> > >
> > > > 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 
> > > > 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) {
> > > > >  }
> > > > >  }
> > > > >
> > > > > %>
> > > > >
> > > > > 
> > > > > 
> > > > >   Test JNDI
> > > > > 
> > > > > 
> > > > >
> > > > > Teste JNDI
> > > > > 
> > > > > <%
> > > > > doLookup(out);
> > > > > %>
> > > > > 
> > > > >
> > > > > 
> > > > > 
> > > > >
> > > > >
> > > > > 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=1; testOnBorrow=true;
> > > > > testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> > > > > numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> > > > > 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; logAban

Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Daniel Mikusa
On Wed, Sep 3, 2014 at 1:09 PM, Robert Anderson  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?
>

Hard to say because I don't know the application's code, so I'm not sure
what it is doing.  It's a pretty safe bet it isn't pulling that information
from JNDI though (because there aren't any resource links).  However it's
doing this, it would seem that something has changed and broke the app.
 Attaching a debugger and seeing what happens when you hit that URL might
give you some more details.

Dan


> Tomcat is not bind in java: anymore. Was it a feature request
> or is it a bug?
> Em 03/09/2014 13:48, "Daniel Mikusa"  escreveu:
>
> > On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson 
> > 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
> > >
> > > 
> > > 
> > >  > > type="javax.sql.DataSource" removeAbandoned="true"
> > > removeAbandonedTimeout="300"
> > >maxActive="10" maxIdle="2"
> minIdle="1"
> > > maxWait="1"
> > >validationQuery="select 1 from dual"
> > >testOnBorrow="true"
> > >validationInterval="0"
> > >username="_system" password="SYS"
> > > driverClassName="com.intersys.jdbc.CacheDriver"
> > >
> > url="jdbc:Cache://localhost:1972/USER"/>
> > >
> > >   
> > > ...
> > >
> > > 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
> > >
> > > 
> > >   
> > >   
> > >   
> > >
> > >   
> > >
> > > 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 :
> > >
> > > > 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 
> > > > 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) {
> > > > >  }
> > > > >  }
> > > > >
> > > > > %>
> > > > >
> > > > > 
> > > > > 
> > > > >   Test JNDI
> > > > > 
> > > > > 
> > > > >
> > > > > Teste JNDI
> > > > > 
> > > > > <%
> > > > > doLookup(out);
> > > > > %>
> > > > > 
> > > > >
> > > > > 
> > > > > 
> > > > >
> > > > >
> > > > > 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=1; testOnBorrow=true;
> > > > > testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> > > > > numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> > > > > 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=tr

Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Robert Anderson
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: anymore. Was it a feature request
or is it a bug?
Em 03/09/2014 13:48, "Daniel Mikusa"  escreveu:

> On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson 
> 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
> >
> > 
> > 
> >  > type="javax.sql.DataSource" removeAbandoned="true"
> > removeAbandonedTimeout="300"
> >maxActive="10" maxIdle="2" minIdle="1"
> > maxWait="1"
> >validationQuery="select 1 from dual"
> >testOnBorrow="true"
> >validationInterval="0"
> >username="_system" password="SYS"
> > driverClassName="com.intersys.jdbc.CacheDriver"
> >
> url="jdbc:Cache://localhost:1972/USER"/>
> >
> >   
> > ...
> >
> > 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
> >
> > 
> >   
> >   
> >   
> >
> >   
> >
> > 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 :
> >
> > > 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 
> > > 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) {
> > > >  }
> > > >  }
> > > >
> > > > %>
> > > >
> > > > 
> > > > 
> > > >   Test JNDI
> > > > 
> > > > 
> > > >
> > > > Teste JNDI
> > > > 
> > > > <%
> > > > doLookup(out);
> > > > %>
> > > > 
> > > >
> > > > 
> > > > 
> > > >
> > > >
> > > > 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=1; testOnBorrow=true;
> > > > testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> > > > numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> > > > 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 (
> 

Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Daniel Mikusa
On Wed, Sep 3, 2014 at 11:51 AM, Robert Anderson  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
>
> 
> 
>  type="javax.sql.DataSource" removeAbandoned="true"
> removeAbandonedTimeout="300"
>maxActive="10" maxIdle="2" minIdle="1"
> maxWait="1"
>validationQuery="select 1 from dual"
>testOnBorrow="true"
>validationInterval="0"
>username="_system" password="SYS"
> driverClassName="com.intersys.jdbc.CacheDriver"
>url="jdbc:Cache://localhost:1972/USER"/>
>
>   
> ...
>
> 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
>
> 
>   
>   
>   
>
>   
>
> 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 :
>
> > 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 
> > 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) {
> > >  }
> > >  }
> > >
> > > %>
> > >
> > > 
> > > 
> > >   Test JNDI
> > > 
> > > 
> > >
> > > Teste JNDI
> > > 
> > > <%
> > > doLookup(out);
> > > %>
> > > 
> > >
> > > 
> > > 
> > >
> > >
> > > 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=1; testOnBorrow=true;
> > > testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> > > numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> > > 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.
> > >
> >
>


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Robert Anderson
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





  
...

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


  
  
  

  

5) Start tomcat and go to  http://localhost:8080/probe/datasources.htm

It will list global jndi resources.


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 :

> 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 
> 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) {
> >  }
> >  }
> >
> > %>
> >
> > 
> > 
> >   Test JNDI
> > 
> > 
> >
> > Teste JNDI
> > 
> > <%
> > doLookup(out);
> > %>
> > 
> >
> > 
> > 
> >
> >
> > 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=1; testOnBorrow=true;
> > testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> > numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> > 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.
> >
>


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Daniel Mikusa
On Wed, Sep 3, 2014 at 11:36 AM, Robert Anderson  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) {
>  }
>  }
>
> %>
>
> 
> 
>   Test JNDI
> 
> 
>
> Teste JNDI
> 
> <%
> doLookup(out);
> %>
> 
>
> 
> 
>
>
> 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=1; testOnBorrow=true;
> testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> 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.
>


Re: Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Filip Hanik
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  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) {
>  }
>  }
>
> %>
>
> 
> 
>   Test JNDI
> 
> 
>
> Teste JNDI
> 
> <%
> doLookup(out);
> %>
> 
>
> 
> 
>
>
> 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=1; testOnBorrow=true;
> testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
> numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
> 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.
>


Global JNDI resources lookup behavior difference between version 6.0.39 and 6.0.41/7.0.55

2014-09-03 Thread Robert Anderson
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) {
 }
 }

%>



  Test JNDI



Teste JNDI

<%
doLookup(out);
%>






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=1; testOnBorrow=true;
testOnReturn=false; timeBetweenEvictionRunsMillis=5000;
numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=6;
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.