Hi Scott,

I got two new problems.

I have a scheduled task need to inject a @PersistenceUnit, as the config
<resin:ScheduledTask xmlns:tasks="urn:java:com.timehr.tasks">
<resin:cron>0 2 *</resin:cron>

I turned log level to finer, and found Resin tried to initialize my task
before creating the persistence unit.
But my task need the persistence unit to be injected in it!

As long as I commented the task config lines out, my app run smoothly with
Resin showing these log lines before initialization of any my classes/beans:

[09-10-20 11:08:09.800] {Main Thread} com.caucho.jca.PoolItem <init> create:
PoolItem[jdbc/buysou_cms,0,ManagedConnectionImpl](active:0, total:0)
[09-10-20 11:08:09.809] {Main Thread} com.caucho.jca.PoolItem toActive
allocate PoolItem[jdbc/buysou_cms,0,ManagedConnectionImpl]
[09-10-20 11:08:09.885] {Main Thread} com.caucho.jca.PoolItem toIdle idle
[09-10-20 11:08:10.595] {Main Thread}
com.caucho.amber.manager.AmberContainer$LazyEntityManagerFactory init Amber
creating persistence unit 'buysou_cms' created with provider

I think the amber lazy init should be earlier than scheduled tasks, or any
PU injected task should trigger amber lazy init?

Another problem, I can't use <scheduled-task> tag in resin-web.xml because
any task will be initialized before the InjectManager add any beans in my
classpath (except the resin related beans and persistent related beans).
Then every task which need to inject some beans in my classpath would throw
the exception:

javax.enterprise.inject.UnsatisfiedResolutionException: Can't find a bean
for 'class com.mycompany.MyBean' because no beans implementing that class
have been registered with the injection manager InjectManager[web-app:

I guess <scheduled-task> was different with <resin:ScheduledTask>?

resin-interest mailing list

Reply via email to