So the docs are saying that symbols are first resolved by the
ApplicationDefaults symbols provider and then consequent symbols providers
if the symbols wasn't first resolved by the ApplicationDefaults symbol
provider.

I have a main application with multiple modules among which is a core
module contributing a custom symbol provider that, it self, needs symbols
to be resolved to operate.

Here is a portion of my SymbolProvider service

> public class ConfigurationSourceImpl {
> @Inject
> @Symbol(IpkSymbols.CONFIG_TABLE_NAME)
> private String tableName;
> @Inject
> @Symbol(IpkSymbols.CONFIG_TABLE_KEY_COLUMN)
> private String keyColumn;
> @Inject
> @Symbol(IpkSymbols.CONFIG_TABLE_VALUE_COLUMN)
> private String valueColumn;


.. and my module class

> @Startup
> *public void init(@InjectService("IpkConfig") IConfigurationSource
> config) {
> config.startMonitor();
> }*
> public static void bind(ServiceBinder binder) {
> binder.bind(IConfigurationsDAO.class, ConfigurationsDAOImpl.class);
> * binder.bind(IConfigurationSource.class,
> ConfigurationSourceImpl.class).withId("IpkConfig");*
> }
> *@Contribute(SymbolSource.class)
> public void
> injectIpKaizensConfigurationSoruce(OrderedConfiguration<SymbolProvider>
> providers,
> @InjectService("IpkConfig") IConfigurationSource ipkConfigSrc) {
> providers.add("IpKaizen-DB-Configuration-Provider", ipkConfigSrc);
> }*
> public PersistenceManagerFactory buildIpKaizenPMF(*@Inject
> @Symbol(IpkSymbols.DB_IPK) String filePath*, Logger log) {
> ...
> }
> public void *contributeApplicationDefaults*(MappedConfiguration<String,
> String> configuration) {
> configuration.add(IpkSymbols.CONFIG_TABLE_NAME, "configurations");
> configuration.add(IpkSymbols.CONFIG_TABLE_KEY_COLUMN, "key");
> configuration.add(IpkSymbols.CONFIG_TABLE_VALUE_COLUMN, "value");
> configuration.add(IpkSymbols.CONFIG_TABLE_ENABLED_COLUMN, "enabled");
> configuration.add(IpkSymbols.CONFIG_TABLE_REFRESH_INTERVAL, "1");
> }


I'm running the application in eclipse while providing the vm option "
-DIPK_DB"

But when I start my application I get the following exception

> 2012-09-08 14:38:01.675:WARN::failed app: java.lang.RuntimeException:
> Exception constructing service 'ComponentClassResolver': Exception
> constructing service 'IpkConfig': Exception constructing service
> 'IpkConfig': Construction of service 'IpkConfig' has failed due to
> recursion: the service depends on itself in some way. Please check
> com.skycomm.ipkaizen.portal.services.config.ConfigurationSourceImpl(Logger)
> (at ConfigurationSourceImpl.java:37) via
> com.skycomm.ipkaizen.portal.core.services.CoreModule.bind(ServiceBinder)
> (at CoreModule.java:36) for references to another service that is itself
> dependent on service 'IpkConfig'.
>


> 2012-09-08 14:38:01.675:WARN::Failed startup of context
> org.mortbay.jetty.webapp.WebAppContext@627787a5{/,E:\Workspace\Eclipse\IpKaizen
> - Portal\src\main\webapp}
> java.lang.RuntimeException: Exception constructing service
> 'ComponentClassResolver': Exception constructing service 'IpkConfig':
> Exception constructing service 'IpkConfig': Construction of service
> 'IpkConfig' has failed due to recursion: the service depends on itself in
> some way. Please check
> com.skycomm.ipkaizen.portal.services.config.ConfigurationSourceImpl(Logger)
> (at ConfigurationSourceImpl.java:37) via
> com.skycomm.ipkaizen.portal.core.services.CoreModule.bind(ServiceBinder)
> (at CoreModule.java:36) for references to another service that is itself
> dependent on service 'IpkConfig'.
> at
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
> at
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54)
> at $ComponentClassResolver_443d1b1e6040.delegate(Unknown Source)
> at $ComponentClassResolver_443d1b1e6040.isPageName(Unknown Source)
> at
> org.apache.tapestry5.services.TapestryModule$40.initializeApplication(TapestryModule.java:2440)
> at $ApplicationInitializer_443d1b1e6042.initializeApplication(Unknown
> Source)
> at $ApplicationInitializer_443d1b1e603e.initializeApplication(Unknown
> Source)
> at
> org.apache.tapestry5.services.TapestryModule$ServletApplicationInitializerTerminator.initializeApplication(TapestryModule.java:279)
> at
> $ServletApplicationInitializer_443d1b1e6024.initializeApplication(Unknown
> Source)
> at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:116)
> at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
> at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
> at org.mortbay.jetty.Server.doStart(Server.java:224)
> at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at runjettyrun.Bootstrap.main(Bootstrap.java:97)
> 2012-09-08 14:38:01.712:INFO::Started SelectChannelConnector@0.0.0.0:80


Is it not possible to have a symbol provider that depends on symbols it
self ?

Reply via email to