You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Justin Edelson <ju...@gmail.com> on 2010/02/12 17:22:38 UTC

SessionProxyHandler causes java.lang.ClassCastException on impersonate

I'm at a loss here. Carsten (or anyone else) - any idea what's up with
the request below?

debugging, I can see that the actual Session class is XASessionImpl.
javax.jcr.Session is indeed one of the interfaces passed to
Proxy.newProxyInstance(). The class loader looks right (the bundle
classloader for jackrabbit-server).

This is with the current trunk.

Justin

$ curl -u admin:admin http://localhost:8888/index.html?sudo=anonymous
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500
org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
cast to javax.jcr.Session</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /index.html. Reason:
<pre>    org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy
cannot be cast to javax.jcr.Session</pre></p><h3>Caused
by:</h3><pre>java.lang.ClassCastException:
org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
cast to javax.jcr.Session
	at $Proxy0.impersonate(Unknown Source)
	at
org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:870)
	at
org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:538)
	at
org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:351)
	at
org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
	at
org.apache.felix.http.base.internal.context.ServletContextImpl.handleSecurity(ServletContextImpl.java:224)
	at
org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:86)
	at
org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:77)
	at
org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
	at
org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
	at
org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
	at
org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:50)
	at
org.apache.sling.launchpad.testservices.filters.HttpServiceExtFilter.doFilter(HttpServiceExtFilter.java:31)

Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Carsten Ziegeler <cz...@apache.org>.
Ian Boston wrote:
> lgtm.

Ok, so I'll start the release process...

Thanks!


Carsten
-- 
Carsten Ziegeler
cziegeler@apache.org

Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Ian Boston <ie...@tfd.co.uk>.
lgtm.
Ian

On 12 Feb 2010, at 17:09, Carsten Ziegeler wrote:

> According to my test, this is fixed now - can someone please cross check?
> 
> Thanks
> Carsten
> 


Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Carsten Ziegeler <cz...@apache.org>.
Justin Edelson wrote:
> Yes. I just added an IT for this and it is passing locally for me.
> 
Perfect, thanks Justin!

Carsten


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Justin Edelson <ju...@gmail.com>.
Yes. I just added an IT for this and it is passing locally for me.

Thanks

Justin

On 2/12/10 12:09 PM, Carsten Ziegeler wrote:
> According to my test, this is fixed now - can someone please cross check?
> 
> Thanks
> Carsten
> 
> Carsten Ziegeler wrote:
>> Argh, got it...hehe, the code does not return a proxy but the invocation
>> handler. I'll fix it.
>>
>> Carsten
>>
>> Carsten Ziegeler wrote:
>>> I'll have a look
>>>
>>> Carsten
>>>
>>> Ian Boston wrote:
>>>> On 12 Feb 2010, at 16:43, Justin Edelson wrote:
>>>>
>>>>> On 2/12/10 11:41 AM, Ian Boston wrote:
>>>>>> Do you have org.apache.sling.jcr.api deployed any more ( I assume you are not on trunk/head at 909472 which does export all of that from the sling jcr api ) ?
>>>>>>
>>>>>> Ian
>>>>> This is with version 2.0.2.incubator, which does export javax.jcr.
>>>> I get the same :(, looks like 1366 needs to be reopened, sorry should not have closed it.
>>>>
>>>> 12.02.2010 16:42:51.123 *WARN* [2854682@qtp-24914065-10] org.mortbay.jetty EXCEPTION  java.lang.ClassCastException: org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be cast to javax.jcr.Session
>>>> 	at $Proxy4.impersonate(Unknown Source)
>>>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:877)
>>>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:545)
>>>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:358)
>>>> 	at org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
>>>>
>>>> Ian
>>>
>>>
>>
>>
> 
> 


Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Carsten Ziegeler <cz...@apache.org>.
According to my test, this is fixed now - can someone please cross check?

Thanks
Carsten

