You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Franz Amador <fg...@yahoo.com> on 2008/01/02 20:18:15 UTC

T5.0.7: No service implements the interface org.slf4j.Logger

This used to work, but now it's broken for me in 5.0.6 and 5.0.7.  I'm not sure how to debug this.  Apparently a proxy is being created for Logger, but when HibernateSessionManagerImpl tries to use it, it can't be realized.  Thanks in advance for any help.

Here are the relevant bits of AppModule.java:

import org.slf4j.Logger;
...

public class AppModule {
...
    public static void contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer> config, Logger log) {
        config.add("DatabaseConnectionProperties", new DatabaseConnectionPropertiesHibernateConfigurer(log), "after:Default");
    }
...


and here's the stack trace:

Caused by: java.lang.RuntimeException: Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry.hibernate.HibernateModule.build(Logger, List) (at HibernateModule.java:111) (for service 'HibernateSessionSource'): Error invoking service contribution method com.centricsoftware.pi.services.AppModule.contributeHibernateSessionSource(OrderedConfiguration, Logger): No service implements the interface org.slf4j.Logger.
    at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:76)
    at $HibernateSessionSource_1173bde489d._delegate($HibernateSessionSource_1173bde489d.java)
    at $HibernateSessionSource_1173bde489d.create($HibernateSessionSource_1173bde489d.java)
    at org.apache.tapestry.internal.hibernate.HibernateSessionManagerImpl.<init>(HibernateSessionManagerImpl.java:31)
    at org.apache.tapestry.hibernate.HibernateModule.build(HibernateModule.java:73)

Franz Amador
fgamador@yahoo.com



Re: T5.0.7: No service implements the interface org.slf4j.Logger

Posted by Howard Lewis Ship <hl...@gmail.com>.
The situation is that you can inject a Logger when constructing a
service, but you can't inject a Logger when contributing to a service.

Perhaps it would be a good idea to allow the service's Logger to be
injected into contributor methods, with the intention that any logging
related to the service goes to the same logger.

