You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "careprad (JIRA)" <ji...@apache.org> on 2008/11/28 05:00:37 UTC

[jira] Created: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

org.apache.struts2.tiles.StrutsTilesListener do not work
--------------------------------------------------------

                 Key: WW-2897
                 URL: https://issues.apache.org/struts/browse/WW-2897
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - Tiles
    Affects Versions: 2.0.11.2
         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
            Reporter: careprad
            Priority: Blocker


first of all,the reason is the exception on ServletDispatcherResult.doExecute:
		setLocation(location);
		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
		INIT.put(
			"org.apache.tiles.factory.TilesContainerFactory",
			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
					== null
					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
				.getName());

this code is what I can't understand!and How can I get the source code of the pluggin?

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


[jira] Updated: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

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

James Holmes updated WW-2897:
-----------------------------

    Fix Version/s: 2.1.3

Ok, it appears the only thing you did in your code to fix the issue was to override this method:

protected TilesContainer createContainer(ServletContext context)

and provide code that checks for null.

> org.apache.struts2.tiles.StrutsTilesListener do not work
> --------------------------------------------------------
>
>                 Key: WW-2897
>                 URL: https://issues.apache.org/struts/browse/WW-2897
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.0.11.2
>         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
>            Reporter: careprad
>            Priority: Blocker
>             Fix For: 2.1.3
>
>
> first of all,the reason is the exception on ServletDispatcherResult.doExecute:
> 		setLocation(location);
> 		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
> 		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
> 		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
> 		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
> 		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
> I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
> 		INIT.put(
> 			"org.apache.tiles.factory.TilesContainerFactory",
> 			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
> 				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
> 					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
> 					== null
> 					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
> 					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
> 				.getName());
> this code is what I can't understand!and How can I get the source code of the pluggin?

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


[jira] Commented: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

Posted by "careprad (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45064#action_45064 ] 

careprad commented on WW-2897:
------------------------------

we have resolved this problem,the root cause is the StrutsTilesListener,we have retrotranslate all the relevant library files,but the StrutsTilesListener did not work,so we change the code by ourself,this is the class:
public class MyStrutsTilesListener implements ServletContextListener
{
    /**
     * Log instance.
     */
    protected static final Log LOG =
        LogFactory.getLog(MyStrutsTilesListener.class);
       
    private static final Map INIT;

    static
    {
        INIT = new HashMap();
        INIT.put(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM,
                 StrutsTilesContainerFactory.class.getName());
    }

    /**
     * Initialize the TilesContainer and place it
     * into service.
     *
     * @param event The intercepted event.
     */
    public void contextInitialized(ServletContextEvent event)
    {
        ServletContext servletContext = event.getServletContext();
        try
        {
            TilesContainer container = createContainer(servletContext);
            TilesAccess.setContainer(servletContext, container);
        }
        catch (TilesException e)
        {
            throw new IllegalStateException("Unable to instantiate container.");
        }
    }

    /**
     * Remove the tiles container from service.
     *
     * @param event The intercepted event.
     */
    public void contextDestroyed(ServletContextEvent event) {
        ServletContext servletContext = event.getServletContext();
        try
        {
            TilesAccess.setContainer(servletContext, null);
        }
        catch (TilesException e) {
            LOG.warn("Unable to remove tiles container from service.");
        }
    }

    /**
     * Creates a Tiles container.
     *
     * @param context The servlet context to use.
     * @return The created container
     * @throws TilesException If something goes wrong during creation.
     */
    protected TilesContainer createContainer(ServletContext context)
        throws TilesException
        {
        if(context.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM) == null) {
            context = decorate(context);
        }
        else
        {
            LOG.warn("Tiles container factory is explicitly set.  Not injecting struts configuration.");
        }
        TilesContainerFactory factory =
            TilesContainerFactory.getFactory(context);
        return factory.createContainer(context);
    }
   
    protected ServletContext decorate(ServletContext context)
    {
        return new ConfiguredServletContext(context, INIT);
    }

}

as you see,there is no other code,but it just work,we still did not know how it can do it!!

