我有一个类,它仅在其他依赖项可用时才可选地使用,动态加载。
但是 CDI (Weld) 扫描它并报告一个丑陋的错误,见下文。
我怎样才能摆脱它,理想情况下使用一些注释?
Registered contexts: [interface javax.enterprise.context.RequestScoped, interface javax.enterprise.context.ApplicationScoped, interface javax.enterprise.context.ConversationScoped, interface javax.enterprise.context.Dependent, interface javax.enterprise.context.SessionScoped, interface javax.inject.Singleton]
Registered beans: 0
: [<class>org.jboss.weld.environment.se.jpa.JpaTransactionInterceptor</class> in jar:file:/home/ondra/.m2/repository/org/jboss/jawabot/JawaBot-core/2.0.0.GA-SNAPSHOT/JawaBot-core-2.0.0.GA-SNAPSHOT.jar!/META-INF/beans.xml@11]
10:45:12.713 INFO [main] org.jboss.weld.ClassLoading WELD-000119 Not generating any bean definitions from org.jboss.jawabot.plugin.jira.tools.ProjectsListDownloader because of underlying class loading error
10:45:12.714 INFO [main] org.jboss.weld.ClassLoading catching
org.jboss.weld.resources.spi.ResourceLoadingException: java.lang.NoClassDefFoundError: org/codehaus/jettison/json/JSONException
at org.jboss.weld.environment.se.discovery.url.WeldSEResourceLoader.classForName(WeldSEResourceLoader.java:61)
at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:107)
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:77)
at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:135)
at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349)
at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans(ForwardingBootstrap.java:70)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:133)
at org.jboss.jawabot.JawaBotApp.main(JawaBotApp.java:74)
Caused by: java.lang.NoClassDefFoundError: org/codehaus/jettison/json/JSONException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.getDeclaredMethods(Class.java:1810)
at org.jboss.weld.environment.se.discovery.url.WeldSEResourceLoader.classForName(WeldSEResourceLoader.java:54)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.jettison.json.JSONException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 12 more
10:45:12.931 WARN [main] org.jboss.weld.interceptor.util.InterceptionTypeRegistry Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
10:45:12.931 WARN [main] org.jboss.weld.interceptor.util.InterceptionTypeRegistry Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
10:45:12.955 DEBUG [main] org.jboss.weld.Bootstrap WELD-000108 Decorator: Decorator [class org.jboss.weld.environment.se.threading.RunnableDecorator] decorates [Runnable] with delegate type [Runnable] and delegate qualifiers [@Default]
10:45:12.956 DEBUG [main] org.jboss.weld.Bootstrap WELD-000107 Interceptor: Interceptor [class org.jboss.weld.environment.se.jpa.JpaTransactionInterceptor intercepts @JpaTransactional]