javax.enterprise.context.RequestScoped不存在

时间:2015-03-09 14:32:07

标签: java netbeans cdi java-ee-7 glassfish-4.1

Dev env:Netbeans 8.0.2,JAVA EE 7,GlassFish 4.1 创建一个简单的java类bean

    package com.introjsf;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

/**
 *
 * @author xiarnousx
 */
@Named
@RequestScoped
public class CustomerCDI {

    private String firstName;
    private String lastName;

    @Inject
    private AddressCDI address;

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

}

输出

Caused by: java.lang.RuntimeException: Uncompilable source code - javax.enterprise.context.RequestScoped is not an annotation type
    at com.introjsf.CustomerCDI.<clinit>(CustomerCDI.java:17)

我做了stackoverflow回答的建议the package javax.enterprise.context is missing after glassfish update  但没有运气!任何建议都将非常感谢,谢谢

0 个答案:

没有答案