I must to point out our environment is wsad5,so its jdk is 14 implemented by ibm,we retrotranslate  the jar file with classpath=%wasruntime%/core.jar.I think this is the right way.
But this problem cost our 2 days to resolve it.I am disappointed to the struts2(this problem is one of the reason but not the only!).

> org.apache.struts2.tiles.StrutsTilesListener do not work
> --------------------------------------------------------
>
>                 Key: WW-2897
>                 URL: https://issues.apache.org/struts/browse/WW-2897
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.0.11.2
>         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
>            Reporter: careprad
>            Priority: Blocker
>
> first of all,the reason is the exception on ServletDispatcherResult.doExecute:
> 		setLocation(location);
> 		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
> 		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
> 		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
> 		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
> 		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
> I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
> 		INIT.put(
> 			"org.apache.tiles.factory.TilesContainerFactory",
> 			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
> 				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
> 					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
> 					== null
> 					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
> 					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
> 				.getName());
> this code is what I can't understand!and How can I get the source code of the pluggin?

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


[jira] Commented: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45061#action_45061 ] 

Dave Newton commented on WW-2897:
---------------------------------

@careprad: You can get the source by downloading the source or checking it out from the source repository:

http://struts.apache.org/dev/builds.html

@lichunlei: Did you also retrotranslate all the relevant library files?

> org.apache.struts2.tiles.StrutsTilesListener do not work
> --------------------------------------------------------
>
>                 Key: WW-2897
>                 URL: https://issues.apache.org/struts/browse/WW-2897
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.0.11.2
>         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
>            Reporter: careprad
>            Priority: Blocker
>
> first of all,the reason is the exception on ServletDispatcherResult.doExecute:
> 		setLocation(location);
> 		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
> 		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
> 		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
> 		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
> 		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
> I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
> 		INIT.put(
> 			"org.apache.tiles.factory.TilesContainerFactory",
> 			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
> 				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
> 					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
> 					== null
> 					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
> 					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
> 				.getName());
> this code is what I can't understand!and How can I get the source code of the pluggin?

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


[jira] Commented: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

Posted by "lichunlei (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45039#action_45039 ] 

lichunlei commented on WW-2897:
-------------------------------

I have meet the same issue.

I must use struts2 + tiles in jdk1.4.2.(struts2.0.14 + tiles2.0.6)

But tiles can't work.
struts2-tiles-plugin and tiles jars were transfered for jdk1.4 by using RetroTranslator.
Below is my exception:
[11/28/08 14:45:40:546 CST] 4c844c84 WebGroup      E SRVE0026E: [Servlet
Error]-[]: java.lang.NullPointerException
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.Throwable.<init>(Throwable.java)
	at
java.lang.NullPointerException.<init>(NullPointerException.java:60)
	at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java)
	at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSuppor
t.java:178)
	at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
nvocation.java:348)
	at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:253)
	at
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(D
efaultWorkflowInterceptor.java:221)

Below is org.apache.struts2.views.tiles.TilesResult.doExecute java code:
    public void doExecute(String location, ActionInvocation invocation) throws Exception {
        setLocation(location);

        ServletContext servletContext =
ServletActionContext.getServletContext();
        TilesContainer container = TilesAccess.getContainer(servletContext);

        HttpServletRequest request = ServletActionContext.getRequest();
        HttpServletResponse response = ServletActionContext.getResponse();

        container.render(location, request, response);
    }
I debugged and fund that "container" is null, a exception will be thrown when launch this code: 
container.render(location, request, response);

I found that "org.apache.struts2.tiles.StrutsTilesListener" is not run when web application start!

My application can run smoothly in jdk1.5, but tiles can't work in jdk1.4.2

I promise it's a bug.


> org.apache.struts2.tiles.StrutsTilesListener do not work
> --------------------------------------------------------
>
>                 Key: WW-2897
>                 URL: https://issues.apache.org/struts/browse/WW-2897
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.0.11.2
>         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
>            Reporter: careprad
>            Priority: Blocker
>
> first of all,the reason is the exception on ServletDispatcherResult.doExecute:
> 		setLocation(location);
> 		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
> 		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
> 		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
> 		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
> 		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
> I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
> 		INIT.put(
> 			"org.apache.tiles.factory.TilesContainerFactory",
> 			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
> 				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
> 					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
> 					== null
> 					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
> 					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
> 				.getName());
> this code is what I can't understand!and How can I get the source code of the pluggin?

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


