Re: FW: Issue with Tomcat Version 7.0.64

2015-10-14 Thread Mark Thomas
On 14/10/2015 05:25, kasturi wrote:
> Hi Christopher,
> 
> Apologies for the formatting issue. Hope the below shared details helps 
> clarify the issue.
> 
> Our application has a customized valve called CiscoSSOValve.java which 
> extends SingleSignOn.java of catalina.jar. 
> SingleSignOn.java of catalina.jar has gone in some changes in 7.0.64. PFB the 
> list of changes for which we are facing issues.
> 
> 1. sessionEvent() method which existed in earlier releases is not present any 
> more. We are overriding this method in our customized valve, hence facing 
> compilation error where it tries to do a super.sessionEvent(event) call.
> 2. A new class SingleSignOnListener.java has been introduced in 7.0.64 having 
> the same sessionEvent() method mentioned in issue 1. We tried using this 
> method but unable to do so as its constructor requires a valid 'SSOId' to be 
> passed.
> 3. 'SSOId' was earlier retrievable from 'reverse' map of SingleSignOn.java 
> class. This map is not present in the 7.0.64 release, so we are unable to 
> fetch the 'SSOId' here and pass it in the call to constructor of 
> SingleSignOnListener.java as a workaround for issue1.

Looks like you need to do the following:

Write a custom class that extends SingleSignOnListener and over-ride the
sessionEvent() as necessary.

In CiscoSSOValve, over-ride getSessionListener(String) and return your
custom listener instead.

Mark


