I am trying to make a standalone Java SE application with CDI. I followed<a href="https://randling.wordpress.com/2011/08/15/cdi-in-java-se/" rel="nofollow"> this</a> article and I am using Weld. However when I try to instantiate
I am getting the following ClassNotFound error.
I checked the weld-se JAR an it doesn't contain this Interface. What is the issue here? Thanks in advance.
Following is my Test class org.agorava.socializer.Test
Code:
Weld weld = new Weld();
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/weld/environment/ContainerInstanceFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.agorava.socializer.Test.main(Test.java:59)
Caused by: java.lang.ClassNotFoundException: org.jboss.weld.environment.ContainerInstanceFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
I checked the weld-se JAR an it doesn't contain this Interface. What is the issue here? Thanks in advance.
Following is my Test class org.agorava.socializer.Test
Code:
public class Test {
public static void main(String[] args){
Weld w = new Weld();
WeldContainer factory = w.initialize();
OAuthLifeCycleService service = factory.instance().select(OAuthLifeCycleService.class).get();
System.out.println(service.getCurrentService());
}
}