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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:46:36+00:00 2026-06-03T20:46:36+00:00

I am getting the null Converter error for what I thought was a very

  • 0

I am getting the null Converter error for what I thought was a very simple scenario:

<!-- My View -->
<ui:composition template="/template/template_v1.xhtml"
            xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html">
<!-- Simplified for clarity -->    
<h:form>
    <div class="block-panel customer-data">
        <h:outputLabel for="txtUsername">Username:</h:outputLabel>
        <h:inputText id="txtUsername" name="Username" 
                     value="#{userBean.user.id}"
                     styleClass="text" />
        <rich:message id="errorUsername" for="txtUsername"/>
    </div>
    <!--  Other fields omitted for clarity  -->
</h:form>

/* The User Bean - simplified */
@ManagedBean
@ViewScoped
public class UserBean implements Serializable {
    private User user;

    public User getUser() {
        // Contains logic for reading a user from the database or creating a new
        // user object
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

}

/* The user Entity - Simplified */
@Entity
@Table(name = "user")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "user_type", discriminatorType = DiscriminatorType.STRING)
public class User implements IEntity<String>, Serializable {
private static final long serialVersionUID = 1L;

    private String id;

    @Id
    @Column(name = "username", length = 50)
    @NotNull(message = "{userIdMandatory}")
    @Size(max = 50)
    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

}

/* The IEntity interface */
public interface IEntity<ID extends Serializable> {
    ID getId();
    void setId(final ID pId);
}

So essentially I’m trying to bind a string property of my user entity to a inputText field. As far as I’m concerned there should be no need for a conversion so I shouldn’t be getting the error I’m seeing.

Interestingly, if I add the following getter and setter to my entity:

public String getTmpId() {
    return this.id;
}

public void setTmpId(String id) {
    this.id = id;
}

And then make the necessary changes to my view to bind to tmpId rather than id, everything works as expected.

This seems like a bug to me either to do with the fact that I am binding to a getter/setter defined in an interface, defined in a generic interface or because the getter is marked with the Id attribute. I would appreciate someone else’s ideas however.

As an aside, I have inherited this design and don’t particularly like it so I may just end up refactoring it to introduce a new username property rather than trying to use the Id.

  • 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-03T20:46:37+00:00Added an answer on June 3, 2026 at 8:46 pm

    To the best of my knowledge I believe this is caused by an obscure bug in BeanELResolver which is used to get the type of the property being bound to – rather than returning String it is returning Serializable, for which there is no converter and hence the error I am seeing.

    It’s not particularly elegant, but I have worked around this by adding a userId property to my userBean and then binding to that in my view instead of the Id property on the user entity. I then use that value to set the Id manually on the entity when I save it:

    <!-- My New View -->
    <ui:composition template="/template/template_v1.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:h="http://java.sun.com/jsf/html">
    <!-- Simplified for clarity -->    
    <h:form>
        <div class="block-panel customer-data">
            <h:outputLabel for="txtUsername">Username:</h:outputLabel>
            <h:inputText id="txtUsername" name="Username" 
                         value="#{userBean.userId}"
                         styleClass="text" />
            <rich:message id="errorUsername" for="txtUsername"/>
        </div>
        <!--  Other fields omitted for clarity  -->
    

    /* The New User Bean - simplified */
    @ManagedBean
    @ViewScoped
    public class UserBean implements Serializable {
        private string userId;
        private User user;
    
        public String getUserId() {
            return userId;
        }
    
        public void setUserId(String userId) {
            this.userId = userId;
        }
    
        public User getUser() {
            // Contains logic for reading a user from the database or creating a new
            // user object
            return user;
        }
    
        public void setUser(User user) {
            this.user = user;
        }
    
        public void saveUser() {
            if (user.getId() == null) {
                user.setId(userId);
            }
            // Actual saving omitted for brevity
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting null-exception throw error in the following code. What can be the
I am getting the following error: InnerException: {Cannot insert the value NULL into column
I'm getting an error with what should be a simple query to insert data.
I keep getting this error because the VendorID is null for that record. I've
IN JAVA CODE IN JSP as below i m getting null value for fieldnoOfRecords.
Hi i am reading inbox using service but i m getting null pointer exception
I keep getting a null exception at the ; below. The ApiUsername & ApiPassword
I'm getting a Null pointer access: The variable 'numbers' can only be null at
I'm getting a null pointer on line 15...below (Session session = HibernateUtil.getSessionFactory.getCurrentSession();) public static
I am getting a null pointer exception report in the android developer console. I

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.