Carsten Ziegeler wrote:
> Argh, got it...hehe, the code does not return a proxy but the invocation
> handler. I'll fix it.
> 
> Carsten
> 
> Carsten Ziegeler wrote:
>> I'll have a look
>>
>> Carsten
>>
>> Ian Boston wrote:
>>> On 12 Feb 2010, at 16:43, Justin Edelson wrote:
>>>
>>>> On 2/12/10 11:41 AM, Ian Boston wrote:
>>>>> Do you have org.apache.sling.jcr.api deployed any more ( I assume you are not on trunk/head at 909472 which does export all of that from the sling jcr api ) ?
>>>>>
>>>>> Ian
>>>> This is with version 2.0.2.incubator, which does export javax.jcr.
>>> I get the same :(, looks like 1366 needs to be reopened, sorry should not have closed it.
>>>
>>> 12.02.2010 16:42:51.123 *WARN* [2854682@qtp-24914065-10] org.mortbay.jetty EXCEPTION  java.lang.ClassCastException: org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be cast to javax.jcr.Session
>>> 	at $Proxy4.impersonate(Unknown Source)
>>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:877)
>>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:545)
>>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:358)
>>> 	at org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
>>>
>>> Ian
>>
>>
> 
> 


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Carsten Ziegeler <cz...@apache.org>.
Argh, got it...hehe, the code does not return a proxy but the invocation
handler. I'll fix it.

Carsten

Carsten Ziegeler wrote:
> I'll have a look
> 
> Carsten
> 
> Ian Boston wrote:
>> On 12 Feb 2010, at 16:43, Justin Edelson wrote:
>>
>>> On 2/12/10 11:41 AM, Ian Boston wrote:
>>>> Do you have org.apache.sling.jcr.api deployed any more ( I assume you are not on trunk/head at 909472 which does export all of that from the sling jcr api ) ?
>>>>
>>>> Ian
>>> This is with version 2.0.2.incubator, which does export javax.jcr.
>> I get the same :(, looks like 1366 needs to be reopened, sorry should not have closed it.
>>
>> 12.02.2010 16:42:51.123 *WARN* [2854682@qtp-24914065-10] org.mortbay.jetty EXCEPTION  java.lang.ClassCastException: org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be cast to javax.jcr.Session
>> 	at $Proxy4.impersonate(Unknown Source)
>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:877)
>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:545)
>> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:358)
>> 	at org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
>>
>> Ian
> 
> 
> 


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Carsten Ziegeler <cz...@apache.org>.
I'll have a look

Carsten

Ian Boston wrote:
> On 12 Feb 2010, at 16:43, Justin Edelson wrote:
> 
>> On 2/12/10 11:41 AM, Ian Boston wrote:
>>> Do you have org.apache.sling.jcr.api deployed any more ( I assume you are not on trunk/head at 909472 which does export all of that from the sling jcr api ) ?
>>>
>>> Ian
>> This is with version 2.0.2.incubator, which does export javax.jcr.
> 
> I get the same :(, looks like 1366 needs to be reopened, sorry should not have closed it.
> 
> 12.02.2010 16:42:51.123 *WARN* [2854682@qtp-24914065-10] org.mortbay.jetty EXCEPTION  java.lang.ClassCastException: org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be cast to javax.jcr.Session
> 	at $Proxy4.impersonate(Unknown Source)
> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:877)
> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:545)
> 	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:358)
> 	at org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
> 
> Ian



-- 
Carsten Ziegeler
cziegeler@apache.org

Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Ian Boston <ie...@tfd.co.uk>.
On 12 Feb 2010, at 16:43, Justin Edelson wrote:

> On 2/12/10 11:41 AM, Ian Boston wrote:
>> Do you have org.apache.sling.jcr.api deployed any more ( I assume you are not on trunk/head at 909472 which does export all of that from the sling jcr api ) ?
>> 
>> Ian
> 
> This is with version 2.0.2.incubator, which does export javax.jcr.

I get the same :(, looks like 1366 needs to be reopened, sorry should not have closed it.

12.02.2010 16:42:51.123 *WARN* [2854682@qtp-24914065-10] org.mortbay.jetty EXCEPTION  java.lang.ClassCastException: org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be cast to javax.jcr.Session
	at $Proxy4.impersonate(Unknown Source)
	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:877)
	at org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:545)
	at org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:358)
	at org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)

Ian

