You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Sherman <ad...@tritus.ca> on 2003/03/22 04:00:59 UTC

NPE accessing Resources

Need some help with this, been banging on it for a while.

java.lang.NullPointerException
	at java.util.Hashtable.get(Hashtable.java:329)
	at 
org.apache.jasper.runtime.PageContextImpl.findAttribute(PageContextImpl.java:308)
	at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:811)
	at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:859)
	at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:274)
	at 
org.apache.strutsel.taglib.bean.ELMessageTag.doStartTag(ELMessageTag.java:279)

I get this when access resources with tags like <html:errors/> or 
<bean:message/>. Happens with both the EL and non-EL versions of the Struts 
TLDs and I is my fault since the example apps all work fine in my 
installation.

I trible-checked my struts-config.xml to make sure my 
ApplicationResources.properties was being referenced properly and I'm not 
getting any loading errors. So WTF?

I tried using JSwat to look at stuff, thought maybe I would be able to examine 
the Application Context but I discovered that debugging is not for weenies.

So, what can I do to further my cause?

Thanks,

A.


-- 
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819


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


Re: NPE accessing Resources

Posted by Adam Sherman <ad...@tritus.ca>.
On Saturday, March 22, 2003 21:21:14 -0800 "David M. Karr" 
<dm...@earthlink.net> wrote:

>     >> Ok, try doing this with plain Struts (to remove variables), let's
> see a     >> page that demonstrates this problem, and perhaps your
> struts-config.xml     >> file.  If you can set this up in your debugger,
> trace the setting and     >> getting of your "name" and "property"
> attributes.
>
>     Adam> You are referring to the attributes of my resource?
>
> No.  This is failing looking up a bean, not resources in a properties
> file.

Our messages crossed.

My understanding is that it is failing to find the global messages bean, 
yes?

Thanks,

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819

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


Re: NPE accessing Resources

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Adam" == Adam Sherman <ad...@tritus.ca> writes:

    Adam> --On Saturday, March 22, 2003 12:26:45 -0800 "David M. Karr"
    Adam> <dm...@earthlink.net> wrote:


    >> Ok, try doing this with plain Struts (to remove variables), let's see a
    >> page that demonstrates this problem, and perhaps your struts-config.xml
    >> file.  If you can set this up in your debugger, trace the setting and
    >> getting of your "name" and "property" attributes.

    Adam> You are referring to the attributes of my resource?

No.  This is failing looking up a bean, not resources in a properties file.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




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


Re: NPE accessing Resources

Posted by Adam Sherman <ad...@tritus.ca>.

--On Saturday, March 22, 2003 12:26:45 -0800 "David M. Karr" 
<dm...@earthlink.net> wrote:

> Ok, try doing this with plain Struts (to remove variables), let's see a
> page that demonstrates this problem, and perhaps your struts-config.xml
> file.  If you can set this up in your debugger, trace the setting and
> getting of your "name" and "property" attributes.

You are referring to the attributes of my resource?

Thanks,

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819

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


Re: NPE accessing Resources

Posted by Adam Sherman <ad...@tritus.ca>.
On Saturday, March 22, 2003 12:26:45 -0800 "David M. Karr" 
<dm...@earthlink.net> wrote:
> Ok, try doing this with plain Struts (to remove variables), let's see a
> page that demonstrates this problem, and perhaps your struts-config.xml
> file.  If you can set this up in your debugger, trace the setting and
> getting of your "name" and "property" attributes.

Well I fired up JSwat and looked around. Now I don't know much about 
debugging but I inserted a breakpoint bean.MessageTag.doStartTag() to see 
what was hapening.

>>From what I can gather, the "messages" property of most of the various 
objects has no values, size == 0. That isn't normal, right?

Thanks very much for your help!

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819

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


Re: NPE accessing Resources

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Adam" == Adam Sherman <ad...@tritus.ca> writes:

    Adam> --On Friday, March 21, 2003 21:53:10 -0800 "David M. Karr"
    Adam> <dm...@earthlink.net> wrote:

    >> What version of Struts are you using?  If you're not using the nightly
    >> build, try that.  There is a known bug with "html-el:errors" in RC1, that
    >> might cause this.

    Adam> Yeah, I noticed this in previous threads and tried a nighly. Doesn't help.

    Adam> Note that the problem arises for anything that accesses resources, not only
    Adam> html:errors. Also, I have problem both with the EL version and non-EL version
    Adam> of the TLDs.

Ok, try doing this with plain Struts (to remove variables), let's see a page
that demonstrates this problem, and perhaps your struts-config.xml file.  If
you can set this up in your debugger, trace the setting and getting of your
"name" and "property" attributes.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




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


Re: NPE accessing Resources

Posted by Adam Sherman <ad...@tritus.ca>.
--On Friday, March 21, 2003 21:53:10 -0800 "David M. Karr" 
<dm...@earthlink.net> wrote:

> What version of Struts are you using?  If you're not using the nightly
> build, try that.  There is a known bug with "html-el:errors" in RC1, that
> might cause this.

Yeah, I noticed this in previous threads and tried a nighly. Doesn't help.

Note that the problem arises for anything that accesses resources, not only 
html:errors. Also, I have problem both with the EL version and non-EL 
version of the TLDs.

Thanks for your input,

A.

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


Re: NPE accessing Resources

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Adam" == Adam Sherman <ad...@tritus.ca> writes:

    Adam> Need some help with this, been banging on it for a while.
    Adam> java.lang.NullPointerException
    Adam> 	at java.util.Hashtable.get(Hashtable.java:329)
    Adam> 	at 
    Adam> org.apache.jasper.runtime.PageContextImpl.findAttribute(PageContextImpl.java:308)
    Adam> 	at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:811)
    Adam> 	at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:859)
    Adam> 	at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:274)
    Adam> 	at 
    Adam> org.apache.strutsel.taglib.bean.ELMessageTag.doStartTag(ELMessageTag.java:279)

    Adam> I get this when access resources with tags like <html:errors/> or 
    Adam> <bean:message/>. Happens with both the EL and non-EL versions of the Struts 
    Adam> TLDs and I is my fault since the example apps all work fine in my 
    Adam> installation.

    Adam> I trible-checked my struts-config.xml to make sure my 
    Adam> ApplicationResources.properties was being referenced properly and I'm not 
    Adam> getting any loading errors. So WTF?

    Adam> I tried using JSwat to look at stuff, thought maybe I would be able to examine 
    Adam> the Application Context but I discovered that debugging is not for weenies.

    Adam> So, what can I do to further my cause?

What version of Struts are you using?  If you're not using the nightly build,
try that.  There is a known bug with "html-el:errors" in RC1, that might cause
this.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




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