You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jason Thurston <ja...@gmail.com> on 2007/03/18 22:39:53 UTC

NullPointerException when using in my header.jsp file

This application uses
sitemesh 2.2.1
spring 2.0.3
struts 2.0.6
struts 1.2.9
struts-menu 2.4.2.1

If I put "<s:head theme="ajax"/> in my header.jsp file I get a
Nullpointer exception.  I found this link
http://forum.springframework.org/showthread.php?t=33874 talking about
the same error message which says the fix is in spring 2.0.3.
However, I am using spring 2.0.3 and I'm not using the spring
RequestContextListener.    The problem only occurs when I put the
<s:head theme="ajax"/> in the header.jsp page, it does not happen if I
put it in the same page as the struts2 action is mapped to.  Any ideas
how to fix this or track it down further.


2007-03-18 15:14:26 StandardWrapperValve[default]: Servlet.service()
for servlet default threw exception
java.lang.NullPointerException
        at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
        at org.apache.jsp.hosp.layouts.header_jsp._jspx_meth_s_head_0(header_jsp.java:177)
        at org.apache.jsp.hosp.layouts.header_jsp._jspService(header_jsp.java:68)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: NullPointerException when using in my header.jsp file

Posted by Jason Thurston <ja...@gmail.com>.
Musachi,

I like that src link you included. I looked at it then found the
Dispatcher.java class to look at the getInstance() method.  It's
getting a threadlocal of struts2 instance.  So I realized sitemesh
must be calling that header.jsp page before struts2 get's a chance to
put it's instance in the thread.  So that meant that my filter
ordering in web.xml wasn't right.   I need the struts2 filter before
sitemesh.  I'm sure that's the fix but when I changed the order I
still had problems.  So I found this link
http://struts.apache.org/2.0.6/docs/sitemesh-plugin.html reqarding
getting sitemesh and struts2 to play nice together.  Of course
implementing what the link says to do is causing other problems.  So
I've just got for mess around for a few hours or days until I get it
working with the struts2-sitemesh-filter instead of the standard
sitemesh filter I was using.  Then back to the ajax stuff...

Thanks for the help folks.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: NullPointerException when using in my header.jsp file

Posted by st...@gmail.com.
Musachy --

Not exactly sure what an "OP" is, but I am trying to save my brother from
banging his head on the keyboard.  I have found S2's Ajax support to be
harder to actually write than the docs would otherwise suggest.  Understand
this comment does not apply generally to S2, but rather a slice of it's
documented functionality.

Scott

On 3/19/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> How exactly does your comment help the OP?
>
> musachy
>
> On 3/19/07, stanlick@gmail.com <st...@gmail.com> wrote:
> >
> > Musachy --
> >
> > I have given up on the AJAX theme and moved exclusively to
> Prototype.jsfor
> > asynch behaviors.  There is no mystery prototype.js and it is very clear
> > to
> > code/read.  I had been using XHR directly and thought S2's tags would
> make
> > my life simpler.  However, even coding with XmlHttpRequest and having to
> > wrestle the DOM was more intuitive than the S2 tags and scripts!  I know
> > the
> > S2 sound bites sound great about how you can do AJAX with simple custom
> > tags, but after days became weeks of weirness, I honestly think you are
> > barking up the wrong tree using S2 for Ajaxy UI.
> >
> > Scott
> >
> > On 3/19/07, Musachy Barroso <mu...@gmail.com> wrote:
> > >
> > > Looking at that line here:
> > >
> > >
> > >
> >
> http://svn.apache.org/viewvc/struts/struts2/tags/STRUTS_2_0_6/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java?annotate=509057
> > >
> > >
> > > Container container = Dispatcher.getInstance().getContainer();
> > >
> > >
> > > it seems like Dispatcher.getInstance() is returning null, which I
> don't
> > > know
> > > how could happen. If you remove the s:head tag everything else works?
> > >
> > > musachy
> > >
> > > On 3/18/07, Jason Thurston <ja...@gmail.com> wrote:
> > > >
> > > > This application uses
> > > > sitemesh 2.2.1
> > > > spring 2.0.3
> > > > struts 2.0.6
> > > > struts 1.2.9
> > > > struts-menu 2.4.2.1
> > > >
> > > > If I put "<s:head theme="ajax"/> in my header.jsp file I get a
> > > > Nullpointer exception.  I found this link
> > > > http://forum.springframework.org/showthread.php?t=33874 talking
> about
> > > > the same error message which says the fix is in spring 2.0.3.
> > > > However, I am using spring 2.0.3 and I'm not using the spring
> > > > RequestContextListener.    The problem only occurs when I put the
> > > > <s:head theme="ajax"/> in the header.jsp page, it does not happen if
> I
> > > > put it in the same page as the struts2 action is mapped to.  Any
> ideas
> > > > how to fix this or track it down further.
> > > >
> > > >
> > > > 2007-03-18 15:14:26 StandardWrapperValve[default]: Servlet.service()
> > > > for servlet default threw exception
> > > > java.lang.NullPointerException
> > > >         at
> org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag
> > (
> > > > ComponentTagSupport.java:50)
> > > >         at
> org.apache.jsp.hosp.layouts.header_jsp._jspx_meth_s_head_0
> > > > (header_jsp.java:177)
> > > >         at org.apache.jsp.hosp.layouts.header_jsp._jspService
> > > > (header_jsp.java:68)
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > "Hey you! Would you help me to carry the stone?" Pink Floyd
> > >
> >
> >
> >
> > --
> > Scott
> > stanlick@gmail.com
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
Scott
stanlick@gmail.com