> 
> Justin
> 
>> 
>> On 12 Feb 2010, at 16:34, Justin Edelson wrote:
>> 
>>> According to the console, jackrabbit-server, commons-auth, and jcr.base
>>> all import javax.jcr from the same bundle (jcr.api).
>>> 
>>> On 2/12/10 11:29 AM, Ian Boston wrote:
>>>> Is it possible the Sessions are coming from different classloaders ?
>>>> One embedded inside the server bundle (or perhapse base) and the other deployed directly ?
>>>> 
>>>> class != class often means the bytecode came from a different classloader.
>>>> 
>>>> Ian
>>>> 
>>>> 
>>>> 
>>>> On 12 Feb 2010, at 16:22, Justin Edelson wrote:
>>>> 
>>>>> I'm at a loss here. Carsten (or anyone else) - any idea what's up with
>>>>> the request below?
>>>>> 
>>>>> debugging, I can see that the actual Session class is XASessionImpl.
>>>>> javax.jcr.Session is indeed one of the interfaces passed to
>>>>> Proxy.newProxyInstance(). The class loader looks right (the bundle
>>>>> classloader for jackrabbit-server).
>>>>> 
>>>>> This is with the current trunk.
>>>>> 
>>>>> Justin
>>>>> 
>>>>> $ curl -u admin:admin http://localhost:8888/index.html?sudo=anonymous
>>>>> <html>
>>>>> <head>
>>>>> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
>>>>> <title>Error 500
>>>>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>>>>> cast to javax.jcr.Session</title>
>>>>> </head>
>>>>> <body><h2>HTTP ERROR 500</h2>
>>>>> <p>Problem accessing /index.html. Reason:
>>>>> <pre>    org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy
>>>>> cannot be cast to javax.jcr.Session</pre></p><h3>Caused
>>>>> by:</h3><pre>java.lang.ClassCastException:
>>>>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>>>>> cast to javax.jcr.Session
>>>>> 	at $Proxy0.impersonate(Unknown Source)
>>>>> 	at
>>>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:870)
>>>>> 	at
>>>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:538)
>>>>> 	at
>>>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:351)
>>>>> 	at
>>>>> org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
>>>>> 	at
>>>>> org.apache.felix.http.base.internal.context.ServletContextImpl.handleSecurity(ServletContextImpl.java:224)
>>>>> 	at
>>>>> org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:86)
>>>>> 	at
>>>>> org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:77)
>>>>> 	at
>>>>> org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
>>>>> 	at
>>>>> org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
>>>>> 	at
>>>>> org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
>>>>> 	at
>>>>> org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:50)
>>>>> 	at
>>>>> org.apache.sling.launchpad.testservices.filters.HttpServiceExtFilter.doFilter(HttpServiceExtFilter.java:31)
>>>> 
>>> 
>> 
> 


Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Justin Edelson <ju...@gmail.com>.
On 2/12/10 11:41 AM, Ian Boston wrote:
> Do you have org.apache.sling.jcr.api deployed any more ( I assume you are not on trunk/head at 909472 which does export all of that from the sling jcr api ) ?
> 
> Ian

This is with version 2.0.2.incubator, which does export javax.jcr.

Justin

