I am learning JavaEE CDI and I created a small application with NetBeans 8.0 + Glassfish 4. After upgrading to NetBeans 8.0.1 and Glassfish 4.1, I got a lot of errors reporting that some packages do not exist. For example, I canβt use the following code because I get a message that the javax.enterprise.event package does not exist.
package jlacerda; import javax.inject.Inject; import javax.enterprise.event.Event; public class CMensagem { @Inject private Event<Evento> gerarEvento; public String getMensagem() { return "Hello world!"; } public void gerarEvento() { Evento evento = new Evento(); evento.setMensagem("Objeto criado a partir da classe CMensagem"); gerarEvento.fire(evento); } }
This situation also occurs with packages:
import javax.enterprise.inject.Alternative; import javax.decorator.Decorator; import javax.decorator.Delegate; import javax.enterprise.inject.Disposes; import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.InjectionPoint;
If I changed the server to Glassfish 4.0, the same code will work as expected, and all packages will be correctly imported.
I searched the NetBeans and Glassfish forums, but I did not find a situation like this.
Thanks in advance for any question that may help me in solving this situation.
java java-ee netbeans cdi glassfish
javlacerda
source share