在從Jboss AS5遷移到Wildfly9的應用程序中,我試圖在wildfly中加載一個模塊:javax.transaction.api 查看Wildfly article以在WF8中加載模塊,它表示您可能不需要顯式加載某些模塊,因爲它們是隱式加載的。Wildfly:使用Spring @Autowired進行UserTransaction
我用我的一個類
@Autowired
private UserTransaction transaction;
然後我在applictionContext.xml
在我的JBoss部署,structure.xml定義它<jee:jndi-lookup id="userTransaction" jndi-name="UserTransaction" expected-type="javax.transaction.UserTransaction"/>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
但我得到這個錯誤:
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field:
private javax.transaction.UserTransaction com.mycomp.myapp.EventSender.transaction; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [javax.transaction.UserTransaction] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
我試圖將jta.jar添加到戰爭的lib中,我試圖添加jta的依賴關係。我試圖添加javax.transaction只是爲了以防萬一,他們都沒有工作。我沒有得到ClassNotfoundexception
或ClassCastexception
。一切似乎都非常簡單。我無法理解這裏缺少的東西。
"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./myApp" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./myApp: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myAppManager' defined in \"/C:/JAVA/WF9/wildfly-9.0.0.Final/bin/content/myApp-engine-2.0.2-SNAPSHOT.war/WEB-INF/classes/com/mycomp/myApp/myAppManager.class\": Unsatisfied dependency expressed through constructor argument with index 2 of type [com.mycomp.myApp.EventSender]: : Error creating bean with name 'EventSender': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EventSender': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Caused by: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myAppManager' defined in \"/C:/JAVA/WF9/wildfly-9.0.0.Final/bin/content/myApp-engine-2.0.2-SNAPSHOT.war/WEB-INF/classes/com/mycomp/myApp/myAppManager.class\": Unsatisfied dependency expressed through constructor argument with index 2 of type [com.mycomp.myApp.EventSender]: : Error creating bean with name 'EventSender': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EventSender': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myAppManager' defined in \"/C:/JAVA/WF9/wildfly-9.0.0.Final/bin/content/myApp-engine-2.0.2-SNAPSHOT.war/WEB-INF/classes/com/mycomp/myApp/myAppManager.class\": Unsatisfied dependency expressed through constructor argument with index 2 of type [com.mycomp.myApp.EventSender]: : Error creating bean with name 'EventSender': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EventSender': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EventSender': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction Caused by: javax.naming.NameNotFoundException: UserTransaction -- service jboss.naming.context.java.UserTransaction"}}, "rolled-back" => true
感謝您的幫助。
檢查[JBoss Windup遷移工具](https://github.com/windup/windup/wiki)。 –