Maybe a stupid answer, but have you tried injecting a Provider<> in
one of the two classes, instead of directly injecting the class?

   Philippe

On Mon, Oct 4, 2010 at 10:44 AM, Roman <[email protected]> wrote:
> Hi
> I have a very strange problem , that no one could explain me.
> So here is the problem. I have a circular constructor dependency
> between 2 classes
> I have no problems with this dependency in most cases , but there is
> one environment ( my production environment
> where it fails with this strange exception
>
>
> java.lang.RuntimeException: Exception
>        at
> com.delver.util.ConcurrentUtils.getConcurrently(ConcurrentUtils.java:
> 72)
>        at
> com.delver.update.task.update.dedup.ProductDeduper.getConcurrently(ProductDeduper.java:
> 234)
>        at
> com.delver.update.task.update.dedup.ExternalProductIDDeduper.getProductsFromStorage(ExternalProductIDDeduper.java:
> 49)
>        at
> com.delver.update.task.update.dedup.ProductDeduper.dedupVsStorage(ProductDeduper.java:
> 114)
>        at
> com.delver.update.task.update.flows.AddedBuyingOptionsProcessor.process(AddedBuyingOptionsProcessor.java:
> 102)
>        at
> com.delver.update.task.update.CsvProcessor.processCsv(CsvProcessor.java:
> 116)
>        at
> com.delver.update.task.update.CsvSeedingUpdateTask.handlePartition(CsvSeedingUpdateTask.java:
> 222)
>        at
> com.delver.update.task.update.CsvSeedingUpdateTask.doUpdate(CsvSeedingUpdateTask.java:
> 94)
>        at
> com.delver.update.task.update.SeedingUpdateTask.doWork(SeedingUpdateTask.java:
> 78)
>        at
> com.delver.update.task.AbstractSeedingTask.run(AbstractSeedingTask.java:
> 86)
>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
> 441)
>        at java.util.concurrent.FutureTask
> $Sync.innerRunAndReset(FutureTask.java:317)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
>        at java.util.concurrent.ScheduledThreadPoolExecutor
> $ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
>        at java.util.concurrent.ScheduledThreadPoolExecutor
> $ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
>        at java.util.concurrent.ScheduledThreadPoolExecutor
> $ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
>        at java.util.concurrent.ThreadPoolExecutor
> $Worker.runTask(ThreadPoolExecutor.java:886)
>        at java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.util.concurrent.ExecutionException:
> java.lang.IllegalStateException: This is a proxy used to support
> circular references involving constructors. The object we're proxying
> is not constructed yet. Please wait until after injection has
> completed to use this object.
>        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
>        at java.util.concurrent.FutureTask.get(FutureTask.java:83)
>        at
> com.delver.util.ConcurrentUtils.getConcurrently(ConcurrentUtils.java:
> 65)
>        ... 18 more
> Caused by: java.lang.IllegalStateException: This is a proxy used to
> support circular references involving constructors. The object we're
> proxying is not constructed yet. Please wait until after injection has
> completed to use this object.
>        at com.google.inject.internal.ConstructionContext
> $DelegatingInvocationHandler.invoke(ConstructionContext.java:100)
>        at $Proxy20.getProductsCategories(Unknown Source)
>        at
> com.delver.persistence.repositories.products.ProductCategoriesHelper.addCategories(ProductCategoriesHelper.java:
> 43)
>        at
> com.delver.persistence.repositories.products.ProductPersistenceHelper._getBasicWithFullBO(ProductPersistenceHelper.java:
> 217)
>        at
> com.delver.persistence.repositories.products.ProductPersistenceHelper.getByIds(ProductPersistenceHelper.java:
> 978)
>        at
> com.delver.persistence.repositories.products.ProductPersistenceService.getProductsByBuyingOptionsExternalProductIds(ProductPersistenceService.java:
> 381)
>        at com.delver.update.task.update.dedup.ExternalProductIDDeduper
> $1.call(ExternalProductIDDeduper.java:53)
>        at com.delver.update.task.update.dedup.ExternalProductIDDeduper
> $1.call(ExternalProductIDDeduper.java:49)
>        at com.delver.util.ConcurrentUtils$1.call(ConcurrentUtils.java:56)
>        at com.delver.util.ConcurrentUtils$1.call(ConcurrentUtils.java:53)
>        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>        ... 3 more
>
>
> Please ignore the whole stack trace , the interesting part is the last
> one
>
> So , I have in the place where there should be actual instance of the
> object an some delegating  proxy to him , which i cannot understand
> and it happens only in one environment.
>
> Thanks for the help i really stuck on this one.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-guice?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to