【问题标题】:WELD-001408 Unsatisfied dependencies inject pointWELD-001408 不满足的依赖注入点
【发布时间】:2013-06-03 13:00:39
【问题描述】:

我在 Eclipse 中有一个有效的动态 Web 项目 (JAX-RS),它从数据库中获取记录并以 json 格式返回数据。

现在,我正在尝试将这个项目一分为二。

1. CompDB  //Project stores database handlers classes

src
  database
    ComponentContext.java
    ComponentViewable.java //Interface
  database.uat
    ComponentUATView.java  //Implements ComponentViewable
  META-INF
    persistance.xml
WebContent
    WEB-INF
      beans.xml
       web.xml

创建一个jar文件并复制到项目2的WEB-INF/lib中

2. CompRS //Project stores JAX-RS client classes
src
  compreport
    ComponentData.java
  META-INF
    persistance.xml
WebContent
    WEB-INF
             lib
                CompDB.jar
     beans.xml
             web.xml

当我在 glssfish 3.1 上运行 CompRS 时,出现以下错误

INFO: WEB0671: Loading application [CompRS] at [/CompRS] SEVERE: Exception while loading the app

INFO: file:/C:/Program Files/glassfish-3.1.2.2/glassfish/domains/domain1/eclipseApps/CompRS/WEB-       INF/lib/CompDB.jar_ci logout successful

SEVERE: Exception while loading the app : WELD-001408 Unsatisfied dependencies for type 
[ComponentViewable] with qualifiers [@ComponentContext] at injection point [[field] @Inject @ComponentContext compreport.ComponentData.componentdata]

这里是代码

组件数据.java

@Path("component")
@RequestScoped
public class ComponentData {
@Inject @ComponentContext ComponentViewable  componentdata;
@GET
@Path("latest")
@Produces("application/json")
    ....
}

ComponentContext.java

@Target({TYPE,METHOD,PARAMETER,FIELD})
@Retention(RUNTIME) @Documented @Qualifier
public @interface ComponentContext{}

我是创建多个 jar 并将它们集成的新手。如果这不是正确的方法,请指导我实现同样的方法。

【问题讨论】:

    标签: ejb jax-rs cdi


    【解决方案1】:

    看起来 CompDB 现在是您从其他 Web 应用程序引用的 jar。 jar 中的 beans.xml 文件必须在 META-INF 中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-20
      • 1970-01-01
      • 1970-01-01
      • 2014-04-07
      • 1970-01-01
      • 2020-03-26
      相关资源
      最近更新 更多