> 
> Compilation errors we are facing are:
> 
> [javac] 
> /data/shared_ws/jasper/kneogy_stashNew/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:91:
>  error: cannot find symbol
> [javac] synchronized (reverse) {
> [javac]   ^
> [javac]   symbol:   variable reverse
> [javac]   location: class CiscoSSOValve
> [javac] 
> /data/shared_ws/jasper/kneogy_stashNew/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:92:
>  error: cannot find symbol
> [javac] ssoId = reverse.get(session);
> [javac] ^
> [javac]   symbol:   variable reverse
> [javac]   location: class CiscoSSOValve
> [javac] 
> /auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CLNX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:98:
>  error: cannot find symbol
> [javac] super.sessionEvent(event);
> [javac]  ^
> [javac]   symbol: method sessionEvent(SessionEvent)
> [javac] 
> /auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CLNX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:100:
>  error: cannot find symbol
> [javac] if(null != lookup(ssoId))
> [javac]^
> [javac]   symbol:   method lookup(String)
> [javac]   location: class CiscoSSOValve
> [javac] 
> /auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CLNX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:149:
>  error: associate(String,Session) in CiscoSSOValve cannot override 
> associate(String,Session) in SingleSignOn
> [javac] protected void associate(String ssoId, Session session) {
> [javac]^
> [javac]   return type void is not compatible with boolean
> 
> 
> Thanks and regards,
> Kasturi
> 
> 
> 
> -Original Message-
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
> Sent: Wednesday, October 14, 2015 1:50 AM
> To: Tomcat Users List
> Subject: Re: Issue with Tomcat Version 7.0.64
> 
> Kasturi,
> 
> On 10/13/15 9:59 AM, kasturi wrote:
>> We have recently upgraded Tomcat to 7.0.64 from 7.0.59. Our 
>> application extends SingleSignOn.java of catalina.jar to create a 
>> wrapper around it. Some methods in the SingleSignOn.java class has 
>> been deprecated because of which the compilation is failing.
>> Details shared below.
> 
>> Catalina 7.0.59
> 
>> Catalina 7.0.64
> 
> The list has ruined your formatting. Can you post with a text-only message?
> 
>> //SingleSingOn Class
> 
>> protected Map<Session, String> reverse = new HashMap();
> 
>> public void sessionEvent(SessionEvent event)
> 
>> {
> 
>> if (!getState().isAvailable()) {
> 
>> return;
> 
>> }
> 
>> if ((!"destroySession".equals(event.getType())) &&
>> (!"passivateSession".equals(event.getType( {
> 
>> return;
> 
>> }
> 
>> Session session = event.getSession();
> 
>&

FW: Issue with Tomcat Version 7.0.64

2015-10-13 Thread kasturi
Hi Christopher,

Apologies for the formatting issue. Hope the below shared details helps clarify 
the issue.

Our application has a customized valve called CiscoSSOValve.java which extends 
SingleSignOn.java of catalina.jar. 
SingleSignOn.java of catalina.jar has gone in some changes in 7.0.64. PFB the 
list of changes for which we are facing issues.

1. sessionEvent() method which existed in earlier releases is not present any 
more. We are overriding this method in our customized valve, hence facing 
compilation error where it tries to do a super.sessionEvent(event) call.
2. A new class SingleSignOnListener.java has been introduced in 7.0.64 having 
the same sessionEvent() method mentioned in issue 1. We tried using this method 
but unable to do so as its constructor requires a valid 'SSOId' to be passed.
3. 'SSOId' was earlier retrievable from 'reverse' map of SingleSignOn.java 
class. This map is not present in the 7.0.64 release, so we are unable to fetch 
the 'SSOId' here and pass it in the call to constructor of 
SingleSignOnListener.java as a workaround for issue1.

Compilation errors we are facing are:

[javac] 
/data/shared_ws/jasper/kneogy_stashNew/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:91:
 error: cannot find symbol
[javac] synchronized (reverse) {
[javac]   ^
[javac]   symbol:   variable reverse
[javac]   location: class CiscoSSOValve
[javac] 
/data/shared_ws/jasper/kneogy_stashNew/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:92:
 error: cannot find symbol
[javac] ssoId = reverse.get(session);
[javac] ^
[javac]   symbol:   variable reverse
[javac]   location: class CiscoSSOValve
[javac] 
/auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CLNX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:98:
 error: cannot find symbol
[javac] super.sessionEvent(event);
[javac]  ^
[javac]   symbol: method sessionEvent(SessionEvent)
[javac] 
/auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CLNX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:100:
 error: cannot find symbol
[javac] if(null != lookup(ssoId))
[javac]^
[javac]   symbol:   method lookup(String)
[javac]   location: class CiscoSSOValve
[javac] 
/auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CLNX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/tomcat/valve/CiscoSSOValve.java:149:
 error: associate(String,Session) in CiscoSSOValve cannot override 
associate(String,Session) in SingleSignOn
[javac] protected void associate(String ssoId, Session session) {
[javac]^
[javac]   return type void is not compatible with boolean


Thanks and regards,
Kasturi



-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Wednesday, October 14, 2015 1:50 AM
To: Tomcat Users List
Subject: Re: Issue with Tomcat Version 7.0.64

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Kasturi,

On 10/13/15 9:59 AM, kasturi wrote:
> We have recently upgraded Tomcat to 7.0.64 from 7.0.59. Our 
> application extends SingleSignOn.java of catalina.jar to create a 
> wrapper around it. Some methods in the SingleSignOn.java class has 
> been deprecated because of which the compilation is failing.
> Details shared below.
> 
> Catalina 7.0.59
> 
> Catalina 7.0.64

The list has ruined your formatting. Can you post with a text-only message?

> //SingleSingOn Class
> 
> protected Map<Session, String> reverse = new HashMap();
> 
> public void sessionEvent(SessionEvent event)
> 
> {
> 
> if (!getState().isAvailable()) {
> 
> return;
> 
> }
> 
> if ((!"destroySession".equals(event.getType())) &&
> (!"passivateSession".equals(event.getType( {
> 
> return;
> 
> }
> 
> Session session = event.getSession();
> 
> if (this.containerLog.isDebugEnabled()) {
> 
> this.containerLog.debug("Process session destroyed on " + session);
> 
> }
> 
> String ssoId = null;
> 
> synchronized (this.reverse)
> 
> {
> 
> ssoId = (String)this.reverse.get(session);
> 
> }
> 
> if (ssoId == null) {
> 
> return;
> 
> }
> 
> if (((session.getMaxInactiveInterval() > 0) &&
> (System.currentTimeMillis() - session.getThisAccessedTimeInternal()
> >= session.getMaxInactiveInterval() * 1000)) ||
> ("passivateSession".equals(event.getType())) ||
> (!session.getManager().getContainer().getState().isAvailable())) {
> 
> removeSe

Issue with Tomcat Version 7.0.64

2015-10-13 Thread kasturi
Hi,

 

We have recently upgraded Tomcat to 7.0.64 from 7.0.59. Our application
extends SingleSignOn.java of catalina.jar to create a wrapper around it.
Some methods in the SingleSignOn.java class has been deprecated because of
which the compilation is failing. Details shared below.

 

 


Catalina 7.0.59

Catalina 7.0.64


 

//SingleSingOn Class

 

 

protected Map reverse = new HashMap();

 

 

public void sessionEvent(SessionEvent event)

  {

if (!getState().isAvailable()) {

  return;

}

if ((!"destroySession".equals(event.getType())) &&
(!"passivateSession".equals(event.getType( {

  return;

}

Session session = event.getSession();

if (this.containerLog.isDebugEnabled()) {

  this.containerLog.debug("Process session destroyed on " + session);

}

String ssoId = null;

synchronized (this.reverse)

{

  ssoId = (String)this.reverse.get(session);

}

if (ssoId == null) {

  return;

}

if (((session.getMaxInactiveInterval() > 0) &&
(System.currentTimeMillis() - session.getThisAccessedTimeInternal() >=
session.getMaxInactiveInterval() * 1000)) ||
("passivateSession".equals(event.getType())) ||
(!session.getManager().getContainer().getState().isAvailable())) {

  removeSession(ssoId, session);

} else {

  deregister(ssoId);

}

  }

 

 

 

 

//SingleSingOn Class

 

Reverse Map does not exist

 

sessionEvent() Method does not exist

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This new class has been introduced, but we cannot extend this class as we
are already extending "SingleSignOn" class. 

 

Also, to instantiate this class "SSOID" is required, as its constructor
expects it. We are not sure what to pass here to instantiate it.

 

 

//SingleSignOnListener

 

public void sessionEvent(SessionEvent event)

  {

if (!"destroySession".equals(event.getType())) {

  return;

}

Session session = event.getSession();

Manager manager = session.getManager();

if (manager == null) {

  return;

}

Context context = (Context)manager.getContainer();

if (context == null) {

  return;

}

Authenticator authenticator = context.getAuthenticator();

if (!(authenticator instanceof AuthenticatorBase)) {

  return;

}

SingleSignOn sso = ((AuthenticatorBase)authenticator).sso;

if (sso == null) {

  return;

}

sso.sessionDestroyed(this.ssoId, session);

  }

}

 

 

 

 

 

//Our Code

 

public class CiscoSSOValve extends SingleSignOn   >> Extending Catalina
Class

{

 

public void sessionEvent(SessionEvent event) {

 

if(sNumTokens == 0) {

super.sessionEvent(event);>>
Overloading sessionEvent which does not exists in new Jar.

return;

}

 

// We only care about session destroyed events

if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())

&&
(!Session.SESSION_PASSIVATED_EVENT.equals(event.getType({

super.sessionEvent(event);

return;

}

 

 

Compilation Error

 

@

"ucxn_build_stash.pl.log" [noeol] 20853L, 2963854C
1,1   Top

[javac]   symbol:   variable reverse

[javac]   location: class CiscoSSOValve

[javac]
/auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CL
NX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/t
omcat/valve/CiscoSSOValve.java:98: error: cannot find symbol

[javac] super.sessionEvent(event); 

[javac]  ^

[javac]   symbol: method sessionEvent(SessionEvent)

[javac]
/auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CL
NX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/t
omcat/valve/CiscoSSOValve.java:100: error: cannot find symbol

[javac] if(null != lookup(ssoId)) { 

[javac]^

[javac]   symbol:   method lookup(String)

[javac]   location: class CiscoSSOValve

[javac]
/auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnection/CL
NX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/unity/t
omcat/valve/CiscoSSOValve.java:149: error: associate(String,Session) in
CiscoSSOValve cannot override associate(String,Session) in SingleSignOn

[javac] protected void associate(String ssoId, Session session) {

[javac]^

[javac]   return type void is not compatible with boolean

[javac] 7 errors

 

 

 

We need assistance on below points:

1.   How to fetch the SSOId corresponding to a session as 'reverse' map
does not exists any more.

2.   How does the call flow happen of SingleSignOn methods? 

 

 

Thanks and regards,

Kasturi.



Re: Issue with Tomcat Version 7.0.64

2015-10-13 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Kasturi,

On 10/13/15 9:59 AM, kasturi wrote:
> We have recently upgraded Tomcat to 7.0.64 from 7.0.59. Our
> application extends SingleSignOn.java of catalina.jar to create a
> wrapper around it. Some methods in the SingleSignOn.java class has
> been deprecated because of which the compilation is failing.
> Details shared below.
> 
> Catalina 7.0.59
> 
> Catalina 7.0.64

The list has ruined your formatting. Can you post with a text-only
message?

> //SingleSingOn Class
> 
> protected Map reverse = new HashMap();
> 
> public void sessionEvent(SessionEvent event)
> 
> {
> 
> if (!getState().isAvailable()) {
> 
> return;
> 
> }
> 
> if ((!"destroySession".equals(event.getType())) && 
> (!"passivateSession".equals(event.getType( {
> 
> return;
> 
> }
> 
> Session session = event.getSession();
> 
> if (this.containerLog.isDebugEnabled()) {
> 
> this.containerLog.debug("Process session destroyed on " +
> session);
> 
> }
> 
> String ssoId = null;
> 
> synchronized (this.reverse)
> 
> {
> 
> ssoId = (String)this.reverse.get(session);
> 
> }
> 
> if (ssoId == null) {
> 
> return;
> 
> }
> 
> if (((session.getMaxInactiveInterval() > 0) && 
> (System.currentTimeMillis() - session.getThisAccessedTimeInternal()
> >= session.getMaxInactiveInterval() * 1000)) || 
> ("passivateSession".equals(event.getType())) || 
> (!session.getManager().getContainer().getState().isAvailable())) {
> 
> removeSession(ssoId, session);
> 
> } else {
> 
> deregister(ssoId);
> 
> }
> 
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> //SingleSingOn Class
> 
> 
> 
> Reverse Map does not exist

That doesn't look like a compiler message.

> sessionEvent() Method does not exist

Nor does this. Can you post actual compiler output?

> This new class has been introduced, but we cannot extend this class
> as we are already extending "SingleSignOn" class.

What new class?

> Also, to instantiate this class "SSOID" is required, as its
> constructor expects it. We are not sure what to pass here to
> instantiate it.

Which class requires SSOID to instantiate it? This class has a no-arg
constructor in 7.0.64:

http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_64/java/org/
apache/catalina/authenticator/SingleSignOn.java?view=markup

> //SingleSignOnListener
> 
> 
> 
> public void sessionEvent(SessionEvent event)
> 
> {
> 
> if (!"destroySession".equals(event.getType())) {
> 
> return;
> 
> }
> 
> Session session = event.getSession();
> 
> Manager manager = session.getManager();
> 
> if (manager == null) {
> 
> return;
> 
> }
> 
> Context context = (Context)manager.getContainer();
> 
> if (context == null) {
> 
> return;
> 
> }
> 
> Authenticator authenticator = context.getAuthenticator();
> 
> if (!(authenticator instanceof AuthenticatorBase)) {
> 
> return;
> 
> }
> 
> SingleSignOn sso = ((AuthenticatorBase)authenticator).sso;
> 
> if (sso == null) {
> 
> return;
> 
> }
> 
> sso.sessionDestroyed(this.ssoId, session);
> 
> }
> 
> }
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> //Our Code
> 
> 
> 
> public class CiscoSSOValve extends SingleSignOn   >> Extending
> Catalina Class
> 
> {
> 
> 
> 
> public void sessionEvent(SessionEvent event) {
> 
> 
> 
> if(sNumTokens == 0) {
> 
> super.sessionEvent(event);>> 
> Overloading sessionEvent which does not exists in new Jar.
> 
> return;
> 
> }
> 
> 
> 
> // We only care about session destroyed events
> 
> if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())
> 
> && (!Session.SESSION_PASSIVATED_EVENT.equals(event.getType({
> 
> super.sessionEvent(event);
> 
> return;
> 
> }
> 
> 
> 
> 
> 
> Compilation Error
> 
> 
> 
> @
> 
> "ucxn_build_stash.pl.log" [noeol] 20853L, 2963854C 1,1
> Top
> 
> [javac]   symbol:   variable reverse
> 
> [javac]   location: class CiscoSSOValve
> 
> [javac] 
> /auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnect
ion/CL
>
> 
NX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/uni
ty/t
> omcat/valve/CiscoSSOValve.java:98: error: cannot find symbol
> 
> [javac] super.sessionEvent(event);
> 
> [javac]  ^
> 
> [javac]   symbol: method sessionEvent(SessionEvent)
> 
> [javac] 
> /auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnect
ion/CL
>
> 
NX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/uni
ty/t
> omcat/valve/CiscoSSOValve.java:100: error: cannot find symbol
> 
> [javac] if(null != lookup(ssoId)) {
> 
> [javac]^
> 
> [javac]   symbol:   method lookup(String)
> 
> [javac]   location: class CiscoSSOValve
> 
> [javac] 
> /auto/ipcbu-ucxn-cache/CORES/BLD-cc_mainline_16-cct-ccm-d/unityconnect
ion/CL
>
> 
NX_11.5.0.98/source/un_CUSA/Projects/cisco-unity-valve/src/com/cisco/uni
ty/t
> omcat/valve/CiscoSSOValve.java:149: error:
> associate(String,Session) in CiscoSSOValve cannot override
> associate(String,Session) in SingleSignOn
> 
> [javac] protected void associate(String