You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tiles.apache.org by "Vasiliy Gagin (JIRA)" <ji...@apache.org> on 2008/04/19 14:19:05 UTC

[jira] Created: (TILES-267) IllegalAccessException with Jetty

IllegalAccessException with Jetty
---------------------------------

                 Key: TILES-267
                 URL: https://issues.apache.org/struts/browse/TILES-267
             Project: Tiles
          Issue Type: Bug
          Components: tiles-core
    Affects Versions: 2.0.5
         Environment: Eclipse, Jetty
            Reporter: Vasiliy Gagin


I'm getting exception when running standalone under Jetty:

org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
	at org.mortbay.util.Container.start(Container.java:72)
	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
	at org.mortbay.util.Container.start(Container.java:72)
	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
	at java.lang.reflect.Method.invoke(Method.java:578)
	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
	... 10 more

I did some digging.
Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
Method returned via context.getClass().getMethod(...) can't be used outside of package.
If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TILES-267) IllegalAccessException with Jetty

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43702#action_43702 ] 

Antonio Petrelli commented on TILES-267:
----------------------------------------

Can you provide a patch, if you fixed the bug?

Thanks

> IllegalAccessException with Jetty
> ---------------------------------
>
>                 Key: TILES-267
>                 URL: https://issues.apache.org/struts/browse/TILES-267
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-core
>    Affects Versions: 2.0.5
>         Environment: Eclipse, Jetty
>            Reporter: Vasiliy Gagin
>
> I'm getting exception when running standalone under Jetty:
> org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
> 	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
> 	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
> 	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
> Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.reflect.Method.invoke(Method.java:578)
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
> 	... 10 more
> I did some digging.
> Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
> Method returned via context.getClass().getMethod(...) can't be used outside of package.
> If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TILES-267) IllegalAccessException with Jetty

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44479#action_44479 ] 

Antonio Petrelli commented on TILES-267:
----------------------------------------

This bug is a duplicate of TILES-286.

> IllegalAccessException with Jetty
> ---------------------------------
>
>                 Key: TILES-267
>                 URL: https://issues.apache.org/struts/browse/TILES-267
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-core
>    Affects Versions: 2.0.5
>         Environment: Eclipse, Jetty
>            Reporter: Vasiliy Gagin
>
> I'm getting exception when running standalone under Jetty:
> org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
> 	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
> 	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
> 	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
> Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.reflect.Method.invoke(Method.java:578)
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
> 	... 10 more
> I did some digging.
> Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
> Method returned via context.getClass().getMethod(...) can't be used outside of package.
> If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (TILES-267) IllegalAccessException with Jetty

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Petrelli closed TILES-267.
----------------------------------


> IllegalAccessException with Jetty
> ---------------------------------
>
>                 Key: TILES-267
>                 URL: https://issues.apache.org/struts/browse/TILES-267
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-core
>    Affects Versions: 2.0.5
>         Environment: Eclipse, Jetty
>            Reporter: Vasiliy Gagin
>
> I'm getting exception when running standalone under Jetty:
> org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
> 	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
> 	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
> 	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
> Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.reflect.Method.invoke(Method.java:578)
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
> 	... 10 more
> I did some digging.
> Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
> Method returned via context.getClass().getMethod(...) can't be used outside of package.
> If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TILES-267) IllegalAccessException with Jetty

Posted by "Vasiliy Gagin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43720#action_43720 ] 

Vasiliy Gagin commented on TILES-267:
-------------------------------------

I'm not sure about the best way to fix it.
I'm new to tiles. I just fixed it by calling Method.setAccessible(true) everywhere Method is accessed.
Curious, why in TilesContainerFactory context is declared as an Object not ServletContext?
There is a better way of fixing it if context can be decalred as a ServeltContext. Aka instead of 

context.getClass().getMethod("getInitParameter") 

call

ServeltContext.class.getMethod("getInitParameter") 

> IllegalAccessException with Jetty
> ---------------------------------
>
>                 Key: TILES-267
>                 URL: https://issues.apache.org/struts/browse/TILES-267
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-core
>    Affects Versions: 2.0.5
>         Environment: Eclipse, Jetty
>            Reporter: Vasiliy Gagin
>
> I'm getting exception when running standalone under Jetty:
> org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
> 	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
> 	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
> 	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
> Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.reflect.Method.invoke(Method.java:578)
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
> 	... 10 more
> I did some digging.
> Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
> Method returned via context.getClass().getMethod(...) can't be used outside of package.
> If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TILES-267) IllegalAccessException with Jetty

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43724#action_43724 ] 