On Feb 2, 2008 4:59 AM, Robert Zeigler <ro...@scazdl.org> wrote:
> This is a different issue from the threads mentioned. Those threads
> are classloader issues, where the slf4j classes can't be found.
> In Franz's case, the org.slfj4.Logger interface is properly loaded by
> the classloader.  The issue is that the ioc container is confusing the
> Logger parameter for a service, and trying to fetch an implementation
> of Logger from the registry.
> I ran into the same issue last night with a 5.0.10 snapshot build.
> It's a bit inconsistent, though.
> In one of my contribute methods, I inject several services, plus the
> Logger. That works fine.
> I had another contribute method with several parameters to which I
> added a Logger parameter.  And that one broke, just like Franz is
> seeing, with a "no service implements org.slf4j.Logger" exception.
>
> In my case, I as able to work around the issue.  I was doing a bit of
> object creation within the contribute method, but I realized I could
> let Tapestry autobuild those objects and register them as services.
> Instead of injecting the object dependencies into my contribute
> method, I was able to inject the objects directly.  That worked around
> the issue.
>
> You ought to be able to do the same thing.  In your service binder
> method of your application module, you should be able to:
>
> binder
> .bind
> (HibernateConfigurer
> .class
> ,DatabaseConnectionProeprtiesHibernateConfigurer
> .class).withId("dbconfigurer");
>
> And then instead injecting Logger, you should be able to:
> public static void
> contributeHibernateSessionSource
> (OrderedConfiguration<HibernateConfigurer> config,
>    @InjectService("dbconfigurer")
>    HibernateConfigurer dbconfigurer) {
>    config.add(dbconfigurer,"after:Default");
> }
>
>
> HTH,
>
> Robert
>
>
> On Feb 2, 2008, at 2/212:42 AM , Alex.Hon wrote:
>
> >
> > see: http://www.nabble.com/About-Slf4j-Error-td13591128.html#a15240195
> > http://www.nabble.com/About-Slf4j-Error-td13591128.html#a15240195
> >
> >
> > Franz Amador wrote:
> >>
> >> This used to work, but now it's broken for me in 5.0.6 and 5.0.7.
> >> I'm not
> >> sure how to debug this.  Apparently a proxy is being created for
> >> Logger,
> >> but when HibernateSessionManagerImpl tries to use it, it can't be
> >> realized.  Thanks in advance for any help.
> >>
> >> Here are the relevant bits of AppModule.java:
> >>
> >> import org.slf4j.Logger;
> >> ...
> >>
> >> public class AppModule {
> >> ...
> >>    public static void
> >> contributeHibernateSessionSource
> >> (OrderedConfiguration<HibernateConfigurer>
> >> config, Logger log) {
> >>        config.add("DatabaseConnectionProperties", new
> >> DatabaseConnectionPropertiesHibernateConfigurer(log),
> >> "after:Default");
> >>    }
> >> ...
> >>
> >>
> >> and here's the stack trace:
> >>
> >> Caused by: java.lang.RuntimeException: Exception constructing service
> >> 'HibernateSessionSource': Error invoking service builder method
> >> org.apache.tapestry.hibernate.HibernateModule.build(Logger, List) (at
> >> HibernateModule.java:111) (for service 'HibernateSessionSource'):
> >> Error
> >> invoking service contribution method
> >> com
> >> .centricsoftware
> >> .pi
> >> .services
> >> .AppModule.contributeHibernateSessionSource(OrderedConfiguration,
> >> Logger): No service implements the interface org.slf4j.Logger.
> >>    at
> >> org
> >> .apache
> >> .tapestry
> >> .ioc
> >> .internal
> >> .services
> >> .JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:
> >> 76)
> >>    at
> >> $
> >> HibernateSessionSource_1173bde489d
> >> ._delegate($HibernateSessionSource_1173bde489d.java)
> >>    at
> >> $
> >> HibernateSessionSource_1173bde489d
> >> .create($HibernateSessionSource_1173bde489d.java)
> >>    at
> >> org
> >> .apache
> >> .tapestry
> >> .internal
> >> .hibernate
> >> .HibernateSessionManagerImpl
> >> .<init>(HibernateSessionManagerImpl.java:31)
> >>    at
> >> org
> >> .apache
> >> .tapestry.hibernate.HibernateModule.build(HibernateModule.java:73)
> >>
> >> Franz Amador
> >> fgamador@yahoo.com
> >>
> >>
> >>
> >>
> >
> > --
> > View this message in context: http://www.nabble.com/T5.0.7%3A-No-service-implements-the-interface-org.slf4j.Logger-tp14584395p15240200.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.0.7: No service implements the interface org.slf4j.Logger

Posted by Robert Zeigler <ro...@scazdl.org>.
This is a different issue from the threads mentioned. Those threads  
are classloader issues, where the slf4j classes can't be found.
In Franz's case, the org.slfj4.Logger interface is properly loaded by  
the classloader.  The issue is that the ioc container is confusing the  
Logger parameter for a service, and trying to fetch an implementation  
of Logger from the registry.
I ran into the same issue last night with a 5.0.10 snapshot build.   
It's a bit inconsistent, though.
In one of my contribute methods, I inject several services, plus the  
Logger. That works fine.
I had another contribute method with several parameters to which I  
added a Logger parameter.  And that one broke, just like Franz is  
seeing, with a "no service implements org.slf4j.Logger" exception.

In my case, I as able to work around the issue.  I was doing a bit of  
object creation within the contribute method, but I realized I could  
let Tapestry autobuild those objects and register them as services.   
Instead of injecting the object dependencies into my contribute  
method, I was able to inject the objects directly.  That worked around  
the issue.

You ought to be able to do the same thing.  In your service binder  
method of your application module, you should be able to:

binder 
.bind 
(HibernateConfigurer 
.class 
,DatabaseConnectionProeprtiesHibernateConfigurer 
.class).withId("dbconfigurer");

