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 8886621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:36:10+00:00 2026-06-14T21:36:10+00:00

I have a web project that has FacesValidator, this validator needs to access an

  • 0

I have a web project that has FacesValidator, this validator needs to access an EJB service to verify if a record exists. Unfortunately, I cannot inject my enterprise beans since the validator is not a managed-bean, so I’m trying to access it via InitialContext. I’ve tried different combination from http://docs.oracle.com/javaee/6/tutorial/doc/gipjf.html but failed.

What works is this format:

java:global/myProject-ear-1.0.0/myProject/MyService!com.czetsuya.myProject.service.membership.MyService,

My question is can it be simplify? Seems too long.

Thanks,

czetsuya

  • 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-14T21:36:11+00:00Added an answer on June 14, 2026 at 9:36 pm

    Look at the server logs. A bit decent EJB container (at least, Glassfish 3 and JBoss 6/7 do), logs all available JNDI names of the EJB during EJB deployment step. Provided that the validator is properly been put in the WAR and the EJB has a @Local interface, then the shortest JNDI name would be the java:app one which should in your case have been java:app/myProject/MyService.

    A completely different alternative is to just make the validator a JSF or CDI managed bean instead, so that you can just use the @EJB annotation.

    @ManagedBean // Or @Named.
    @ApplicationScoped // Provided that the instance doesn't have any state.
    public class MyValidator implements Validator {
    
        @EJB
        private MyService myService;
    
        // ...
    }
    

    and reference it by binding instead of validatorId:

    <f:validator binding="#{myValidator}" />
    

    Note that from JSF 2.2 on, you should be able to inject @EJB in a @FacesValidator (and @FacesConverter).

    See also:

    • How to inject in @FacesValidator with @EJB, @PersistenceContext, @Inject, @Autowired
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service project that needs to be set to use Integrated
I have a project that has a web service reference. I also have an
I have a project that has a service reference to a web service. Is
I have a web service project that has 2 asmx files. Let’s call them
I have an ASP.NET (.asmx) Web Service project that has a method like: public
I have a .net project that has a web reference to a service. I
I have a .Net 4 project that has to consume a SOAP Web Service.
We have a updatable web site project that is written in c#, it has
I have a VB Web Site project that has recently (and mysteriously) stopped importing
I have a web project that has a \META-INF\services\javax.servlet.ServletContainerInitializer file with its content pointing

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.