Antonio Petrelli commented on TILES-267:
----------------------------------------

Because, in theory, you can use for example PortletContext.
Anyway, even though the "setAccessible" call is not so elegant, it seems ok to me, at least for the 2.0.x branch. A more elegant way will be put in 2.1.x branch.
Can you post a patch against the 2.0.x branch?

http://svn.apache.org/repos/asf/tiles/framework/branches/TILES_2_0_X/

> IllegalAccessException with Jetty
> ---------------------------------
>
>                 Key: TILES-267
>                 URL: https://issues.apache.org/struts/browse/TILES-267
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-core
>    Affects Versions: 2.0.5
>         Environment: Eclipse, Jetty
>            Reporter: Vasiliy Gagin
>
> I'm getting exception when running standalone under Jetty:
> org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
> 	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
> 	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
> 	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
> Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.reflect.Method.invoke(Method.java:578)
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
> 	... 10 more
> I did some digging.
> Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
> Method returned via context.getClass().getMethod(...) can't be used outside of package.
> If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TILES-267) IllegalAccessException with Jetty

Posted by "Larry Edelstein (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/TILES-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44475#action_44475 ] 

Larry Edelstein commented on TILES-267:
---------------------------------------

I've run smack into this problem.  I run functional tests using Selenium, which embeds a 5.x version of Jetty inside it.  My tests deploy the web-application-under-test in Jetty and Tiles throws this exception.  

Naturally I don't want to use Jetty 5.x for the web-application-under-test itself, but it's going to take some work to use 6.x in the app and still let Selenium use 5.x.  So for the moment I'm stuck; I can't run my functional tests (at least not since I started using Tiles).

I'm on JDK 1.6 update 7.

> IllegalAccessException with Jetty
> ---------------------------------
>
>                 Key: TILES-267
>                 URL: https://issues.apache.org/struts/browse/TILES-267
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-core
>    Affects Versions: 2.0.5
>         Environment: Eclipse, Jetty
>            Reporter: Vasiliy Gagin
>
> I'm getting exception when running standalone under Jetty:
> org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
> 	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
> 	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
> 	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
> Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.reflect.Method.invoke(Method.java:578)
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
> 	... 10 more
> I did some digging.
> Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
> Method returned via context.getClass().getMethod(...) can't be used outside of package.
> If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (TILES-267) IllegalAccessException with Jetty

Posted by "Antonio Petrelli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/TILES-267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Petrelli resolved TILES-267.
------------------------------------

    Resolution: Incomplete

I tried with Jetty 6.1.9 and Sun JDK 6 update 6 and it works.
I am resolving this as "incomplete".
Can you provide your environment?

> IllegalAccessException with Jetty
> ---------------------------------
>
>                 Key: TILES-267
>                 URL: https://issues.apache.org/struts/browse/TILES-267
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-core
>    Affects Versions: 2.0.5
>         Environment: Eclipse, Jetty
>            Reporter: Vasiliy Gagin
>
> I'm getting exception when running standalone under Jetty:
> org.apache.tiles.TilesException: Unable to retrieve init parameters. Is this context a ServletContext, PortletContext, or similar object?
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:352)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:143)
> 	at org.apache.tiles.factory.TilesContainerFactory.getFactory(TilesContainerFactory.java:122)
> 	at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:88)
> 	at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
> 	at org.mortbay.jetty.servlet.WebApplicationContext.doStart(WebApplicationContext.java:495)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.mortbay.http.HttpServer.doStart(HttpServer.java:708)
> 	at org.mortbay.util.Container.start(Container.java:72)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.run(PreviewStarter.java:116)
> 	at org.eclipse.wst.server.preview.internal.PreviewStarter.main(PreviewStarter.java:39)
> Caused by: java.lang.IllegalAccessException: Class org.apache.tiles.factory.TilesContainerFactory can not access a member of class org.mortbay.jetty.servlet.ServletHandler$Context with modifiers "public"
> 	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
> 	at java.lang.reflect.Method.invoke(Method.java:578)
> 	at org.apache.tiles.factory.TilesContainerFactory.getInitParameterMap(TilesContainerFactory.java:343)
> 	... 10 more
> I did some digging.
> Exception is happening because class org.mortbay.jetty.servlet.ServletHandler$Context is package local.
> Method returned via context.getClass().getMethod(...) can't be used outside of package.
> If ServletContext.class.getMethod(...) would be used instead, then it will work.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.