Results 1 to 10 of 10

Thread: Roo 1.2: Problem with Locale using web jsf

  1. #1
    Join Date
    Apr 2012
    Posts
    11

    Default Roo 1.2: Problem with Locale using web jsf

    When I reverse engineer my database, the following error occurs when I run the application in TomCat:
    Code:
    java.util.MissingResourceException: Can't find bundle for base name br.com.clinica.control.i18n.messages, locale pt_BR
    	java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1539)
    	java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1278)
    	java.util.ResourceBundle.getBundle(ResourceBundle.java:980)
    	com.sun.faces.application.ApplicationResourceBundle.getResourceBundle(ApplicationResourceBundle.java:124)
    	com.sun.faces.application.ApplicationAssociate.getResourceBundle(ApplicationAssociate.java:608)
    	com.sun.faces.application.ApplicationImpl.getResourceBundle(ApplicationImpl.java:698)
    	com.sun.faces.el.FacesResourceBundleELResolver.getValue(FacesResourceBundleELResolver.java:83)
    	com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    	com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    	org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
    	org.apache.el.parser.AstValue.getValue(AstValue.java:147)
    	org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
    	javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    	javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
    	javax.faces.component.UICommand.getValue(UICommand.java:218)
    	org.primefaces.component.menu.BaseMenuRenderer.encodeMenuItem(BaseMenuRenderer.java:102)
    	org.primefaces.component.menu.MenuRenderer.encodePlainMenuContent(MenuRenderer.java:124)
    	org.primefaces.component.menu.MenuRenderer.encodePlainSubmenu(MenuRenderer.java:159)
    	org.primefaces.component.menu.MenuRenderer.encodePlainMenuContent(MenuRenderer.java:128)
    	org.primefaces.component.menu.MenuRenderer.encodeMarkup(MenuRenderer.java:100)
    	org.primefaces.component.menu.BaseMenuRenderer.encodeEnd(BaseMenuRenderer.java:40)
    	javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1763)
    	javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    	javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    	org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:57)
    	org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:45)
    	org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:185)
    	org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:108)
    	org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:55)
    	javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    	com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
    	com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
    	com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
    	javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    	com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
    	com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
    	com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
    	javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1756)
    	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
    	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
    	com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)
    	com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    	com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    	javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    	org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    	org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147)
    	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    I tried to use the servers that comes with STS, but they don't run here, it says they are missing Catalina.class.
    help me guys, I've been googling around for one week but as jsf support on roo is new, I didn't find many sollutions for it. Don't know what to do anymore.

  2. #2
    Join Date
    Apr 2012
    Posts
    11

    Default

    If I open it under Windows, or STS built-in browser, that error comes. If I open it on Ubuntu's Chrome, my page is displayed correctly. Looks like this is related to the Locale of the browser. How can I force it to always use English, no matter the browser location?

  3. #3
    Join Date
    Apr 2012
    Posts
    11

    Default

    It was quite urgent... is there ony other forum recommended for me to go looking for help?

  4. #4
    Join Date
    Dec 2005
    Posts
    929

    Default

    Use mvn jetty:run-exploded
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  5. #5
    Join Date
    Apr 2012
    Posts
    11

    Default

    Still same problem... web page only loads on Chrome. Jetty shows same exception.

  6. #6
    Join Date
    Dec 2005
    Posts
    929

    Default

    Your error states that you are missing the message bundle. Did you create the messages_pt.properties in i18n and add it to the faces-config.xml file?
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  7. #7
    Join Date
    Apr 2012
    Posts
    11

    Default

    Thanks, that worked.
    Now I'm facing problems with inherited entities mapped as --inheritanceType JOINED, and superclass abstract and --mappedSuperclass.
    the form is shown empty.

  8. #8
    Join Date
    Apr 2012
    Posts
    11

    Default

    Is there any workaround for this problem with Locale? I sent the link of my application for a turkish friend, and he couldn't access it because of the default location of his browser.

  9. #9
    Join Date
    Aug 2012
    Posts
    1

    Default

    The problem is with LocaleBean.init()
    Used method FacesContext.getCurrentInstance().getExternalConte xt().getRequestLocale() simply returns current user browser locale
    without checking is it supported by application.
    init should use calculateLocale which returns default locale if application does not support current browser locale.
    @PostConstruct
    public void init() {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (facesContext!=null)
    locale = facesContext.getApplication().getViewHandler().cal culateLocale(facesContext);
    //locale = FacesContext.getCurrentInstance().getExternalConte xt().getRequestLocale();
    }

  10. #10
    Join Date
    Oct 2012
    Posts
    3

    Default

    Hello Alan,

    When creating the file (messages_pt.properties) and run the application can not use the open pages of the application. Visualize only the home page.

    INFO: Creating instance of br.com.moviejsf.web.ApplicationBean
    11/21/2012 15:53:53 org.apache.myfaces.config.annotation.Tomcat7Annota tionLifecycleProvider newInstance
    INFO: Creating instance of br.com.moviejsf.web.ApplicationBean
    11/21/2012 15:54:04 org.apache.myfaces.config.annotation.Tomcat7Annota tionLifecycleProvider newInstance
    INFO: Creating instance of br.com.moviejsf.web.ApplicationBean
    11/21/2012 16:02:05 org.apache.myfaces.config.annotation.Tomcat7Annota tionLifecycleProvider newInstance
    INFO: Creating instance of br.com.moviejsf.web.ApplicationBean
    11/21/2012 16:02:06 org.apache.myfaces.config.annotation.Tomcat7Annota tionLifecycleProvider newInstance
    INFO: Creating instance of br.com.moviejsf.web.ApplicationBean
    21/11/2012 16:17:44 org.apache.myfaces.shared.renderkit.html.HtmlImage RendererBase encodeEnd
    AVISO: Component UIGraphic j_id_a:j_id_c has no attribute alt or attribute resolves to null. Path to component {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /viewExpired.xhtml][Class: javax.faces.component.html.HtmlBody,Id: j_id_6][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id_7][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id_8][Class: org.primefaces.component.panel.Panel,Id: j_id_9][Class: javax.faces.component.html.HtmlForm,Id: j_id_a][Class: javax.faces.component.html.HtmlOutputLink,Id: j_id_b][Class: javax.faces.component.html.HtmlGraphicImage,Id: j_id_c]}

    Follows commands used in the project (Windows):

    jpa setup --database HYPERSONIC_IN_MEMORY --provider HIBERNATE
    entity jpa --class ~.model.Movie --testAutomatically
    field string --fieldName title
    field string --fieldName description
    field number --fieldName discs --type int
    enum type --class ~.model.Format
    focus --class ~.model.Format
    enum constant --name DVD
    enum constant --name BLURAY
    focus --class ~.model.Movie
    field enum --fieldName format --type ~.model.Format
    finder add findMoviesByTitleLike
    web jsf setup --implementation APACHE_MYFACES --library PRIMEFACES --theme EGGPLANT
    web jsf all --package ~.web


    Thank you
    Erro_movieJSF (2).jpg
    Last edited by lorenarc; Nov 21st, 2012 at 12:20 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •