wood burning stoves 2.0*
The moose likes Struts and the fly likes Multiple bundles broke my app(properties file) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple bundles broke my app(properties file)" Watch "Multiple bundles broke my app(properties file)" New topic
Author

Multiple bundles broke my app(properties file)

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi, I was experimenting with Struts internationalization. Before doing this, I had only a single bundle that was for displaying errors. Everything worked then. But when I added another bundle, for localization purpose my error messages aren't displayed anymore. Ok, I managed to make a fix for that by specifying the bundle parameter in my <html:error/> tag. But some parts of my app is completely broken especially those that used the <html:javascript/> tag. Here's an exception I'm getting and I think it's pretty weird...



HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NullPointerException
org.apache.struts.validator.Resources.getMessage(Resources.java:173)
org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript(JavascriptValidatorTag.java:464)
org.apache.struts.taglib.html.JavascriptValidatorTag.renderJavascript(JavascriptValidatorTag.java:373)
org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptValidatorTag.java:335)
org.apache.jsp.WEB_002dINF.pages.signin_jsp._jspx_meth_html_javascript_0(signin_jsp.java:243)
org.apache.jsp.WEB_002dINF.pages.signin_jsp._jspx_meth_html_html_0(signin_jsp.java:102)
org.apache.jsp.WEB_002dINF.pages.signin_jsp._jspService(signin_jsp.java:63)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.17


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Yes, you can have multiple message files. There are some guidelines for doing so, however. Please read the "configuration" section of this link for more information.

In addition to the guidelines in the above link, here's one more:

Avoid usuing periods in your message resource name. Any periods indicate the package in which your resource bundle is being stored.


Merrill
Consultant, Sima Solutions
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Thanks for the info! Anyway, everything works fine now except when I use javascript/client validation for Struts.


<html:errors bundle="errorMessageResources"/>

<html:javascript formName="applicantFormBean"/>


I dunno if this is any different from above since I've fixed most of the pages excep this one...



HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NullPointerException
org.apache.struts.validator.Resources.getMessage(Resources.java:173)
org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript(JavascriptValidatorTag.java:464)
org.apache.struts.taglib.html.JavascriptValidatorTag.renderJavascript(JavascriptValidatorTag.java:373)
org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptValidatorTag.java:335)
org.apache.jsp.WEB_002dINF.pages.apply_jsp._jspx_meth_html_javascript_0(apply_jsp.java:259)
org.apache.jsp.WEB_002dINF.pages.apply_jsp._jspx_meth_html_html_0(apply_jsp.java:106)
org.apache.jsp.WEB_002dINF.pages.apply_jsp._jspService(apply_jsp.java:64)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.17




And here is the JSP file



everything works fine again after removing the
<html:javascript formName="applicantFormBean"/> tag. But I need it to lessen the load on my server during validation. Thanks!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Validation can't handle a message resource that does not use the default key. To get around this, put all your validation messages in a bundle that has no key attribute. This will cause it to use the default key.
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Thanks Merrill! What would I ever do without you guys! Do you this is an issue with Struts? I don't think it should ever be left that way... Or maybe I'm just not reading the docs enough. Anyway... It solved the problem! Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple bundles broke my app(properties file)