Sorry I missed the filter-mapping part, which I believe needs to match
the filter name. So you should have:

...

    <filter>
        <filter-name>Quiz</filter-name>
        <filter-class>org.apache.tapestry.TapestryFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>Quiz</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

...

Chris Lewis wrote:
> Hi Michael,
>
> I believe the problem is your filter name in web.xml. See this part:
>
> ...
>
>     <filter>
>         <filter-name>app</filter-name>
>         <filter-class>org.apache.tapestry.TapestryFilter</filter-class>
>     </filter>
>
> ...
>
> If I remember correctly T5 uses the filter name to deduce your
> application module. By default (using the maven quickstart archetype)
> this is named 'app', and a default module is created for you named
> AppModule.java in the services directory. My guess is you renamed your
> module but did not rename your filter (I've done this a couple of times).
>
> chris
>
> Michael Szalay 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
>>
>>   
>>     
>
>   

-- 
http://thegodcode.net

Reply via email to