And then instead injecting Logger, you should be able to:
public static void  
contributeHibernateSessionSource 
(OrderedConfiguration<HibernateConfigurer> config,
   @InjectService("dbconfigurer")
   HibernateConfigurer dbconfigurer) {
   config.add(dbconfigurer,"after:Default");
}


HTH,

Robert

On Feb 2, 2008, at 2/212:42 AM , Alex.Hon wrote:

>
> see: http://www.nabble.com/About-Slf4j-Error-td13591128.html#a15240195
> http://www.nabble.com/About-Slf4j-Error-td13591128.html#a15240195
>
>
> Franz Amador wrote:
>>
>> This used to work, but now it's broken for me in 5.0.6 and 5.0.7.   
>> I'm not
>> sure how to debug this.  Apparently a proxy is being created for  
>> Logger,
>> but when HibernateSessionManagerImpl tries to use it, it can't be
>> realized.  Thanks in advance for any help.
>>
>> Here are the relevant bits of AppModule.java:
>>
>> import org.slf4j.Logger;
>> ...
>>
>> public class AppModule {
>> ...
>>    public static void
>> contributeHibernateSessionSource 
>> (OrderedConfiguration<HibernateConfigurer>
>> config, Logger log) {
>>        config.add("DatabaseConnectionProperties", new
>> DatabaseConnectionPropertiesHibernateConfigurer(log),  
>> "after:Default");
>>    }
>> ...
>>
>>
>> and here's the stack trace:
>>
>> Caused by: java.lang.RuntimeException: Exception constructing service
>> 'HibernateSessionSource': Error invoking service builder method
>> org.apache.tapestry.hibernate.HibernateModule.build(Logger, List) (at
>> HibernateModule.java:111) (for service 'HibernateSessionSource'):  
>> Error
>> invoking service contribution method
>> com 
>> .centricsoftware 
>> .pi 
>> .services 
>> .AppModule.contributeHibernateSessionSource(OrderedConfiguration,
>> Logger): No service implements the interface org.slf4j.Logger.
>>    at
>> org 
>> .apache 
>> .tapestry 
>> .ioc 
>> .internal 
>> .services 
>> .JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java: 
>> 76)
>>    at
>> $ 
>> HibernateSessionSource_1173bde489d 
>> ._delegate($HibernateSessionSource_1173bde489d.java)
>>    at
>> $ 
>> HibernateSessionSource_1173bde489d 
>> .create($HibernateSessionSource_1173bde489d.java)
>>    at
>> org 
>> .apache 
>> .tapestry 
>> .internal 
>> .hibernate 
>> .HibernateSessionManagerImpl 
>> .<init>(HibernateSessionManagerImpl.java:31)
>>    at
>> org 
>> .apache 
>> .tapestry.hibernate.HibernateModule.build(HibernateModule.java:73)
>>
>> Franz Amador
>> fgamador@yahoo.com
>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/T5.0.7%3A-No-service-implements-the-interface-org.slf4j.Logger-tp14584395p15240200.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.0.7: No service implements the interface org.slf4j.Logger

Posted by "Alex.Hon" <gu...@gmail.com>.
see: http://www.nabble.com/About-Slf4j-Error-td13591128.html#a15240195
http://www.nabble.com/About-Slf4j-Error-td13591128.html#a15240195 


