You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Leonard Lu (JIRA)" <ji...@apache.org> on 2010/02/20 02:20:28 UTC

[jira] Commented: (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:comment-tabpanel&focusedCommentId=12836077#action_12836077 ] 

Leonard Lu commented on TAP5-977:
---------------------------------

This issue (or a very similar one) prevents using the PageTester class to test services that have org.slf4j.Logger as one of their parameters.

Example:

ComponentRequestFilter accessControl = pageTester.getRegistry().autobuild(AccessControlFilterImpl.class);

Result:

[ERROR] ioc.Registry No service implements the interface org.slf4j.Logger.
[ERROR] ioc.Registry Operations trace:
[ERROR] ioc.Registry [ 1] Autobuilding instance of class com.example.services.impl.AccessControlFilterImpl
[ERROR] ioc.Registry [ 2] Determining injection value for parameter #2 (org.slf4j.Logger)
[ERROR] ioc.Registry [ 3] Resolving object of type org.slf4j.Logger using MasterObjectProvider

> 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
>
> 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.