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

  • Home
  • SEARCH
  • 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 7999233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:26:44+00:00 2026-06-04T15:26:44+00:00

Is the post construct annotation not supported in validators? I have a application scoped

  • 0

Is the post construct annotation not supported in validators?

I have a application scoped jndi servicelocator bean which I inject as a managed property into my validator.

@ManagedProperty(value = "#{jndiServiceLocatorBean}")
private final JndiServiceLocatorBean jndiServiceLocatorBean = null;

The post construct annotated method to initialize my necessary remote bean is never invoked and so my remote bean remains null.

private UserBeanRemote userBeanRemote = null;

@PostConstruct
public void postConstruct()
{
    this.userBeanRemote = (UserBeanRemote) this.jndiServiceLocatorBean.getRemoteBean(UserBeanRemote.class);
}
  • 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-06-04T15:26:46+00:00Added an answer on June 4, 2026 at 3:26 pm

    It works only if the Validator is annotated as a @ManagedBean or @Named instead of @FacesValidator.

    Just use the normal constructor instead.

    @FacesValidator("fooValidator")
    public class FooValidator implements Validator {
    
        private UserBeanRemote userBeanRemote;
    
        public FooValidator() {
            FacesContext context = FacesContext.getCurrentInstance();
            JndiServiceLocatorBean jndiServiceLocatorBean = context.getApplication().evaluateExpressionGet(context, "#{jndiServiceLocatorBean}", JndiServiceLocatorBean.class);
            this.userBeanRemote = (UserBeanRemote) jndiServiceLocatorBean.getRemoteBean(UserBeanRemote.class);
        }
    
        // ...
    }
    

    Support for dependency injection in JSF artifacts other than @ManagedBean is planned for JSF 2.2 (spec issue 763).

    See also:

    • How to inject in @FacesValidator with @EJB, @PersistenceContext, @Inject, @Autowired
    • Communication in JSF 2.0 – Getting an EJB in @FacesValidator and @FacesConverter
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method in a view Scoped Bean with the @PreDestroy annotation and
I have a method to construct a post request. That request may have x
I have a resource (Spring bean) which has some of its fields injected by
I have a system which is using Spring for dependency injection. I use annotation-based
I have a webmethod which is trying to construct xml data document and return
I have the following ApplicationScoped bean package es.caib.gesma.gesman.data; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.EJB;
I have this managed bean based on this tutorial . import java.io.Serializable; import javax.enterprise.context.SessionScoped;
I have a stateless session bean which is exposed as webservice. There are two
In summary, method with @PostConstruct is not call by JSF on WebLogic12c, on managed
Post-release, I have made one small change to one form in our development site

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.