[
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.