Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24

Thread: can't get mongodb, jsf to run mvn tomcat:run or jetty:run

  1. #21
    Join Date
    Dec 2012
    Posts
    16

    Default

    package com.myapp.jsf.util;

    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Locale;

    import javax.annotation.PostConstruct;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    import javax.faces.context.FacesContext;
    import javax.faces.model.SelectItem;

    @ManagedBean
    @SessionScoped
    public class LocaleBean {
    private Locale locale;

    @PostConstruct
    public void init() {
    locale = FacesContext.getCurrentInstance().getExternalConte xt().getRequestLocale();
    }

    public Locale getLocale() {
    return locale;
    }

    public void setLocale(Locale locale) {
    this.locale = locale;
    }

    public SelectItem[] getLocales() {
    List<SelectItem> items = new ArrayList<SelectItem>();
    Iterator<Locale> supportedLocales = FacesContext.getCurrentInstance().getApplication() .getSupportedLocales();
    while (supportedLocales.hasNext()) {
    Locale locale = supportedLocales.next();
    items.add(new SelectItem(locale.toString(), locale.getDisplayName()));
    }
    return items.toArray(new SelectItem[] {});
    }

    public String getSelectedLocale() {
    return getLocale().toString();
    }

    public void setSelectedLocale() {
    setSelectedLocale(FacesContext.getCurrentInstance( ).getExternalContext().getRequestParameterMap().ge t("locale"));
    }

    public void setSelectedLocale(String localeString) {
    Iterator<Locale> supportedLocales = FacesContext.getCurrentInstance().getApplication() .getSupportedLocales();
    while (supportedLocales.hasNext()) {
    Locale locale = supportedLocales.next();
    if (locale.toString().equals(localeString)) {
    this.locale = locale;
    break;
    }
    }
    }
    }

  2. #22
    Join Date
    Jul 2012
    Posts
    12

    Default

    This is a web server version problem.

    If you use Tomcat 7.x it should work without problems. You're already done

  3. #23
    Join Date
    Dec 2012
    Posts
    16

    Default

    if i instead use jetty:run (since i think i am using tomcat 7) i get this:



    Problem accessing /myapp/pages/main.jsf. Reason:

    Target Unreachable, identifier 'bookBean' resolved to null

    Caused by:

    javax.el.PropertyNotFoundException: Target Unreachable, identifier 'bookBean' resolved to null

    this has taken waaaaay too much time at this point. i thought this was supposed to be RAD out-of-the-box. i'm going to try groovy and see how much luck i have there.

  4. #24
    Join Date
    Dec 2012
    Posts
    16

    Default

    so i switched to tomcat7 :

    Dec 15, 2012 11:19:35 AM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.25

    but still i get the locale bean error:

    SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/thedrvault] threw exception [/templates/layout.xhtml at line 8 and column 63 locale="#{localeBean.locale}" Attribute did not evaluate to a String or Locale: null] with root cause
    javax.faces.view.facelets.TagAttributeException: /templates/layout.xhtml at line 8 and column 63 locale="#{localeBean.locale}" Attribute did not evaluate to a String or Locale: null

Posting Permissions

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