Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Netbeans:奇怪的行为_Java_Cdi_Jboss Weld_Netbeans 7 - Fatal编程技术网

Java Netbeans:奇怪的行为

Java Netbeans:奇怪的行为,java,cdi,jboss-weld,netbeans-7,Java,Cdi,Jboss Weld,Netbeans 7,在正式发布之后,我实现了一个非常简单的JavaSE Weld快速启动类 @Singleton public class TesteCDI { public void printHello(@Observes ContainerInitialized event, @Parameters List<String> parameters) { System.out.println("Hello Weld!" + parameters);

在正式发布之后,我实现了一个非常简单的JavaSE Weld快速启动类

@Singleton
public class TesteCDI {

    public void printHello(@Observes ContainerInitialized event, 
         @Parameters List<String> parameters) {
       System.out.println("Hello Weld!" + parameters);
   }
} 
如果我创建了Jar文件,那么无论是从命令行还是从Netbeans,一切都可以正常运行。所以我假设Netbeans是从jar运行应用程序的

问题是它不是

如果我更新测试类并从Netbeans运行,它会选择更改。如果我从命令行运行jar,它只打印旧消息

如果清理项目,Netbeans启动配置将停止打印消息


有人能解释一下Netbeans是如何运行我的应用程序的吗?这种奇怪的行为有意义吗,还是应该被认为是一个bug?

我认为如果您忘记了META-INF/beans.xml,weld不会拾取带注释的组件,您是否检查了类路径中是否有META-INF/beans.xml?

嗯,它在我的src/META-INF文件夹中。。。但可能(只是可能),Netbeans在运行时不会将其包含在运行的类路径中。
54 [main] INFO org.jboss.weld.Version - WELD-000900 1.1.0 (Final)
110 [main] INFO org.jboss.weld.Bootstrap - WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
388 [main] WARN org.jboss.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
388 [main] WARN org.jboss.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled