You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2010/02/23 01:00:50 UTC

[jira] Closed: (TAP5-977) Using @Inject on a private field of type Logger (in a service implementation) fails

     [ https://issues.apache.org/jira/browse/TAP5-977?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAP5-977.
-------------------------------------

    Resolution: Invalid

It is necessary to use @InjectResource, to indicate that the thing (the Logger) being injected is a resource specific to the service, rather than a general object provided via the MasterObjectProvider service.

> Using @Inject on a private field of type Logger (in a service implementation) fails
> -----------------------------------------------------------------------------------
>
>                 Key: TAP5-977
>                 URL: https://issues.apache.org/jira/browse/TAP5-977
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-ioc
>    Affects Versions: 5.2.0
>            Reporter: Howard M. Lewis Ship
>            Assignee: Howard M. Lewis Ship
>
> 08:35:05 ERROR o.a.t.i.i.OperationTrackerImpl:75 - No service implements the interface org.slf4j.Logger.
> 08:35:05 ERROR o.a.t.i.i.OperationTrackerImpl:76 - Operations trace:
> 08:35:05 ERROR o.a.t.i.i.OperationTrackerImpl:85 - [ 1] Realizing service UserAuthentication
> 08:35:05 ERROR o.a.t.i.i.OperationTrackerImpl:85 - [ 2] Invoking collective.t5.services.security.UserAuthenticationImpl() (at UserAuthenticationImpl.java:26) via collective.t5.services.security.SecurityModule.bind(ServiceBinder) (at SecurityModule.java:33)
> 08:35:05 ERROR o.a.t.i.i.OperationTrackerImpl:85 - [ 3] Calculating injection value for field 'logger' (org.slf4j.Logger)
> 08:35:05 ERROR o.a.t.i.i.OperationTrackerImpl:85 - [ 4] Resolving object of type org.slf4j.Logger using MasterObjectProvider
> 08:35:05 ERROR o.a.t.i.i.RecursiveServiceCreationCheckWrapper:64 - Construction of service UserAuthentication failed: Error invoking constructor collective.t5.services.security.UserAuthenticationImpl() (at UserAuthenticationImpl.java:26) via collective.t5.services.security.SecurityModule.bind(ServiceBinder) (at SecurityModule.java:33) (for service 'UserAuthentication'): No service implements the interface org.slf4j.Logger.
> java.lang.RuntimeException: Error invoking constructor collective.t5.services.security.UserAuthenticationImpl() (at UserAuthenticationImpl.java:26) via collective.t5.services.security.SecurityModule.bind(ServiceBinder) (at SecurityModule.java:33) (for service 'UserAuthentication'): No service implements the interface org.slf4j.Logger.
> 	at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:76) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:984) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:60) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:52) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:984) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:68) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> 	at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57) [tapestry-ioc-5.2.0-SNAPSHOT.jar:5.2.0-SNAPSHOT]
> The fact that the MasterObjectProvider was invoked to resolve the value for the field is wrong; the Logger is a resource of the service, not a dependency on another service, and should not need to be resolved that way.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.