4

i want to deploy an jax-rs 2.0 (jersey 2.0) webservice to my glassfish 4, but i get an weld CDI exception. I have no beans.xml in my project.

SEVERE: Undeployment failed for context /restExample
SEVERE: Exception while loading the app : CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]
    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:325)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:177)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:208)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:519)
    at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:505)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:480)
    at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)

My pom.xml

<dependencies>
    <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>2.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.0</version>
    </dependency>
</dependencies>

If i set the dependencies to scope provided, i get no exception but than i have no massageBodyWriter etc. in my project/webservice and get then an exception.

I try to exclude the guava

Any ideas?

EDIT: On my notebook i dont get that exception and found the reason: If i use JDK 7_21 i dont get weld-exception, but with JDL 7_25 the glassfish throws the exception!!! With the actual JDK 7_40 the same result!

Tim
  • 643
  • 3
  • 12
  • 23
  • That's not your web.xml btw, that is your pom.xml. – rdcrng Sep 11 '13 at 17:38
  • Is the new version of Jersey using guava or something? Looks like they're using JSR 330 annotations, but when you put those in a CDI environment without the proper setup it dies. – LightGuard Sep 11 '13 at 21:00
  • Yes, in the dependencies-path from jersey is gauva.jar 14.01. What can i do? – Tim Sep 12 '13 at 17:51

2 Answers2

1

If you can, please upgrade Guava to version 16.0.1, which removed the @Inject and @Singleton annotation. That should work, at least for me. Good luck.

Xiaodong Xie
  • 149
  • 3
  • 5
  • How can i do that? ... i have no direct dependency with guava, it's just through the jersey one. I just see a jersey-guava in the dependency hierarchy. – Rafael Aug 01 '14 at 09:42
  • Hello, sorry for the late reply first. You can just add Guava dependency in your pom file explicitly, with version 16.0.1 – Xiaodong Xie Oct 13 '14 at 14:02
0

I had same problem and solved it by manualy adding dependencies using the actual jar files from GF4 modules folder. seems maven version is not the same as GF4 version.

now for me com.fasterXML is a problem seems GF4 does not support it