[jira] Resolved: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

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

Musachy Barroso resolved WW-2897.
---------------------------------

    Resolution: Incomplete

The code looks identical to the code we have, we even have the null check. This seems to be a configuration problem with the jdk4 libraries. Re-open if you have more info on how to reproduce (hopefully it can be reproduced in any other container that is not WAS)

> org.apache.struts2.tiles.StrutsTilesListener do not work
> --------------------------------------------------------
>
>                 Key: WW-2897
>                 URL: https://issues.apache.org/struts/browse/WW-2897
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.0.11.2
>         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
>            Reporter: careprad
>             Fix For: 2.1.7
>
>
> first of all,the reason is the exception on ServletDispatcherResult.doExecute:
> 		setLocation(location);
> 		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
> 		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
> 		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
> 		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
> 		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
> I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
> 		INIT.put(
> 			"org.apache.tiles.factory.TilesContainerFactory",
> 			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
> 				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
> 					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
> 					== null
> 					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
> 					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
> 				.getName());
> this code is what I can't understand!and How can I get the source code of the pluggin?

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


[jira] Updated: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

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

Musachy Barroso updated WW-2897:
--------------------------------

         Priority: Major  (was: Blocker)
    Fix Version/s:     (was: 2.1.3)
                   2.1.4

If this is jdk 1.4 releated, I don't think it is a blocker by itself. Moving to 2.1.4

> org.apache.struts2.tiles.StrutsTilesListener do not work
> --------------------------------------------------------
>
>                 Key: WW-2897
>                 URL: https://issues.apache.org/struts/browse/WW-2897
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.0.11.2
>         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
>            Reporter: careprad
>             Fix For: 2.1.4
>
>
> first of all,the reason is the exception on ServletDispatcherResult.doExecute:
> 		setLocation(location);
> 		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
> 		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
> 		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
> 		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
> 		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
> I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
> 		INIT.put(
> 			"org.apache.tiles.factory.TilesContainerFactory",
> 			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
> 				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
> 					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
> 					== null
> 					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
> 					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
> 				.getName());
> this code is what I can't understand!and How can I get the source code of the pluggin?

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


[jira] Updated: (WW-2897) org.apache.struts2.tiles.StrutsTilesListener do not work

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

Wes Wannemacher updated WW-2897:
--------------------------------

    Fix Version/s:     (was: 2.1.4)
                   2.1.5

> org.apache.struts2.tiles.StrutsTilesListener do not work
> --------------------------------------------------------
>
>                 Key: WW-2897
>                 URL: https://issues.apache.org/struts/browse/WW-2897
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tiles
>    Affects Versions: 2.0.11.2
>         Environment: websphere6.0 (jdk1.42),all the referenced jar is in the struts-2.0.11.2-all.zip downloaded from the official site. 
>            Reporter: careprad
>             Fix For: 2.1.5
>
>
> first of all,the reason is the exception on ServletDispatcherResult.doExecute:
> 		setLocation(location);
> 		javax.servlet.ServletContext servletContext = ServletActionContext.getServletContext();
> 		TilesContainer container = TilesAccess.getContainer(servletContext);               //here get null container
> 		javax.servlet.http.HttpServletRequest request = ServletActionContext.getRequest();
> 		javax.servlet.http.HttpServletResponse response = ServletActionContext.getResponse();
> 		container.render(location, new Object[] {request, response});                             //here will throw the null pointer exception
> I traced the exception in the StrutsTilesListener ,it do not work at all,I suppose it  is the static initialize method work in error:
> 		INIT.put(
> 			"org.apache.tiles.factory.TilesContainerFactory",
> 			(class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null
> 				&& (class$org$apache$struts2$tiles$StrutsTilesContainerFactory =
> 					(new StrutsTilesContainerFactory[0]).getClass().getComponentType())
> 					== null
> 					? class$org$apache$struts2$tiles$StrutsTilesContainerFactory
> 					: class$org$apache$struts2$tiles$StrutsTilesContainerFactory)
> 				.getName());
> this code is what I can't understand!and How can I get the source code of the pluggin?

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