Showing posts with label Tapestry 5. Show all posts
Showing posts with label Tapestry 5. Show all posts

Thursday, December 5, 2013

Tapestry 5 Invalid configuration

I met following configuration exception in logs:
Caused by: java.lang.IllegalArgumentException: Service 'ChangeLogProcessor' is configured using 
org.apache.tapestry5.ioc.OrderedConfiguration, not org.apache.tapestry5.ioc.Configuration.
 at org.apache.tapestry5.ioc.internal.util.WrongConfigurationTypeGuard.findResource(WrongConfigurationTypeGuard.java:40)
 at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:36)
 at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38)

Problem was related to Tapestry 5 chain of commands builder. It's Tapestry 5 build-in service that helps to implement that design pattern. My chain of commands definition was:
public static ChangeLogProcessor buildChangeLogProcessor(List<ChangeLogProcessor> commands,
    @InjectService("ChainBuilder") ChainBuilder chainBuilder) {
    return chainBuilder.build(ChangeLogProcessor.class, commands);
}

public static void contributeChangeLogProcessor(
    final Configuration<ChangeLogProcessor> configuration,
    final @Autobuild ChangeLogBoxProcessor changeLogBoxProcessor) {
    configuration.add(changeLogBoxProcessor);
}
After some time I found that problem was in contribute method, in build method is configuration defined as List which should be in contribute method defined as OrderedConfiguration not as Configuration. So following corrected code works fine:
public static void contributeChangeLogProcessor(
    final OrderedConfiguration<ChangeLogProcessor> configuration,
    final @Autobuild ChangeLogBoxProcessor changeLogBoxProcessor) {
    configuration.add("boxProcessor", changeLogBoxProcessor);
}

Friday, January 18, 2013

Tapestry 5 Exception - missing template

Following error appears in application production log:
TP-Processor19 2013.01.17.21.00.08 ERROR core.services.AppModule.extendedRequestExceptionHandler - Processing of request failed with uncaught exception: Embedded component(s) discussion, layout are defined within component class cz.koroptev.cubiculus.core.pages.buildinginstruction.BuildingInstructionLego (or a super-class of BuildingInstructionLego), but are not present in the component template (null).
org.apache.tapestry5.ioc.internal.OperationException: Embedded component(s) discussion, layout are defined within component class cz.koroptev.cubiculus.core.pages.buildinginstruction.BuildingInstructionLego (or a super-class of BuildingInstructionLego), but are not present in the component template (null).
 at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121)
 at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88)
 at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
 at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1121)
 at org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:221)
 at org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:211)
 at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:183)
 at org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:178)
 at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
 at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
 at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1121)
 at org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:177)
 at $PageLoader_69b95d11058ab2.loadPage(Unknown Source)
 at org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:104)
 at $PageSource_69b95d11058aa7.getPage(Unknown Source)
 at org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:82)
 at $RequestPageCache_69b95d11058aa6.get(Unknown Source)
 at $RequestPageCache_69b95d11058aa3.get(Unknown Source)

Strange exception in other words say that it's not possible to find application template for some component. This problem shows just at production server not at my development machine. I'm using Tapestry 5 version 5.3.2.

After some time I found that problem was in directory naming. Templates in maven project are in directory 'src/main/webapps/buildinInstruction'. Name 'buildinInstruction' contains upper case I. When I change it to lower case problem disappears. Problem can't be reproduced at my machine because my Mac OS X use case insensitive file system.