> 
> On 12 Feb 2010, at 16:34, Justin Edelson wrote:
> 
>> According to the console, jackrabbit-server, commons-auth, and jcr.base
>> all import javax.jcr from the same bundle (jcr.api).
>>
>> On 2/12/10 11:29 AM, Ian Boston wrote:
>>> Is it possible the Sessions are coming from different classloaders ?
>>> One embedded inside the server bundle (or perhapse base) and the other deployed directly ?
>>>
>>> class != class often means the bytecode came from a different classloader.
>>>
>>> Ian
>>>
>>>
>>>
>>> On 12 Feb 2010, at 16:22, Justin Edelson wrote:
>>>
>>>> I'm at a loss here. Carsten (or anyone else) - any idea what's up with
>>>> the request below?
>>>>
>>>> debugging, I can see that the actual Session class is XASessionImpl.
>>>> javax.jcr.Session is indeed one of the interfaces passed to
>>>> Proxy.newProxyInstance(). The class loader looks right (the bundle
>>>> classloader for jackrabbit-server).
>>>>
>>>> This is with the current trunk.
>>>>
>>>> Justin
>>>>
>>>> $ curl -u admin:admin http://localhost:8888/index.html?sudo=anonymous
>>>> <html>
>>>> <head>
>>>> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
>>>> <title>Error 500
>>>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>>>> cast to javax.jcr.Session</title>
>>>> </head>
>>>> <body><h2>HTTP ERROR 500</h2>
>>>> <p>Problem accessing /index.html. Reason:
>>>> <pre>    org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy
>>>> cannot be cast to javax.jcr.Session</pre></p><h3>Caused
>>>> by:</h3><pre>java.lang.ClassCastException:
>>>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>>>> cast to javax.jcr.Session
>>>> 	at $Proxy0.impersonate(Unknown Source)
>>>> 	at
>>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:870)
>>>> 	at
>>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:538)
>>>> 	at
>>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:351)
>>>> 	at
>>>> org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
>>>> 	at
>>>> org.apache.felix.http.base.internal.context.ServletContextImpl.handleSecurity(ServletContextImpl.java:224)
>>>> 	at
>>>> org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:86)
>>>> 	at
>>>> org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:77)
>>>> 	at
>>>> org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
>>>> 	at
>>>> org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
>>>> 	at
>>>> org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
>>>> 	at
>>>> org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:50)
>>>> 	at
>>>> org.apache.sling.launchpad.testservices.filters.HttpServiceExtFilter.doFilter(HttpServiceExtFilter.java:31)
>>>
>>
> 


Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Ian Boston <ie...@tfd.co.uk>.
Do you have org.apache.sling.jcr.api deployed any more ( I assume you are not on trunk/head at 909472 which does export all of that from the sling jcr api ) ?

Ian

On 12 Feb 2010, at 16:34, Justin Edelson wrote:

> According to the console, jackrabbit-server, commons-auth, and jcr.base
> all import javax.jcr from the same bundle (jcr.api).
> 
> On 2/12/10 11:29 AM, Ian Boston wrote:
>> Is it possible the Sessions are coming from different classloaders ?
>> One embedded inside the server bundle (or perhapse base) and the other deployed directly ?
>> 
>> class != class often means the bytecode came from a different classloader.
>> 
>> Ian
>> 
>> 
>> 
>> On 12 Feb 2010, at 16:22, Justin Edelson wrote:
>> 
>>> I'm at a loss here. Carsten (or anyone else) - any idea what's up with
>>> the request below?
>>> 
>>> debugging, I can see that the actual Session class is XASessionImpl.
>>> javax.jcr.Session is indeed one of the interfaces passed to
>>> Proxy.newProxyInstance(). The class loader looks right (the bundle
>>> classloader for jackrabbit-server).
>>> 
>>> This is with the current trunk.
>>> 
>>> Justin
>>> 
>>> $ curl -u admin:admin http://localhost:8888/index.html?sudo=anonymous
>>> <html>
>>> <head>
>>> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
>>> <title>Error 500
>>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>>> cast to javax.jcr.Session</title>
>>> </head>
>>> <body><h2>HTTP ERROR 500</h2>
>>> <p>Problem accessing /index.html. Reason:
>>> <pre>    org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy
>>> cannot be cast to javax.jcr.Session</pre></p><h3>Caused
>>> by:</h3><pre>java.lang.ClassCastException:
>>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>>> cast to javax.jcr.Session
>>> 	at $Proxy0.impersonate(Unknown Source)
>>> 	at
>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:870)
>>> 	at
>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:538)
>>> 	at
>>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:351)
>>> 	at
>>> org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
>>> 	at
>>> org.apache.felix.http.base.internal.context.ServletContextImpl.handleSecurity(ServletContextImpl.java:224)
>>> 	at
>>> org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:86)
>>> 	at
>>> org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:77)
>>> 	at
>>> org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
>>> 	at
>>> org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
>>> 	at
>>> org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
>>> 	at
>>> org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:50)
>>> 	at
>>> org.apache.sling.launchpad.testservices.filters.HttpServiceExtFilter.doFilter(HttpServiceExtFilter.java:31)
>> 
> 


Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Justin Edelson <ju...@gmail.com>.
According to the console, jackrabbit-server, commons-auth, and jcr.base
all import javax.jcr from the same bundle (jcr.api).

