You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2008/04/02 01:30:46 UTC

error while testing

I have an exception from some reflection when Tiles tried to invoke a method on 
the HttpUnit ServletUnit context class:


java.lang.IllegalAccessException: Class org.apache.tiles.access.TilesAccess can 
not access a member of class com.meterware.servletunit.ServletUnitServletContext 
with modifiers "public"
	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
	at java.lang.reflect.Method.invoke(Method.java:578)
	at org.apache.tiles.access.TilesAccess.getAttribute(TilesAccess.java:125)
	at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:74)
	at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:99)

This is the method on the class:


class ServletUnitServletContext
     implements ServletContext
{

     public Object getAttribute(String name)
     {
         return _attributes.get(name);
     }


The class is private or default actually (this might be my decompiler messing it 
up) so Tiles can't get the attribute it needs.

Any advice?

Thanks
Adam

Re: error while testing

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Antonio Petrelli on 02/04/08 11:05, wrote:
> 2008/4/2, Adam Hardy <ah...@cyberspaceroad.com>:
>>  Looking at the code, the HttpUnit developers gave this ServletUnitServletContext class only package default access modifier! So I don't think there is any way that Tiles can ever successfully do this reflection, unless it casts it to ServletContext, but even then I'm not sure it can do it.
> 
> I don't think this is the problem, the cast should be not necessary,
> since ServletContext is an interface.
> 
>>  I think I'm asking in the wrong place basically! I'll go over to the HttpUnit forum.
> 
> Go on, but I am curious about it, can you post a link of the forum
> thread that you will create? Eventually I can participate.

http://sourceforge.net/mailarchive/forum.php?thread_name=47F3663D.5050005%40cyberspaceroad.com&forum_name=httpunit-develop

Regards
Adam



Re: error while testing

Posted by Antonio Petrelli <an...@gmail.com>.
2008/4/2, Adam Hardy <ah...@cyberspaceroad.com>:
>  Looking at the code, the HttpUnit developers gave this ServletUnitServletContext class only package default access modifier! So I don't think there is any way that Tiles can ever successfully do this reflection, unless it casts it to ServletContext, but even then I'm not sure it can do it.

I don't think this is the problem, the cast should be not necessary,
since ServletContext is an interface.

>  I think I'm asking in the wrong place basically! I'll go over to the HttpUnit forum.

Go on, but I am curious about it, can you post a link of the forum
thread that you will create? Eventually I can participate.

Thanks
Antonio

Re: error while testing

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Antonio Petrelli on 02/04/08 07:54, wrote:
> 2008/4/2, Adam Hardy <ah...@cyberspaceroad.com>:
>> I have an exception from some reflection when Tiles tried to invoke a method on
>>  the HttpUnit ServletUnit context class:
>>
>>
>>  java.lang.IllegalAccessException: Class org.apache.tiles.access.TilesAccess can
>>  not access a member of class com.meterware.servletunit.ServletUnitServletContext
>>  with modifiers "public"
>> ...
>>  The class is private or default actually (this might be my decompiler messing it
>>  up) so Tiles can't get the attribute it needs.
> 
> It seems strange... What version of Servlet specification and Java are
> you using?
> Tiles is compatible with Servlet 2.4 and Java 5.

Hi Antonio,

I too thought it must be servlet spec incompatibility but HttpUnit is compatible 
with 2.4.

Looking at the code, the HttpUnit developers gave this ServletUnitServletContext 
class only package default access modifier! So I don't think there is any way 
that Tiles can ever successfully do this reflection, unless it casts it to 
ServletContext, but even then I'm not sure it can do it.

I think I'm asking in the wrong place basically! I'll go over to the HttpUnit 
forum.

thanks anyway,
Adam


Re: error while testing

Posted by Antonio Petrelli <an...@gmail.com>.
2008/4/2, Adam Hardy <ah...@cyberspaceroad.com>:
> I have an exception from some reflection when Tiles tried to invoke a method on
>  the HttpUnit ServletUnit context class:
>
>
>  java.lang.IllegalAccessException: Class org.apache.tiles.access.TilesAccess can
>  not access a member of class com.meterware.servletunit.ServletUnitServletContext
>  with modifiers "public"
> ...
>  The class is private or default actually (this might be my decompiler messing it
>  up) so Tiles can't get the attribute it needs.

It seems strange... What version of Servlet specification and Java are
you using?
Tiles is compatible with Servlet 2.4 and Java 5.

Antonio