Re: NullPointerException when using in my header.jsp file

Posted by Musachy Barroso <mu...@gmail.com>.
How exactly does your comment help the OP?

musachy

On 3/19/07, stanlick@gmail.com <st...@gmail.com> wrote:
>
> Musachy --
>
> I have given up on the AJAX theme and moved exclusively to Prototype.jsfor
> asynch behaviors.  There is no mystery prototype.js and it is very clear
> to
> code/read.  I had been using XHR directly and thought S2's tags would make
> my life simpler.  However, even coding with XmlHttpRequest and having to
> wrestle the DOM was more intuitive than the S2 tags and scripts!  I know
> the
> S2 sound bites sound great about how you can do AJAX with simple custom
> tags, but after days became weeks of weirness, I honestly think you are
> barking up the wrong tree using S2 for Ajaxy UI.
>
> Scott
>
> On 3/19/07, Musachy Barroso <mu...@gmail.com> wrote:
> >
> > Looking at that line here:
> >
> >
> >
> http://svn.apache.org/viewvc/struts/struts2/tags/STRUTS_2_0_6/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java?annotate=509057
> >
> >
> > Container container = Dispatcher.getInstance().getContainer();
> >
> >
> > it seems like Dispatcher.getInstance() is returning null, which I don't
> > know
> > how could happen. If you remove the s:head tag everything else works?
> >
> > musachy
> >
> > On 3/18/07, Jason Thurston <ja...@gmail.com> wrote:
> > >
> > > This application uses
> > > sitemesh 2.2.1
> > > spring 2.0.3
> > > struts 2.0.6
> > > struts 1.2.9
> > > struts-menu 2.4.2.1
> > >
> > > If I put "<s:head theme="ajax"/> in my header.jsp file I get a
> > > Nullpointer exception.  I found this link
> > > http://forum.springframework.org/showthread.php?t=33874 talking about
> > > the same error message which says the fix is in spring 2.0.3.
> > > However, I am using spring 2.0.3 and I'm not using the spring
> > > RequestContextListener.    The problem only occurs when I put the
> > > <s:head theme="ajax"/> in the header.jsp page, it does not happen if I
> > > put it in the same page as the struts2 action is mapped to.  Any ideas
> > > how to fix this or track it down further.
> > >
> > >
> > > 2007-03-18 15:14:26 StandardWrapperValve[default]: Servlet.service()
> > > for servlet default threw exception
> > > java.lang.NullPointerException
> > >         at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag
> (
> > > ComponentTagSupport.java:50)
> > >         at org.apache.jsp.hosp.layouts.header_jsp._jspx_meth_s_head_0
> > > (header_jsp.java:177)
> > >         at org.apache.jsp.hosp.layouts.header_jsp._jspService
> > > (header_jsp.java:68)
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
>
> --
> Scott
> stanlick@gmail.com
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: NullPointerException when using in my header.jsp file

Posted by Dave Newton <ne...@yahoo.com>.
--- stanlick@gmail.com wrote:
> I honestly think you are barking up the wrong tree 
> using S2 for Ajaxy UI.

Just to provide a counter-example, I am using many of
the S2 tags in multiple applications to provide a fair
amount of Ajaxification very successfully.

