Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:39:26+00:00 2026-05-27T16:39:26+00:00

I am writing a JSF page, where user can change his password. I based

  • 0

I am writing a JSF page, where user can change his password. I based my solution on the code example from JavaServer Faces (3rd edition) book by David Geary and Cay S. Horstmann. Here is my code:

<h:inputText id="oldPassword" required="true"
    validator="#{accountBean.validateOldPassword}">
    <f:ajax event="blur" render="oldPasswordError" />
</h:inputText>
<h:message for="oldPassword" id="oldPasswordError" style="color: red" />

Part of AccountBean.java:

@Named("accountBean")
@SessionScoped
public class AccountBean implements Serializable {
    private String login;
    private String password;

    (...)
    public void validateOldPassword(FacesContext context, UIComponent component, Object value) {
        if (!(((String)value).equals(password)))
            throw new ValidatorException(new FacesMessage("Invalid password"));
    }
}

Now, when I deploy this into JBoss AS 7.0.2 and try to use I get such error rendered near old password field:

/changePassword.xhtml @28,54 validator="#{accountBean.validateOldPassword}": Method not found: pl.edu.pw.mini.smartdialer.presentation.AccountBean@d1ff44.validateOldPassword(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)

It claims that method cannot be found, why?
This is nearly copy/paste from the book and still not working.
I have no idea where to find a bug. Could you help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:39:26+00:00Added an answer on May 27, 2026 at 4:39 pm

    As per the comments, the CDI annotations seem to not work at all.

    In order to get them to work, you need to drop a beans.xml file in /WEB-INF folder. That file can be left empty. Just the presence of the file with exactly that name in exactly that location is sufficient for the container to start scanning for classes with CDI annotations.

    If those classes are inside a JAR file which is in turn included in /WEB-INF/lib, then you should instead drop that file in /META-INF folder of the JAR.

    This is done so to avoid unnecessary scanning for annotations during container’s startup. Scanning the entire classpath for annotations is a relatively expensive job which may slow down container’s startup. That’s why you need the beans.xml file in order to trigger it on a per-WAR and per-JAR basis. The same construct is by the way also applied by JSF with faces-config.xml. If that file is absent in WAR or JAR, then JSF won’t scan for JSF-specific annotations inside WAR or JAR as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my JSF application, I need to redirect the user from Page A to
Writing the code for the user authentication portion of a web site (including account
When the Apache My Faces JSF 1.2 Implementation renders an HTML page behind the
I'm writing my own implementation of JMX console for JBoss 6.1 based on JSF.
I am writing a web application (While learning JSF from scratch, and thanks to
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
Writing documentation in html requires some code examples. What to do with characters that
I'm using Tomcat 7, MySql Workbench 5.2.27, JSF 2.0 and this exception comes from
Writing some drag&drop code, I'd like to cancel the click events in my mouseup
I'm writing a JSF 2.1 web application, which is hosted by Tomcat 6. At

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.