0

According to the tutorial found here: https://docs.oracle.com/javaee/7/tutorial/jsf-configure001.htm#GIRCR , a class annotated with @Named and a scope annotation is automatically registered as a CDI bean by the JSF application. However, whenever the bean is invoked on a particular request in my application, I get this error:

Target Unreachable, identifier 'query' resolved to null] with root cause javax.el.PropertyNotFoundException: Target Unreachable, identifier 'query' resolved to null

This is the class that I have:

package beans;

import javax.faces.bean.SessionScoped;
import javax.inject.Named;

@Named
@SessionScoped
public class Query {

    private String name;

    public Query() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}

What could I be doing wrong? Here are the maven dependencies I'm using:

<dependencies>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.2.13</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.2.10</version>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
</dependencies>

When I replace the @Named annotation with @ManagedBean, everything works and the bean is registered fine. But with the Java EE 7 specification, I should be able to use the @Named annotation right?

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
Kingamere
  • 7,180
  • 18
  • 55
  • 91

0 Answers0