【问题标题】:WebLogic 12.1.3 error WELD-001408 Unsatisfied dependenciesWebLogic 12.1.3 错误 WELD-001408 不满足的依赖关系
【发布时间】: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.

【问题讨论】:

标签: eclipse jakarta-ee weblogic cdi weblogic12c


【解决方案1】:

问题已解决。

我在 Oracle 支持站点中创建了一个 SR。 Oracle 构建了一个内部补丁。

埃弗伦。

【讨论】:

    【解决方案2】:

    经过三天的搜索,我们发现该项目只有通过weblogic控制台部署才能工作,如果我们通过eclipse中的oracle插件部署则无法工作。

    因此,如果您使用的是 eclipse,请在“服务器”视图中,右键单击 weblogic 服务器,单击“属性 -> Weblogic -> 发布”,将单选“发布为虚拟应用程序”更改为“发布为展开归档” "

    【讨论】:

    • 谢谢!你救了我的命:)
    【解决方案3】:

    您可以将@Inject 注释替换为@Produces 作为解决方法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-10
      相关资源
      最近更新 更多