Cannot find message resources under key org.apache.struts.action.MESSAGE

Problem

A common resource bundle error in Struts framework, it usually caused by the System cant find the corresponding message resource.


javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
	org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1112)
	org.apache.struts.taglib.TagUtils.present(TagUtils.java:1055)
	org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:200)
	org.apache.jsp.pages.login_jsp._jspx_meth_html_005ferrors_005f0(login_jsp.java:160)
	org.apache.jsp.pages.login_jsp._jspx_meth_html_005fform_005f0(login_jsp.java:111)
	org.apache.jsp.pages.login_jsp._jspService(login_jsp.java:77)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
	org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
	org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
	org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
	org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
	org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
	org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
	org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
	org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

Solution

Just include the corresponding message resources.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" 
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">

<struts-config>

	<message-resources
		parameter="com.mkyong.common.properties.Common" />

</struts-config>

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Enzuek
Guest
Enzuek

It worked..!!!!

Mugil
Guest
Mugil

I had the Same problem I tried ur method but it havent worked.I closed and reopened eclipse after which it worked Thanks anyway.

Govarthanan
Guest
Govarthanan

I was also met the same problem. And I resolved by ur’s solution..Thanksss

Brian Moran
Guest
Brian Moran

I’ve also had this problem when using a tag with a number and not using format attribute like so:

trackback
Struts Tutorials | Tutorials

[…] Cannot find message resources under key org.apache.struts.action.MESSAGE […]