On 2/12/10 11:29 AM, Ian Boston wrote:
> Is it possible the Sessions are coming from different classloaders ?
> One embedded inside the server bundle (or perhapse base) and the other deployed directly ?
> 
> class != class often means the bytecode came from a different classloader.
> 
> Ian
> 
> 
> 
> On 12 Feb 2010, at 16:22, Justin Edelson wrote:
> 
>> I'm at a loss here. Carsten (or anyone else) - any idea what's up with
>> the request below?
>>
>> debugging, I can see that the actual Session class is XASessionImpl.
>> javax.jcr.Session is indeed one of the interfaces passed to
>> Proxy.newProxyInstance(). The class loader looks right (the bundle
>> classloader for jackrabbit-server).
>>
>> This is with the current trunk.
>>
>> Justin
>>
>> $ curl -u admin:admin http://localhost:8888/index.html?sudo=anonymous
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
>> <title>Error 500
>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>> cast to javax.jcr.Session</title>
>> </head>
>> <body><h2>HTTP ERROR 500</h2>
>> <p>Problem accessing /index.html. Reason:
>> <pre>    org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy
>> cannot be cast to javax.jcr.Session</pre></p><h3>Caused
>> by:</h3><pre>java.lang.ClassCastException:
>> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
>> cast to javax.jcr.Session
>> 	at $Proxy0.impersonate(Unknown Source)
>> 	at
>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:870)
>> 	at
>> org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:538)
>> 	at
>> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:351)
>> 	at
>> org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
>> 	at
>> org.apache.felix.http.base.internal.context.ServletContextImpl.handleSecurity(ServletContextImpl.java:224)
>> 	at
>> org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:86)
>> 	at
>> org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:77)
>> 	at
>> org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
>> 	at
>> org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
>> 	at
>> org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
>> 	at
>> org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:50)
>> 	at
>> org.apache.sling.launchpad.testservices.filters.HttpServiceExtFilter.doFilter(HttpServiceExtFilter.java:31)
> 


Re: SessionProxyHandler causes java.lang.ClassCastException on impersonate

Posted by Ian Boston <ie...@tfd.co.uk>.
Is it possible the Sessions are coming from different classloaders ?
One embedded inside the server bundle (or perhapse base) and the other deployed directly ?

class != class often means the bytecode came from a different classloader.

Ian



On 12 Feb 2010, at 16:22, Justin Edelson wrote:

> I'm at a loss here. Carsten (or anyone else) - any idea what's up with
> the request below?
> 
> debugging, I can see that the actual Session class is XASessionImpl.
> javax.jcr.Session is indeed one of the interfaces passed to
> Proxy.newProxyInstance(). The class loader looks right (the bundle
> classloader for jackrabbit-server).
> 
> This is with the current trunk.
> 
> Justin
> 
> $ curl -u admin:admin http://localhost:8888/index.html?sudo=anonymous
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
> <title>Error 500
> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
> cast to javax.jcr.Session</title>
> </head>
> <body><h2>HTTP ERROR 500</h2>
> <p>Problem accessing /index.html. Reason:
> <pre>    org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy
> cannot be cast to javax.jcr.Session</pre></p><h3>Caused
> by:</h3><pre>java.lang.ClassCastException:
> org.apache.sling.jcr.base.SessionProxyHandler$SessionProxy cannot be
> cast to javax.jcr.Session
> 	at $Proxy0.impersonate(Unknown Source)
> 	at
> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleImpersonation(SlingAuthenticator.java:870)
> 	at
> org.apache.sling.commons.auth.impl.SlingAuthenticator.getSession(SlingAuthenticator.java:538)
> 	at
> org.apache.sling.commons.auth.impl.SlingAuthenticator.handleSecurity(SlingAuthenticator.java:351)
> 	at
> org.apache.sling.engine.impl.SlingMainServlet.handleSecurity(SlingMainServlet.java:859)
> 	at
> org.apache.felix.http.base.internal.context.ServletContextImpl.handleSecurity(ServletContextImpl.java:224)
> 	at
> org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:86)
> 	at
> org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:77)
> 	at
> org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:42)
> 	at
> org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:49)
> 	at
> org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:33)
> 	at
> org.apache.sling.launchpad.testservices.filters.TestFilter.doFilter(TestFilter.java:50)
> 	at
> org.apache.sling.launchpad.testservices.filters.HttpServiceExtFilter.doFilter(HttpServiceExtFilter.java:31)