Method bind shoould be static On Thu, Apr 17, 2008 at 9:56 PM, Michael Szalay <[EMAIL PROTECTED]> wrote:
> Hi all > > I tried to build my first service, but its not found within the > registration > > I try to lookup it in the page: > > @Inject > private QuizService quizService; > > There is a Module class which should build my service: > > package com.szalay.quiz.services; > > import org.apache.tapestry.ioc.ServiceBinder; > > /** > * > * @author michael > */ > public class QuizModule { > > /** > * this is called by tapestry at application startup > * > * @param binder > */ > public void bind(ServiceBinder binder) { > binder.bind(QuizService.class, > QuizServiceImpl.class).scope("singleton"); > } > } > > QuizService: > > package com.szalay.quiz.services; > > import com.szalay.quiz.entity.Quiz; > import java.util.Collection; > > /** > * > * @author michael > */ > public interface QuizService { > > public Collection<Quiz> getLatestQuiz(int number) throws Exception; > > public Integer getNumberOfQuizes() throws Exception; > } > > > QuizServiceImpl: > > package com.szalay.quiz.services; > > import com.szalay.quiz.entity.Quiz; > import java.util.Collection; > > /** > * > * @author michael > */ > public class QuizServiceImpl implements QuizService { > > public Collection<Quiz> getLatestQuiz(int number) throws Exception { > ... > } > > public Integer getNumberOfQuizes() throws Exception { > ... > } > > } > > > But this gets the error: > > Caused by: java.lang.RuntimeException: No service implements the interface > com.szalay.quiz.services.QuizService. > at > > org.apache.tapestry.ioc.internal.RegistryImpl.getService(RegistryImpl.java:517) > at > > org.apache.tapestry.ioc.internal.ObjectLocatorImpl.getService(ObjectLocatorImpl.java:45) > at > > org.apache.tapestry.internal.services.ServiceInjectionProvider.provideInjection(ServiceInjectionProvider.java:40) > > > here is my web.xml > > <?xml version="1.0" encoding="UTF-8"?> > <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" > xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" > http://java.sun.com/xml/ns/javaee > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> > > <!-- tapestry stuff --> > <context-param> > <param-name>tapestry.app-package</param-name> > <param-value>com.szalay.quiz</param-value> > </context-param> > <filter> > <filter-name>app</filter-name> > <filter-class>org.apache.tapestry.TapestryFilter</filter-class> > </filter> > <filter-mapping> > <filter-name>app</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > > <!-- session timeout --> > <session-config> > <session-timeout> > 30 > </session-timeout> > </session-config> > > </web-app> > > > > I have not idea about what is wrong. Anyone of you? > > Regards > > Michael > -- Best regards, Igor Drobiazko