dev@glassfish.java.net

Re: UnsatisfiedDepedencyException

From: Amy Roh <Amelia.Roh_at_Sun.COM>
Date: Tue, 19 Aug 2008 18:08:06 -0700

Kedar Mhaswade wrote:
> Is this a regression?
No :-)
> Are you injecting like:
>
> @Inject(name="http-listener-1")
> HttpListener ls1;
I have injected HttpService like below to listen to its events when its
list of http-listener, virtual-server, or other sub-component changes.

    @Inject
    public HttpService httpService;

If I inject

    @Inject(name="http-listener-1")
    public HttpListener httpListener;

only changes to HttpListener named "http-listener-1" trigger
ConfigListener which HttpListener is injected into. This doesn't work
for dynamically created HttpListener named let's say "test-listener",
correct?

Same goes for VirtualServer

    @Inject(name="server")
    public VirtualServer virtualServer;

If I create a virtual-server named vs2, changes to vs2 will not trigger
the above ConfigListener...

Thanks,
Amy

>
> ?
>
> Thanks.
>
> Amy Roh wrote:
>> I'm trying to better understand the root cause of
>> UnsatisfiedDepedencyException. For example, injecting
>> com.sun.enterprise.config.serverbeans.HttpService works fine in
>> HttpServiceConfigListener (which gets instantiated as the last step
>> of WebContainer.postConstruct()). However, HttpListener or
>> VirtualServer injection fails with the exception. Shouldn't
>> HttpListener and VirtualServer be available for injection by the time
>> web container is getting started?
>>
>> [#|2008-08-18T13:28:26.417-0700|SEVERE||javax.enterprise.system.tools.deployment|_ThreadID=12;_ThreadName=Thread-3;|Cannot
>> start container web
>> org.jvnet.hk2.component.UnsatisfiedDepedencyException: Unsatisfied
>> dependency exception : public
>> com.sun.enterprise.config.serverbeans.HttpListener
>> com.sun.enterprise.web.reconfig.HttpServiceConfigListener.httpListener
>> at
>> org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:100)
>>
>> at
>> com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:100)
>> at
>> com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
>>
>> at
>> com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:75)
>> at
>> com.sun.enterprise.web.WebContainer.postConstruct(WebContainer.java:662)
>> at
>> com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:150)
>> at
>> com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
>>
>> at
>> com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:75)
>> at
>> com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
>>
>> at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
>> at
>> com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
>>
>> at
>> org.glassfish.internal.data.ContainerInfo.getContainer(ContainerInfo.java:75)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.startContainers(ApplicationLifecycle.java:798)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:435)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:270)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:221)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:98)
>>
>> at
>> com.sun.enterprise.v3.server.ApplicationLoaderInjector.postConstruct(ApplicationLoaderInjector.java:61)
>>
>> at
>> com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:150)
>> at
>> com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:86)
>>
>> at
>> com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:75)
>> at
>> com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
>>
>> at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
>> at
>> com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
>>
>> at
>> com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:162)
>>
>> at
>> com.sun.enterprise.v3.server.AppServerStartup$1.run(AppServerStartup.java:103)
>>
>> Caused by: org.jvnet.hk2.component.UnsatisfiedDepedencyException:
>> Unsatisfied dependency exception : public
>> com.sun.enterprise.config.serverbeans.HttpListener
>> com.sun.enterprise.web.reconfig.HttpServiceConfigListener.httpListener
>> at
>> org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:95)
>>
>> ... 25 more
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>