本文介绍了WELD-001409:带有限定符@Default的StepContext类型的依存关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Windows命令以Java SE模式运行示例提示。我已经构建了一个包含所有依赖项的jar并从命令提示符处运行它。

I am trying to run this example in java SE mode from my windows command prompt. I have built a jar with all dependencies included in it and running it from my command prompt.

但是,请继续获取错误。从,我了解到我的运行时类路径中可能有多个StepContext类。

but, keep getting this error. From this answer, i understand that there could be multiple StepContext classes in my runtime classpath.

我现在用maven-shade插件替换了maven-assembly插件来构建我的胖罐子,在包装罐子时可以看到以下警告

i now replaced the maven-assembly plugin with the maven-shade plugin to build my fat jar and i can see the following warning while packaging the jar

[WARNING] javax.inject-1.jar, weld-se-2.2.15.Final.jar define 6 overlapping classes:
[WARNING] - javax.inject.Inject
[WARNING] - javax.inject.Singleton
[WARNING] - javax.inject.Scope
[WARNING] - javax.inject.Named
[WARNING] - javax.inject.Provider
[WARNING] - javax.inject.Qualifier

我将以下依赖项更新为提供的内容,现在在打包时看不到上述警告,但是在运行新生成的jar时仍然会出现异常

I updated the following dependency to provided and now i don't see the above said warning while packaging but, am still getting exceptions when running the newly generated jar

<dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>

执行JAR文件时的当前异常

Current exception while executing the JAR file

Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type InjectionPoint with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedMethod] @Produces @BatchProperty public org.jberet.creation.BatchBeanProducer.getStringList(InjectionPoint)
  at org.jberet.creation.BatchBeanProducer.getStringList(BatchBeanProducer.java:0)
  Possible dependencies:
  - Implicit Bean [javax.enterprise.inject.spi.InjectionPoint] with qualifiers [@Default],
  - Managed Bean [class org.jboss.weld.manager.BeanManagerImpl$InstanceInjectionPoint] with qualifiers [@Any @Default],
  - Managed Bean [class org.jboss.weld.injection.EmptyInjectionPoint] with qualifiers [@Any @Default]

        at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:392)
        at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:294)
        at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135)
        at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:168)
        at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:543)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
        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.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type InjectionPoint with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedMethod] @Produces @BatchProperty public org.jberet.creation.BatchBeanProducer.getStringBuilder(InjectionPoint)
  at org.jberet.creation.BatchBeanProducer.getStringBuilder(BatchBeanProducer.java:0)
  Possible dependencies:
  - Implicit Bean [javax.enterprise.inject.spi.InjectionPoint] with qualifiers [@Default],
  - Managed Bean [class org.jboss.weld.manager.BeanManagerImpl$InstanceInjectionPoint] with qualifiers [@Any @Default],
  - Managed Bean [class org.jboss.weld.injection.EmptyInjectionPoint] with qualifiers [@Any @Default]

        at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:392)
        at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:294)
        at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135)
        at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:168)
        at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:543)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
        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.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

        at org.jboss.weld.bootstrap.ConcurrentValidator.validateBeans(ConcurrentValidator.java:76)
        at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:504)
        at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:435)
        at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
        at org.jboss.weld.environment.se.Weld.initialize(Weld.java:148)
        at org.jberet.se.SEArtifactFactory.<init>(SEArtifactFactory.java:29)
        at org.jberet.se.BatchSEEnvironment.getArtifactFactory(BatchSEEnvironment.java:133)
        at org.jberet.operations.JobOperatorImpl.<init>(JobOperatorImpl.java:93)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        ... 8 more

我该如何解决此问题?

How can i resolve this problem ?

推荐答案

最终能够使用JBERET实现以Java SE模式运行Java批处理程序的可执行JAR。

Finally was able to run a executable (fat) JAR of a Java batch program in Java SE mode using JBERET implementation.

提到了这一点,一旦我切换到2.4.5。最终它就可以正常工作。

This link mentioned that and once i switched to 2.4.5.Final it worked fine.

这篇关于WELD-001409:带有限定符@Default的StepContext类型的依存关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 09:09