2017-05-28 3 views
0

javaでタイマーを設定する際に問題があります。正確には - peripherial.warをデプロイしようとすると、次のエラーが表示されます。Wildfly TimerServiceに不満があります

{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"peripherial.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"peripherial.war\".WeldStartService: Failed to start service 
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TimerService with qualifiers @Default 
    at injection point [BackedAnnotatedParameter] Parameter 2 of [BackedAnnotatedConstructor] @Inject public io.github.tastypenguinbacon.peripherial.heartbeat.service.PassiveHeartbeatService(Cache, TimerService) 
    at io.github.tastypenguinbacon.peripherial.heartbeat.service.PassiveHeartbeatService.<init>(PassiveHeartbeatService.java:0) 
"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"peripherial.war\".WeldStartService"]} 

standalone.xmlファイルが正常であるようです。タイマーサービスの設定を担当部分(少なくとも私はそれがあることを期待していは)罰金も思える:

<timer-service thread-pool-name="default" default-data-store="default-file-store"> 
    <data-stores> 
    <file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/> 
    </data-stores> 
</timer-service> 

私はそれが何らかの形で関連性の場合は、コンストラクタベースの注入を使用して、@Inject経由のTimerServiceをインスタンス化しています。 私はwildfly-11.0.0.Alphaを使用しています。既定のstandalone.xmlファイルで変更されたのは、サーバーにアクセスできるIPアドレスだけです。

答えて

2

TimerServiceは、JEEアプリケーションサーバーリソースです。 CDIが自動的に利用することはできません@Injectedです。それを取得する方法(参照例えばJEE tutorial)は次のとおりです。

@Resource 
TimerService timerService; 

これはあなたの目的に合わせかもしれません。 CDI Beanとして公開したいのであれば、それは幸運にも些細なことです。 @ApplicationScopedが絶対に必要であれば

@ApplicationScoped 
public class TimerServiceProducer { 
    @Resource 
    @Produces 
    TimerService timerService; 
} 

私はわからないんだけど、それはどちらか傷つけることはありません:あなたはそのために別のクラスを持つことができます - ちょうどプロデューサーすぎ@Resourceフィールドします。

関連する問題