Press enter to see results or esc to cancel.


Unable to create managed bean x. The following problems were found: – Property x for managed bean message does not exist. Check that appropriate getter and/or setter methods exist.

Error Message.

Unable to create managed bean message. The following problems were found: - Property helloWorld for managed bean message does not exist. Check that appropriate getter and/or setter methods exist.
  1. This message comes in JSF when you are Injecting JSF bean to another Bean using @ManagedProperty.
  2. Taking below Example of Injecting HelloWorld.java to Message.java
    HelloWorld.java

    package com.chillyfacts.com;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    @ManagedBean(name = "hello")
    @SessionScoped
    public class HelloWorld {
        private String name;
        public HelloWorld() {
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }
    
    
  3. There will be error if you just Write like this.
    Message.java

    package com.chillyfacts.com;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ManagedProperty;
    import javax.faces.bean.RequestScoped;
    @ManagedBean
    @RequestScoped
    public class Message {
        @ManagedProperty(value = "#{hello}")
        private HelloWorld helloWorld;
    
        // Any other Code   
        public Message() {
        }
    }
    
  4. Solution.
    Update the Message.java with Getters and Setters of the bean.
    Message.java

    package com.chillyfacts.com;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.ManagedProperty;
    import javax.faces.bean.RequestScoped;
    @ManagedBean
    @RequestScoped
    public class Message {
        @ManagedProperty(value = "#{hello}")
        private HelloWorld helloWorld;
        public void setHelloWorld(HelloWorld helloWorld) {
            this.helloWorld = helloWorld;
        }
        public HelloWorld getHelloWorld() {
            return helloWorld;
        }
        
        // Any other Code   
    
        public Message() {
        }
        
    }
    

    Error should have gone now.


Comments

Leave a Comment