[Building Sakai] spring beans with job

Aaron Zeckoski aaronz at vt.edu
Fri Mar 20 07:17:54 PDT 2009


There is a much longer discussion about this on the list from a month
or so ago but in short:
Scheduled jobs run in the classloader of the scheduler and not in the
classloader of the class where the Job implementaiton comes from. This
means they cannot see the classes from the orginating classloader and
can only see stuff in the job scheduler classloader and shared. This
is why you get the ClassNotFoundException. Andrew Thornton suggested a
patch for this in the other thread.

-AZ


On Fri, Mar 20, 2009 at 1:52 PM, Gary Seibold
<gseibold at bumail.bradley.edu> wrote:
> I have a tool using course management functions that is working.  When
> I try to convert this over to a Job, I get the error following error:
>
> ERROR: Job DEFAULT.Update Official Course Sites threw an unhandled
> Exception:  (2009-03-19 14:17:14,659
> QuartzScheduler_Worker-1_org.quartz.core.JobRunShell)
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'courseManagementService' defined in file [/
> usr/local/tomcat/components/test/WEB-INF/application-context-
> test.xml]: Cannot create inner bean
> 'org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceFederatedImpl#f57993' of
> type
> [org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceFederatedImpl] while
> setting bean property 'target'; nested exception is
> org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
> find class
> [org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceFederatedImpl] for bean
> with name
> 'org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceFederatedImpl#f57993'
> defined in file [/usr/local/tomcat/components/test/WEB-INF/application-
> context-test.xml]; nested exception is
> java.lang.ClassNotFoundException:
> org
> .sakaiproject.coursemanagement.impl.CourseManagementServiceFederatedImpl
> Caused by:
> org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
> find class
> [org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceFederatedImpl] for bean
> with name
> 'org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceFederatedImpl#f57993'
> defined in file [/usr/local/tomcat/components/test/WEB-INF/application-
> context-test.xml]; nested exception is
> java.lang.ClassNotFoundException:
> org
> .sakaiproject.coursemanagement.impl.CourseManagementServiceFederatedImpl
> Caused by:
> java.lang.ClassNotFoundException:
> org
> .sakaiproject.coursemanagement.impl.CourseManagementServiceFederatedImpl
> .
> .
> .
>
>
>  What did I miss in the transition?  Where do I find
> "CourseManagementServiceFederatedImpl"?
>
> I am using Sakai 2.5.1.  I have beans defined in /usr/local/tomcat/
> components/test/WEB-INF/application-context-test.xml as:
>
>        <bean id="courseManagementService" parent="cmTxTemplate">
>         <property name="target">
>             <bean
> class
> =
> "org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceFederatedImpl">
>                <property name="implList">
>                        <!-- List the implementations here, in descending order
> of authority -->
>                        <list>
>                                    <!--
>                                        For testing, we use an impl that returns no data.
>                                        Replace this sample chained impl with your custom
> impl, if any.
>                                    -->
>                                    <bean
> class
> =
> "org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceSampleChainImpl"/>
>
>                                <!-- The internal, hibernate-backed implementation -->
>                                                <bean
> class
> =
> "org
> .sakaiproject
> .coursemanagement.impl.CourseManagementServiceHibernateImpl">
>                                                        <property name="sessionFactory"><ref bean="cmSessionFactory"/></
> property>
>                                                </bean>
>                                        </list>
>                </property>
>             </bean>
>         </property>
>        </bean>
>
> I don't understand why the same code and xml  word as a tool but is
> not as a Job.  Ideas?
> ----------------------------------------------------------
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>



-- 
Aaron Zeckoski (aaronz at vt.edu)
Senior Research Engineer - CARET - Cambridge University
[http://bugs.sakaiproject.org/confluence/display/~aaronz/]
Sakai Fellow - [http://aaronz-sakai.blogspot.com/]


More information about the sakai-dev mailing list