Reputation: 379
I have an Bean interface, AbstractBean (implements Bean) and SpecificBean (extends AbstractBean). I want to inject SpecificBean by following code snippet:
@Stateless
@Specific
public class SpecificBean extends AbstractBean {..}
@Path("resource")
public class Service {
@Inject
@Specific
private Bean bean;
}
When I trying to deploy this to glassfish, I see next error:
An error has occurred Error occurred during deployment: Exception while loading the app : CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [IterableProvider>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 2 of [BackedAnnotatedConstructor] @Inject org.glassfish.jersey.internal.inject.JerseyClassAnalyzer(@Named ClassAnalyzer, IterableProvider>)].
If delete all annotations (expected @Path) application deploys without any errors.
Upvotes: 8
Views: 10514
Reputation: 1
Here are some steps which helped me to solve this problem:
Open a command window (preferably as an administrator). Click on Start -> type cmd and press ENTER.
Go to the path where you have install GlassFish, for example: C:\AppServers\glassfish5\glassfish\bin.
Run these commands:
asadmin start-domain
asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=false
Restart GlassFish and try to deploy you application.
Thanks to Stuart Mcculloch for the support on this forum: https://www.eclipse.org/forums/index.php?t=msg&th=490794&goto=1068764&#msg_1068764
Exception Occurred :Error occurred during deployment: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type Injector with qualifiers @Default
Solve problem to deploy de aplicacion en GlassFish
Upvotes: 0
Reputation: 1479
I found this questions with similar problem and just want to add my "2 cents". In my case, I was using Jersey 2.0 with Jackson in order to transform JSON to objects and object to JSON from my rest interfaces. This means that I had to register JacksonFeature
on ResourceConfig
like this:
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.message.GZipEncoder;
import org.glassfish.jersey.server.ResourceConfig;
public class JacksonRestConfiguration extends ResourceConfig {
public JacksonRestConfiguration() {
register( new GZipEncoder() );
register( JacksonFeature.class );
}
I also disabled Moxy on my Application extension:
import org.glassfish.jersey.CommonProperties;
@ApplicationPath("services")
public class RestApplication extends Application implements Feature {
public boolean configure( final FeatureContext context ) {
String postfix = '.' + context.getConfiguration().getRuntimeType().name().toLowerCase();
context.property( CommonProperties.MOXY_JSON_FEATURE_DISABLE + postfix, true );
return true;
}
}
Both classes above required me to keep jersey as provided
in my pom.xml
in order to generate the war file correctly:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.13</version>
<scope>provided</scope>
</dependency>
Upvotes: 2
Reputation: 379
Removed jersey from the dependencies list in maven pom.xml (jersey already contains in glassfish 4) and it deploys ok now.
Upvotes: 10