【发布时间】:2014-11-07 15:43:36
【问题描述】:
使用简单 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(开发人员的 Zip 分发和安装程序)中部署战争时,我得到了描述的错误。但是,在同一个 OEPE 12.1.3.2 中使用 WebLogic 12.1.1(开发人员的 Zip 分发和安装程序)没有问题。如果我导出你的战争文件并在没有 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 文件: bean.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>
提前致谢。
Efren V.
【问题讨论】:
-
这或多或少是一个骗子:stackoverflow.com/questions/15162522/… 这还提到它已在 12.1.1 的补丁中修复 biemond.blogspot.com/2012_01_01_archive.html 也许它在 12.1.3 中再次损坏
标签: eclipse jakarta-ee weblogic cdi weblogic12c