struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramkumar Krishnan" <ramkumar.ya...@gmail.com>
Subject NullPointerException in while initializing message resource
Date Tue, 04 Apr 2006 07:18:05 GMT
Hi All,
  I am getting Null PointerException when i tried to view my login page.
Struts is not able to find the message resources.

This is configuration in my struts-config.xml
<message-resources parameter="security" null="false"></message-resources>

i am getting
java.lang.NullPointerException at
org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1174)
at                    org.apache.struts.taglib.TagUtils.message(
TagUtils.java:1037) at org.apache.struts.taglib.bean.MessageTag.doStartTag(
MessageTag.java:224) at
jsp_servlet._content._jsp.__login._jspService(__login.java:161) at
weblogic.servlet.jsp.JspBase.service(JspBase.java:33)


I have attached the struts source i and i found it is happening in the
following line of TagUtils class
----
if (resources == null) {
            ModuleConfig moduleConfig = getModuleConfig(pageContext);  //
Returns Null !!
            resources =
                    (MessageResources) pageContext.getAttribute(
                            bundle + moduleConfig.getPrefix(),
                            PageContext.APPLICATION_SCOPE);
}


While debugging, it  is returning the ModuleConfig as null. I dont' know why
it is trying to get the module config even though i haven't configured any
struts module.


This is my web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>AdminWar</display-name>
<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/classes/spring/*.xml</param-value>
    </context-param>

    <!--  load a shared service layer parent application context -->
    <context-param>
        <param-name>locatorFactorySelector</param-name>
        <param-value>beanRefContext.xml</param-value>
    </context-param>
    <context-param>
        <param-name>parentContextKey</param-name>
        <param-value>application-context</param-value>
    </context-param>
<listener>
        <listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet
</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <!--<init-param>
            <param-name>application</param-name>
            <param-value>security</param-value>
        </init-param>
    --></servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
<taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/c.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-html-extn.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-html-extn.tld
</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>/WEB-INF/fmt.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/fmt.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-html-el.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-html-el.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-bean-el.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-bean-el.tld</taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-nested.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/tavant_taglib.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/tavant_taglib.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/homer.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/homer.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/PermissionTags.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/PermissionTags.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>/WEB-INF/oscache.tld</taglib-uri>
        <taglib-location>/WEB-INF/tlds/oscache.tld</taglib-location>
    </taglib>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>SecurePages</web-resource-name>
            <description>Security constraint /secure</description>
            <url-pattern>/content/jsp/*</url-pattern>
            <http-method>POST</http-method>
            <http-method>GET</http-method>
        </web-resource-collection>
        <auth-constraint>
            <description>These are the roles who have access</description>
            <role-name>users</role-name>
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>myrealm</realm-name>
        <form-login-config>
            <form-login-page>/content/jsp/login.jsp</form-login-page>
            <form-error-page>/content/jsp/loginError.jsp</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <description>An Employee</description>
        <role-name>users</role-name>
    </security-role>
</web-app>

thanks in advance,
--
Ramkumar K,

<a href="http://www.spreadfirefox.com/?q=affiliates&amp;id=0&amp;t=65"><img
border="0" alt="Get Firefox!" title="Get Firefox!" src="
http://sfx-images.mozilla.org/affiliates/Buttons/110x32/safer.gif"/></a>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message