You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Pierre-Alain RIVIERE <pa...@ippon.fr> on 2008/10/06 15:01:09 UTC

Re: Problem injecting ApplicationStateManager into service implementing commons-upload ProgressListener

Hello,

Maybe it's related but 5.0.14 gives me the same result here. 
But the use case seems to be the same : contributing a RequestFilter
with the ApplicationStateService thrown a NPE.

And no solution or hack for now. Too bad cause my webapp is just a
simple upload manager for my own purpose.

I've also a solution using http://swfupload.org/ for upload progress but
there's some known issues using it on Linux :/



On Mon, 2008-10-06 at 12:45 +0200, Francois Armand wrote:
> Pierre-Alain RIVIERE wrote:
> > Hello,
> >
> > [...]
> >
> > Using this code I've got a NPE when ApplicationStateManager try to get
> > the HttpSession : http://pastebin.com/m1f968817
> > In debug mode, request.getSession() throws NPE.
> >   
> 
> Hello,
> 
> I just attempt to upgrade from T5.0.14 to T5.0.15 and now, I have the 
> same problem with a code witch used to work.
> So, it seems that there is a bug here, and I'm wondering if it's not 
> link to  a previous thread: 
> http://markmail.org/search/?q=list%3Aorg.apache.tapestry.users+NPE+when+trying+to+contribute+ServletContextSymbolProvider+to+#query:list%3Aorg.apache.tapestry.users%20NPE%20when%20trying%20to%20contribute%20ServletContextSymbolProvider%20to%20+page:1+mid:hdcboxjrxkrgruyy+state:results
> 
> Pierre-Alain, did you find a solution ?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Problem injecting ApplicationStateManager into service implementing commons-upload ProgressListener

Posted by Pierre-Alain RIVIERE <pa...@ippon.fr>.
Using your method do not solve my NPE calling ApplicationStateManager.

BUT! now I can inject HttpServletRequest in my ProgressListenerImpl
(instead of ApplicationStateManager) and get my state object using

----------------------------------------------------------------- 
(UserData) request.getSession().getAttribute(
				"aso:" + UserData.class.getName())
-----------------------------------------------------------------

It's not a definitive, just a workaround but I can keep working on other
functionality now. Thanks :D

Note : This code doesn't work without the contribution to
RequestHandler.


On Tue, 2008-10-07 at 16:42 +0200, Francois Armand wrote:
> Francois Armand wrote:
> [...].
> 
> So, I have no idea why the bug is not always here.
> 
> But it happens that the problem was that I try to use (tapestry) Request 
> before the call to requestGlobals.storeRequestResponse(request, 
> response); was done : I'm in a RequestHandler, and this is done in the 
> terminator of requesthandler pipeline.
> 
> So, I just did :
> 
>     public static RequestFilter buildSetRequestResponse(final 
> RequestGlobals requestGlobals) {
>         return new RequestFilter(){
>             public boolean service(Request request, Response response, 
> RequestHandler handler) throws IOException {
>                 requestGlobals.storeRequestResponse(request, response);
>                 return handler.service(request, response);
>             }
>         };
>     }
> 
>     public static void 
> contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
>             @InjectService("setRequestResponse") RequestFilter 
> setRequestResponse,
>            .... (other handlers)) {
>         configuration.add("setRequestResponse", setRequestResponse, 
> "before:*");
>         ...
>     }
> 
> 
> And now, everything works.
> 
> I believe it could need a bugreport, as it seems quite ok to want to use 
> the Request object (and not only the HttpRequest's one) in RequestHandler.
> 
> Hope it's really that, and that is may help other people.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Problem injecting ApplicationStateManager into service implementing commons-upload ProgressListener

Posted by Francois Armand <fa...@linagora.com>.
Francois Armand wrote:
[...].

So, I have no idea why the bug is not always here.

But it happens that the problem was that I try to use (tapestry) Request 
before the call to requestGlobals.storeRequestResponse(request, 
response); was done : I'm in a RequestHandler, and this is done in the 
terminator of requesthandler pipeline.

So, I just did :

    public static RequestFilter buildSetRequestResponse(final 
RequestGlobals requestGlobals) {
        return new RequestFilter(){
            public boolean service(Request request, Response response, 
RequestHandler handler) throws IOException {
                requestGlobals.storeRequestResponse(request, response);
                return handler.service(request, response);
            }
        };
    }

    public static void 
contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
            @InjectService("setRequestResponse") RequestFilter 
setRequestResponse,
           .... (other handlers)) {
        configuration.add("setRequestResponse", setRequestResponse, 
"before:*");
        ...
    }


And now, everything works.

I believe it could need a bugreport, as it seems quite ok to want to use 
the Request object (and not only the HttpRequest's one) in RequestHandler.

Hope it's really that, and that is may help other people.

-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Problem injecting ApplicationStateManager into service implementing commons-upload ProgressListener

Posted by Francois Armand <fa...@linagora.com>.
Pierre-Alain RIVIERE wrote:
> Hello,
>
> Maybe it's related but 5.0.14 gives me the same result here. 
> But the use case seems to be the same : contributing a RequestFilter
> with the ApplicationStateService thrown a NPE.
>
> And no solution or hack for now. Too bad cause my webapp is just a
> simple upload manager for my own purpose.
>
> I've also a solution using http://swfupload.org/ for upload progress but
> there's some known issues using it on Linux :/
>
>   

Hum, I'm trying to look at this problem, and find some disturbing things.
- it's not a reproductible behaviour. In our team, we are 4 
developers+an integration server, with different jvm flavour (1.5 and 
1.6), and different appserver (jetty, jetty with run jetty run plugin, 
tomcat). Not every developers have the pb, and with no specific 
configuration link between the error and the NPE ;

- **** in my pc (java 5 or 6, run jetty run), the behavior depends off 
the debug level for org.apache.tapestry. In debug level, all is good, in 
info, I get the NPE. (so that I can't debug it :)

It's becoming to look like a Javassist bug...



-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org