私は、基本的にthis oneに従う非常に単純な例で、weld-se を機能させようとしています。しかし、私はそれを機能させることができません。
ビルドにはgradleを使用しています。これが私のbuild.gradleです:
apply plugin: 'java'
version='1.0-SNAPSHOT'
repositories {
mavenCentral()
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
jar {
dependsOn configurations.runtime
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
}
task hello( type: JavaExec) {
main = 'org.jboss.weld.environment.se.StartMain'
classpath = sourceSets.main.runtimeClasspath
}
dependencies {
compile 'org.jboss.weld.se:weld-se:2.0.4.Final'
}
これらのファイルは src フォルダーにあります。
./src/main/java/weldse/HelloWorld.java
./src/main/resources/META-INF/beans.xml
内容は以下の通りです。
HelloWorld.java
package weldse;
import org.jboss.weld.environment.se.events.ContainerInitialized;
import javax.enterprise.event.Observes;
public class HelloWorld {
public void printHello( @Observes ContainerInitialized event) {
System.out.println("Hello, World");
}
}
ビーンズ.xml
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="all">
</beans>
を実行するgradle hello
と、出力は得られませんがHello, World
、BUILD SUCCESSFUL
次のメッセージが表示されます。
[main] INFO org.jboss.weld.Version - WELD-000900 2.0.4 (Final)
[main] INFO org.jboss.weld.Bootstrap - WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
[main] WARN org.jboss.weld.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
[main] WARN org.jboss.weld.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
ただし、で直接実行するとjava
、例外が発生します。ここに完全なスタックトレースがあります。
$ java -cp build/libs/weld-se-1.0-SNAPSHOT.jar org.jboss.weld.environment.se.StartMain
[main] INFO org.jboss.weld.Version - WELD-000900 SNAPSHOT
[main] INFO org.jboss.weld.Bootstrap - WELD-000101 Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
[weld-worker-5] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.bean.builtin.ee.HttpSessionBean because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-3] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.bean.builtin.ee.HttpServletRequestBean because of underlying class loading error: Type javax.servlet.http.HttpServletRequest not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-2] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.bean.builtin.ee.ServletContextBean because of underlying class loading error: Type javax.servlet.ServletContext not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-4] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.bean.builtin.ee.UserTransactionBean$UserTransactionCallable because of underlying class loading error: Type javax.transaction.UserTransaction not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-6] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.beanstore.http.RequestBeanStore because of underlying class loading error: Type javax.servlet.http.HttpServletRequest not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.beanstore.http.LazySessionBeanStore because of underlying class loading error: Type javax.servlet.http.HttpServletRequest not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-8] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.beanstore.http.EagerSessionBeanStore because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-7] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.beanstore.http.AbstractSessionBeanStore because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-3] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.beanstore.http.LazyCyclicSessionBeanStore because of underlying class loading error: Type javax.servlet.http.HttpServletRequest not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-5] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.http.HttpConversationContext because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-8] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.http.HttpSessionContext because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-4] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.http.HttpRequestContextImpl because of underlying class loading error: Type javax.servlet.http.HttpServletRequest not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-3] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.http.HttpConversationContextImpl because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-5] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.http.HttpSessionDestructionContext because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.context.http.HttpSessionContextImpl because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-8] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.event.TransactionalObserverNotifier because of underlying class loading error: Type javax.transaction.Synchronization not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.event.TransactionSynchronizedRunnable because of underlying class loading error: Type javax.transaction.Synchronization not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.injection.spi.JpaInjectionServices because of underlying class loading error: Type javax.persistence.EntityManager not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.injection.spi.helpers.ForwardingJpaInjectionServices because of underlying class loading error: Type javax.persistence.EntityManager not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-3] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.SessionHolder because of underlying class loading error: Type javax.servlet.http.HttpSession not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-8] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.ConversationFilter because of underlying class loading error: Type javax.servlet.Filter not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-3] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.WeldCrossContextFilter because of underlying class loading error: Type javax.servlet.Filter not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-2] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.ConversationContextActivator because of underlying class loading error: Type javax.servlet.http.HttpServletRequest not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-1] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.WeldTerminalListener because of underlying class loading error: Type javax.servlet.http.HttpSessionListener not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-6] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.WeldListener because of underlying class loading error: Type javax.servlet.ServletContextListener not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-2] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.api.helpers.ForwardingServletListener because of underlying class loading error: Type javax.servlet.ServletContextListener not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-8] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.WeldInitialListener because of underlying class loading error: Type javax.servlet.ServletContextListener not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-4] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.transaction.spi.TransactionServices because of underlying class loading error: Type javax.transaction.Synchronization not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-3] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.api.helpers.AbstractServletListener because of underlying class loading error: Type javax.servlet.ServletContextListener not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-5] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.api.ServletListener because of underlying class loading error: Type javax.servlet.ServletContextListener not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-7] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.servlet.HttpContextLifecycle because of underlying class loading error: Type javax.servlet.http.HttpServletRequest not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-4] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.jboss.weld.validation.spi.ValidationServices because of underlying class loading error: Type javax.validation.ValidatorFactory not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-8] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.slf4j.ext.MDCStrLookup because of underlying class loading error: Type org.apache.commons.lang.text.StrLookup not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-6] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.slf4j.instrumentation.JavassistHelper because of underlying class loading error: Type javassist.CtBehavior not found. If this is unexpected, enable DEBUG logging to see the full error.
[weld-worker-7] INFO org.jboss.weld.ClassLoading - WELD-000119 Not generating any bean definitions from org.slf4j.instrumentation.LogTransformer because of underlying class loading error: Type javassist.CtBehavior not found. If this is unexpected, enable DEBUG logging to see the full error.
[main] WARN org.jboss.weld.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
[main] WARN org.jboss.weld.interceptor.util.InterceptionTypeRegistry - Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: Exception List with 4 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type InstanceManager with qualifiers @Default
at injection point [UnbackedAnnotatedParameter] Parameter 1 of [UnbackedAnnotatedConstructor] @Inject protected org.jboss.weld.environment.se.WeldContainer(InstanceManager, BeanManager)
at org.jboss.weld.environment.se.WeldContainer.<init>(WeldContainer.java:0)
Possible dependencies:
- Managed Bean [class org.jboss.weld.environment.se.beans.InstanceManager] with qualifiers [@Any @Default],
- Managed Bean [class org.jboss.weld.environment.se.beans.InstanceManager] with qualifiers [@Any @Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:412)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:327)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:178)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:209)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:530)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:71)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:69)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type InstanceManager with qualifiers @Default
at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject protected org.jboss.weld.environment.se.WeldContainer(InstanceManager, BeanManager)
at org.jboss.weld.environment.se.WeldContainer.<init>(WeldContainer.java:0)
Possible dependencies:
- Managed Bean [class org.jboss.weld.environment.se.beans.InstanceManager] with qualifiers [@Any @Default],
- Managed Bean [class org.jboss.weld.environment.se.beans.InstanceManager] with qualifiers [@Any @Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:412)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:327)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:178)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:209)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:530)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:71)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:69)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type Instance<Object> with qualifiers @Any
at injection point [UnbackedAnnotatedField] @Inject @Any org.jboss.weld.environment.se.beans.InstanceManager.instances
at org.jboss.weld.environment.se.beans.InstanceManager.instances(InstanceManager.java:0)
Possible dependencies:
- Managed Bean [class org.jboss.weld.Weld] with qualifiers [@Any @Default],
- Implicit Bean [javax.enterprise.inject.Instance] with qualifiers [@Default],
- Managed Bean [class org.jboss.weld.servlet.StaticWeldProvider$EnhancedWeld] with qualifiers [@Any @Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:412)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:327)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:178)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:209)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:530)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:71)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:69)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type Instance<Object> with qualifiers @Any
at injection point [BackedAnnotatedField] @Inject @Any org.jboss.weld.environment.se.beans.InstanceManager.instances
at org.jboss.weld.environment.se.beans.InstanceManager.instances(InstanceManager.java:0)
Possible dependencies:
- Managed Bean [class org.jboss.weld.Weld] with qualifiers [@Any @Default],
- Implicit Bean [javax.enterprise.inject.Instance] with qualifiers [@Default],
- Managed Bean [class org.jboss.weld.servlet.StaticWeldProvider$EnhancedWeld] with qualifiers [@Any @Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:412)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:327)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:178)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:209)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:530)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:71)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:69)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
at org.jboss.weld.bootstrap.ConcurrentValidator.validateBeans(ConcurrentValidator.java:79)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:491)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:538)
at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.validateBeans(ForwardingBootstrap.java:75)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:144)
at org.jboss.weld.environment.se.StartMain.go(StartMain.java:41)
at org.jboss.weld.environment.se.StartMain.main(StartMain.java:52)
InstanceManager
それが例外を引き起こしているというあいまいさがあるように私には思えます。しかし、よくわかりません。とにかく、これを機能させる方法を知っていますか?どうもありがとうございました。