Franz Amador wrote:
> 
> This used to work, but now it's broken for me in 5.0.6 and 5.0.7.  I'm not
> sure how to debug this.  Apparently a proxy is being created for Logger,
> but when HibernateSessionManagerImpl tries to use it, it can't be
> realized.  Thanks in advance for any help.
> 
> Here are the relevant bits of AppModule.java:
> 
> import org.slf4j.Logger;
> ...
> 
> public class AppModule {
> ...
>     public static void
> contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer>
> config, Logger log) {
>         config.add("DatabaseConnectionProperties", new
> DatabaseConnectionPropertiesHibernateConfigurer(log), "after:Default");
>     }
> ...
> 
> 
> and here's the stack trace:
> 
> Caused by: java.lang.RuntimeException: Exception constructing service
> 'HibernateSessionSource': Error invoking service builder method
> org.apache.tapestry.hibernate.HibernateModule.build(Logger, List) (at
> HibernateModule.java:111) (for service 'HibernateSessionSource'): Error
> invoking service contribution method
> com.centricsoftware.pi.services.AppModule.contributeHibernateSessionSource(OrderedConfiguration,
> Logger): No service implements the interface org.slf4j.Logger.
>     at
> org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:76)
>     at
> $HibernateSessionSource_1173bde489d._delegate($HibernateSessionSource_1173bde489d.java)
>     at
> $HibernateSessionSource_1173bde489d.create($HibernateSessionSource_1173bde489d.java)
>     at
> org.apache.tapestry.internal.hibernate.HibernateSessionManagerImpl.<init>(HibernateSessionManagerImpl.java:31)
>     at
> org.apache.tapestry.hibernate.HibernateModule.build(HibernateModule.java:73)
> 
> Franz Amador
> fgamador@yahoo.com
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5.0.7%3A-No-service-implements-the-interface-org.slf4j.Logger-tp14584395p15240200.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Quick but urgent Tapestry question

Posted by Howard Lewis Ship <hl...@gmail.com>.
In 4.1 this can be done, the solution is no different than the chart
built into the workbench, except that instead of returning an IAsset
that invokes a URL request that generates the chart, the
IEngineService will read and push the content of an external file.

On Jan 11, 2008 3:28 AM,  <mu...@fantasymail.de> wrote:
> Hi Howard!
>
> I have already asked on the mailing list but got no solution yet
> that would work for me and we need to finish the project quite soon....
>
> I simply want to add pictures for a catalogue in a different directory to the web application, without having to war them as it is gigabytes of data.
>
> So I want to add the path in a properties file e.g. /home/www/images
> that is outside of any webroot directory.
>
> It is a Tapestry 4.1 application.
>
> is there an "easy" way to just return an Image similiar to
>
> public IAsset getImage(String image){
> return new IAsset getImagePath().concat(image);
> }
>
> ?
>
>
> Max
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.0.7: No service implements the interface org.slf4j.Logger

Posted by Howard Lewis Ship <hl...@gmail.com>.
That's odd, I don't understand why it would have worked in 5.0.5!  A
Logger should only be available for a service builder method, not for
a contribution method.

On Jan 2, 2008 11:18 AM, Franz Amador <fg...@yahoo.com> wrote:
> This used to work, but now it's broken for me in 5.0.6 and 5.0.7.  I'm not sure how to debug this.  Apparently a proxy is being created for Logger, but when HibernateSessionManagerImpl tries to use it, it can't be realized.  Thanks in advance for any help.
>
> Here are the relevant bits of AppModule.java:
>
> import org.slf4j.Logger;
> ...
>
> public class AppModule {
> ...
>     public static void contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer> config, Logger log) {
>         config.add("DatabaseConnectionProperties", new DatabaseConnectionPropertiesHibernateConfigurer(log), "after:Default");
>     }
> ...
>
>
> and here's the stack trace:
>
> Caused by: java.lang.RuntimeException: Exception constructing service 'HibernateSessionSource': Error invoking service builder method org.apache.tapestry.hibernate.HibernateModule.build(Logger, List) (at HibernateModule.java:111) (for service 'HibernateSessionSource'): Error invoking service contribution method com.centricsoftware.pi.services.AppModule.contributeHibernateSessionSource(OrderedConfiguration, Logger): No service implements the interface org.slf4j.Logger.
>     at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:76)
>     at $HibernateSessionSource_1173bde489d._delegate($HibernateSessionSource_1173bde489d.java)
>     at $HibernateSessionSource_1173bde489d.create($HibernateSessionSource_1173bde489d.java)
>     at org.apache.tapestry.internal.hibernate.HibernateSessionManagerImpl.<init>(HibernateSessionManagerImpl.java:31)
>     at org.apache.tapestry.hibernate.HibernateModule.build(HibernateModule.java:73)
>
> Franz Amador
> fgamador@yahoo.com
>
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org