After some more experimentation, I've corrected an error in my original
contribution method. It should've read:


    public static void contributeInjectionProvider(
            OrderedConfiguration<InjectionProvider2> configuration,
            MasterObjectProvider masterObjectProvider,
            ObjectLocator locator,
            SymbolSource symbolSource,
            AssetSource assetSource)
    {
        configuration.add("BeckonLogger", new
BeckonLoggerInjectionProvider(), "before:Default");
    }

When I include this method in my AppModule, my InjectionProvider
implementation get a chance to provide implementations for Pages and
Components, which is most of what I'd like to do. However, I'd also like my
InjectionProvider to act on objects built during the Registry Startup
phase. In particular, I configure a database in a submodule method
annotated with @Startup. @Inject-annotated fields of objects built in that
phase are not seen by my InjectionProvider.

I found a thread from last year that discusses a very similar goal:
http://markmail.org/thread/ny4xefhxzuwrus3e. That thread culminated in
tapestry-cdi: https://github.com/magnuskvalheim/tapestry-cdi . I tried to
follow the same approach--contributing my InjectionProvider in a totally
separate Module which tapestry should've seen via autoloading, but I can't
seem to get autoloading right. I added the following block to my pom.xml:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <archive>
                        <manifestEntries>

<Tapestry-Module-Classes>com.beckon.util.log.BeckonLoggerInjectionModule</Tapestry-Module-Classes>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

This correctly adds the Tapestry-Module-Classes line to the MANIFEST.MF of
jars built using mvn jar:jar, but I don't believe it affects the archive
built by mvn jetty:run. In any case, my LoggerInjectionModule doesn't
appear in the list of modules added by ioc.RegistryBuilder.

Any suggestions regarding contributing InjectionProviders before the
Startup phase or troubleshooting autoloading when using the jetty:run maven
goal?

Thank you,
- Pavel


On Tue, May 1, 2012 at 2:28 PM, Pavel Vodenski <pa...@beckon.com> wrote:

> > The error message says you're trying to contribute configuration for a
> service that doesn't exist. Are you trying to run this without
> tapestry-core (the web framework)?
>
> I am using tapestry-core. The snippet I posted came out of our tapestry
> project's AppModule class.
>
>
> On Tue, May 1, 2012 at 5:59 AM, Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
>> On Mon, 30 Apr 2012 23:04:13 -0300, Pavel Vodenski <pa...@beckon.com>
>> wrote:
>>
>>  But that gives me the following error:
>>> java.lang.**IllegalArgumentException: Contribution
>>> com.beckon.app.services.**AppModule.**contributeInjectionProvider2(**
>>> OrderedConfiguration,
>>> MasterObjectProvider, ObjectLocator, SymbolSource, AssetSource) (at
>>> AppModule.java:92) is for service 'InjectionProvider2', which does not
>>> exist.
>>>
>>
>> The error message says you're trying to contribute configuration for a
>> service that doesn't exist. Are you trying to run this without
>> tapestry-core (the web framework)?
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.com.br
>>
>
>

Reply via email to