[英]WELD-001408 Unsatisfied dependencies for type [DataSource] with qualifiers
[英]WebLogic 12.1.3 error WELD-001408 Unsatisfied dependencies
部署具有簡單CDI注入的Web應用程序時,WebLogic 12.1.3失敗。 引發以下異常:
weblogic.application.ModuleException: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Interface2] with qualifiers [@Default] at injection point [[field] @Inject public pruebas1.Clase1.clase2]
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
Truncated. see log file for complete stacktrace
Caused By: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Interface2] with qualifiers [@Default] at injection point [[field] @Inject public pruebas1.Clase1.clase2]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:315)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:284)
at org.jboss.weld.bootstrap.Validator.validateInjectionTarget(Validator.java:342)
at org.jboss.weld.manager.InjectionTargetValidator.addInjectionTarget(InjectionTargetValidator.java:29)
at org.jboss.weld.manager.BeanManagerImpl.createInjectionTarget(BeanManagerImpl.java:943)
Truncated. see log file for complete stacktrace
>
當我在OEPE 12.1.3.2中的WebLogic 12.1.3(針對開發人員的郵政編碼分發和安裝程序)中部署戰爭時,出現了所描述的錯誤。 但是,在同一OEPE 12.1.3.2中的WebLogic 12.1.1(用於開發人員的郵政編碼分發和安裝程序)沒有問題。 如果我導出戰爭文件並在沒有OEPE集成的情況下通過Web控制台進行部署,也沒有問題。 另外,當我在WebLogic 12.1.3中部署戰爭時。 獨立(“完整”發行)沒有問題。
我也遇到過MANIFEST.MF文件(位於wlserver / server / lib / api.jar內)引用了wlserver / modules文件夾中不存在的“ javax.inject_1.jar”。 而是有文件“ javax.inject-1.jar”。 為了使我的項目正常工作(導入類javax.inject.Inject類),我從同一文件夾中的javax.inject-1.jar文件復制了一個名為javax.inject_1.jar的文件。
war java的源代碼結構是:
src
pruebas1
Clase1.java
pruebas2
Clase2.java
Interface2.java
戰爭的WebContent結構為:
WebContent
WEB-INF
beans.xml
weblogix.xml
類和接口:
@WebService
public class Clase1 {
@Inject
public Interface2 clase2;
@WebMethod
public String aMayusculas(@WebParam(name = "palabra") String palabra) {
long tm = System.currentTimeMillis();
System.out.println(tm + " - clase2: " + (clase2 == null ? "null" : clase2.toString()));
return palabra == null ? "null" : tm + " - " + palabra.toUpperCase();
}
}
public interface Interface2 {
void doIt(String a);
}
public class Clase2 implements Interface2 {
@Override
public void doIt(String a) {
System.out.println(a);
}
}
XML文件:beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
weblogic.xml中
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:weblogic-version>12.1.3</wls:weblogic-version>
<wls:context-root>prueba05weblogic</wls:context-root>
</wls:weblogic-web-app>
提前致謝。
埃夫倫五世
經過三天的搜索,我們發現該項目僅在通過weblogic控制台進行部署時才有效,如果通過eclipse中的oracle插件進行部署,則該項目將無法正常工作。
因此,如果您使用的是eclipse,請在“服務器”視圖中,右鍵單擊weblogic服務器,單擊“屬性-> Weblogic->發布”,將單選“作為虛擬應用程序發布”更改為“作為分解后的存檔發布”
問題已解決。
我在Oracle支持站點中創建了一個SR。 Oracle構建了一個內部補丁。
埃弗倫。
您可以將@Inject注釋替換為@Produces作為解決方法
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.