I'm 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'm getting a lot of errors reporting that some packages does not exist. For example, I cannot use the following code because I'm getting the message that package javax.enterprise.event 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 change the server to Glassfish 4.0 the same code runs as expected and all the packages are correctly imported.
I searched in the NetBeans and Glassfish forums but I did not found any situation like this one.
Thanks in advance for any sugestion that might help me solving this situation.