Sonny Gill wrote:
> Hi,
>
> I can't get PetStore to run at the moment.
> Most of the errors were simple - addComposites had to be changed to 
> addEntities
>
> Now, I get the following error -
>
> Exception in thread "main"
> org.qi4j.spi.composite.InvalidCompositeException: No implementation
> found for method public abstract javax.servlet.ServletConfig
> javax.servlet.Servlet.getServletConfig() in
> org.qi4j.quikit.application.ServletService
>       at 
> org.qi4j.runtime.composite.AbstractMixinsModel.implementMethod(AbstractMixinsModel.java:104)
>       at 
> org.qi4j.runtime.composite.CompositeMethodsModel.implementMixinType(CompositeMethodsModel.java:86)
>       at 
> org.qi4j.runtime.composite.CompositeMethodsModel.<init>(CompositeMethodsModel.java:49)
>       at 
> org.qi4j.runtime.composite.CompositeModel.newModel(CompositeModel.java:76)
>       at 
> org.qi4j.bootstrap.ModuleAssembly.assembleModule(ModuleAssembly.java:222)
>       at 
> org.qi4j.bootstrap.ApplicationFactory.newApplication(ApplicationFactory.java:110)
>       at 
> org.qi4j.bootstrap.ApplicationFactory.newApplication(ApplicationFactory.java:86)
>       at 
> org.qi4j.samples.petstore.web.MainWorkAround.main(MainWorkAround.java:37)
>
>
> ServletService is registered as -
>
>         // Add the quikit servlet
>         aModule.addServices( ServletService.class )
>             .providedBy( QuikItServletProviderComposite.class )
>             .setMetaInfo( new ServletInfo( "/quikit/*" ) );
>
> How do I fix this?
>
>   

I've been working on an app that uses struts lately and was following 
the PetStore example.  I managed to figure out how to get it to work but 
I'm not sure if there is a better way or not.

What I wound up doing was creating a base ServletService with extends 
the Servlet and ServiceComposite interfaces.   Then, for the actual 
service that gets registered I extended that ServletService and used the 
servlet that I wanted as the mixin.

I did the same thing for filters, creating a FilterService that extends 
Filter and ServiceComposite.  Next I created a few convenience methods 
so I can more naturally add Filters like so

        // Add the struts filter
        addFilters(
            
filter("*.action").through(FilterDispatcherService.class).on(REQUEST, 
FORWARD).withInitParams(
                immutableMap("actionPackages", 
"com.compunetconsulting.trinket.web.struts.actions")
            )
        ).to(module);

It works out pretty darn well.  And I even, finally, got an 
ObjectFactory implemented that allows struts to use Qi4j composites as 
actions like so

@Mixins({ActionSupport.class})
public interface Home extends Action, Composite {
}

It wasn't easy, but I did it.  If anyone is interested I can see about 
cleaning up the code a bit and contributing it.

Rich
> Thanks,
> Sonny
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>   


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to