There are definitely many use-cases that the S2 tags
do not address (at least for now) but for lots of
simple things they're a lot easier than writing the
JavaScript by hand.

d.



 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: NullPointerException when using in my header.jsp file

Posted by st...@gmail.com.
Musachy --

I have given up on the AJAX theme and moved exclusively to Prototype.js for
asynch behaviors.  There is no mystery prototype.js and it is very clear to
code/read.  I had been using XHR directly and thought S2's tags would make
my life simpler.  However, even coding with XmlHttpRequest and having to
wrestle the DOM was more intuitive than the S2 tags and scripts!  I know the
S2 sound bites sound great about how you can do AJAX with simple custom
tags, but after days became weeks of weirness, I honestly think you are
barking up the wrong tree using S2 for Ajaxy UI.

Scott

On 3/19/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> Looking at that line here:
>
>
> http://svn.apache.org/viewvc/struts/struts2/tags/STRUTS_2_0_6/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java?annotate=509057
>
>
> Container container = Dispatcher.getInstance().getContainer();
>
>
> it seems like Dispatcher.getInstance() is returning null, which I don't
> know
> how could happen. If you remove the s:head tag everything else works?
>
> musachy
>
> On 3/18/07, Jason Thurston <ja...@gmail.com> wrote:
> >
> > This application uses
> > sitemesh 2.2.1
> > spring 2.0.3
> > struts 2.0.6
> > struts 1.2.9
> > struts-menu 2.4.2.1
> >
> > If I put "<s:head theme="ajax"/> in my header.jsp file I get a
> > Nullpointer exception.  I found this link
> > http://forum.springframework.org/showthread.php?t=33874 talking about
> > the same error message which says the fix is in spring 2.0.3.
> > However, I am using spring 2.0.3 and I'm not using the spring
> > RequestContextListener.    The problem only occurs when I put the
> > <s:head theme="ajax"/> in the header.jsp page, it does not happen if I
> > put it in the same page as the struts2 action is mapped to.  Any ideas
> > how to fix this or track it down further.
> >
> >
> > 2007-03-18 15:14:26 StandardWrapperValve[default]: Servlet.service()
> > for servlet default threw exception
> > java.lang.NullPointerException
> >         at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(
> > ComponentTagSupport.java:50)
> >         at org.apache.jsp.hosp.layouts.header_jsp._jspx_meth_s_head_0
> > (header_jsp.java:177)
> >         at org.apache.jsp.hosp.layouts.header_jsp._jspService
> > (header_jsp.java:68)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
Scott
stanlick@gmail.com

Re: NullPointerException when using in my header.jsp file

Posted by Musachy Barroso <mu...@gmail.com>.
Looking at that line here:

http://svn.apache.org/viewvc/struts/struts2/tags/STRUTS_2_0_6/core/src/main/java/org/apache/struts2/views/jsp/ComponentTagSupport.java?annotate=509057


Container container = Dispatcher.getInstance().getContainer();


it seems like Dispatcher.getInstance() is returning null, which I don't know
how could happen. If you remove the s:head tag everything else works?

musachy

On 3/18/07, Jason Thurston <ja...@gmail.com> wrote:
>
> This application uses
> sitemesh 2.2.1
> spring 2.0.3
> struts 2.0.6
> struts 1.2.9
> struts-menu 2.4.2.1
>
> If I put "<s:head theme="ajax"/> in my header.jsp file I get a
> Nullpointer exception.  I found this link
> http://forum.springframework.org/showthread.php?t=33874 talking about
> the same error message which says the fix is in spring 2.0.3.
> However, I am using spring 2.0.3 and I'm not using the spring
> RequestContextListener.    The problem only occurs when I put the
> <s:head theme="ajax"/> in the header.jsp page, it does not happen if I
> put it in the same page as the struts2 action is mapped to.  Any ideas
> how to fix this or track it down further.
>
>
> 2007-03-18 15:14:26 StandardWrapperValve[default]: Servlet.service()
> for servlet default threw exception
> java.lang.NullPointerException
>         at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(
> ComponentTagSupport.java:50)
>         at org.apache.jsp.hosp.layouts.header_jsp._jspx_meth_s_head_0
> (header_jsp.java:177)
>         at org.apache.jsp.hosp.layouts.header_jsp._jspService
> (header_jsp.java:68)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd