[Building Sakai] ClassCastException implementing CourseGradesToSpreadsheetConverter

Bryan Holladay holladay at longsight.com
Thu Aug 18 08:00:49 PDT 2011


Thats what it sounds like... it may not be solvable w/o modifying the
GB code.  I don't know if anyone has done this since the separation of
edu-services.  If you feel like sharing, you can send over the patch
and see if I can see something (or some one else on the list) that
stands out.

-Bryan


On Thu, Aug 18, 2011 at 10:41 AM, Gross,Christopher <ufchrisg at ufl.edu> wrote:
> I have limited it down to class loaders, as I believe you mentioned
> previously. The spreadsheet converter plugin is being deployed as a
> component, which is in a different class loader than the gradebook tool. I
> thoroughly fried my brain wrapping my head around this and I may still be
> wrong but I am at least mostly certain that it is a class loader issue.
> However, that does not change the fact that I do not know how to actually
> correct it in this case without touching the gradebook tool's code.
>
> -Chris
>
> On 8/17/11 2:28 PM, "Bryan Holladay" <holladay at longsight.com> wrote:
>
>>I just ran into this issue again today... I seriously just copied a
>>Class Cast line of code from a line above it and it complained...  I
>>was able to fix it by building edu-services_trunk in my own tomcat,
>>then building gradebook again.  I think it's an issue w/the
>>edu-service dependency jar's being compiled w/a different compiler.
>>
>>-Bryan
>>
>>On Wed, Aug 17, 2011 at 1:41 PM, Gross,Christopher <ufchrisg at ufl.edu>
>>wrote:
>>> Your emails gave me one idea, and that was to remove the
>>> <scope>provided</scope> from the following dependency in the pom.xml for
>>> both converters:
>>>
>>> <dependency>
>>>        <groupId>org.sakaiproject.edu-services.gradebook</groupId>
>>>        <artifactId>gradebook-service-hibernate</artifactId>
>>>        <scope>provided</scope>
>>> </dependency>
>>>
>>> At the very least it did one thing I was expecting and that was it
>>>placed
>>> the gradebook-service-hibernate-1.1.2.jar in the WEB-INF/lib for the
>>> converters.  Unfortunately, this did not resolve the issue and the
>>> exception persists.
>>>
>>> -Chris
>>>
>>>
>>> On 8/17/11 10:28 AM, "Bryan Holladay" <holladay at longsight.com> wrote:
>>>
>>>>A recent example I ran into was
>>>>https://jira.sakaiproject.org/browse/SAM-1121
>>>>
>>>>Just adding this one line:
>>>>
>>>>Calendar calendar =
>>>>org.sakaiproject.calendar.cover.CalendarService.getCalendar("/calendar/c
>>>>al
>>>>endar/"
>>>>+ siteId + "/main");
>>>>
>>>>Threw this exception:
>>>>
>>>>Bean named 'org.sakaiproject.calendar.api.CalendarService' must be of
>>>>type [org.sakaiproject.calendar.api.CalendarService], but was actually
>>>>of type [org.sakaiproject.calendar.impl.DbCalendarService]
>>>>
>>>>
>>>>You can look at my patch to get an idea of an approach to take
>>>>(hopefully).  It basically comes down to: move it to a different part
>>>>of the architecture.
>>>>
>>>>-Bryan
>>>>
>>>>
>>>>On Wed, Aug 17, 2011 at 10:23 AM, Bryan Holladay
>>>><holladay at longsight.com>
>>>>wrote:
>>>>> This is an issue I see a lot.  It basically comes down to this:
>>>>>
>>>>> "The class objects were loaded in different classloaders, therefore
>>>>> the instances created from in each of classes are seen as
>>>>> 'incompatible'. This is a common issue in a an environment where there
>>>>> are many different classloaders being used and objects are being
>>>>> passed around. These issues can easily arise in JEE and portal
>>>>> environments."
>>>>>
>>>>> -Source: Internet/Google
>>>>>
>>>>>  just throwing out quick ideas w/o knowing how your code is set up:
>>>>>
>>>>> Try to implement this in the same layer as the API or don't import
>>>>> jars, but instead use what's already there or access it from
>>>>> Edu-services if that's where it's create, ect...
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Bryan
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Aug 17, 2011 at 10:12 AM, Gross,Christopher <ufchrisg at ufl.edu>
>>>>>wrote:
>>>>>> The jars are there (the converters appear in tomcat/components/).
>>>>>> Besides, a missing jar would likely give me some problems when tomcat
>>>>>>is
>>>>>> starting up and/or result in a bean failing to initialize.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> -Chris
>>>>>>
>>>>>> On 8/17/11 4:26 AM, "DAVID ROLDAN MARTINEZ" <darolmar at upvnet.upv.es>
>>>>>>wrote:
>>>>>>
>>>>>>>I suggest checking if you have all the *.jar you need available.
>>>>>>>
>>>>>>>Hope this helps.
>>>>>>>
>>>>>>>David
>>>>>>>________________________________________
>>>>>>>De: sakai-dev-bounces at collab.sakaiproject.org
>>>>>>>[sakai-dev-bounces at collab.sakaiproject.org] En nombre de
>>>>>>>Gross,Christopher [ufchrisg at ufl.edu]
>>>>>>>Enviado el: martes, 16 de agosto de 2011 22:54
>>>>>>>Para: sakai-dev at collab.sakaiproject.org
>>>>>>>Asunto: [Building Sakai] ClassCastException implementing
>>>>>>>CourseGradesToSpreadsheetConverter
>>>>>>>
>>>>>>>Hello!
>>>>>>>
>>>>>>>We are attempting to create our own implementation of the
>>>>>>>CourseGradesToSpreadsheetConverter interface (gradebook service),
>>>>>>>however
>>>>>>>we are receiving a ClassCastException when attempting to export
>>>>>>>course
>>>>>>>grades from the gradebook tool. To ensure this was not a problem in
>>>>>>>our
>>>>>>>code we set gradebook.coursegrades.converter to
>>>>>>>"org.sakaiproject.gradebooksample.CourseGradesToSpreadsheetConverterS
>>>>>>>am
>>>>>>>ple
>>>>>>>"
>>>>>>> in sakai.properties, which is the sample that is included in the
>>>>>>>gradebook tool's source. The result is that both implementations are
>>>>>>>causing the same ClassCastException when a user attempts to export
>>>>>>>the
>>>>>>>course grades in the gradebook.
>>>>>>>
>>>>>>>This setup is using gradebook 2.8.x and edu-services 1.1.x
>>>>>>>
>>>>>>>A small snippet of the output is below.
>>>>>>>
>>>>>>>I am hoping that someone may see something that I am not or will
>>>>>>>confirm
>>>>>>>that this is something that needs to be submitted to the JIRA.
>>>>>>>
>>>>>>>Thanks!
>>>>>>>
>>>>>>>----
>>>>>>>
>>>>>>>2011-08-16 16:28:05.634 [ERROR]
>>>>>>>org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sakai
>>>>>>>-g
>>>>>>>rad
>>>>>>>e
>>>>>>>book-tool].[sakai.gradebook.tool]:691 - Servlet.service() for servlet
>>>>>>>sakai.gradebook.tool threw exception
>>>>>>>java.lang.ClassCastException:
>>>>>>>org.sakaiproject.gradebooksample.CourseGradesToSpreadsheetConverterSa
>>>>>>>mp
>>>>>>>le
>>>>>>>cannot be cast to
>>>>>>>org.sakaiproject.tool.gradebook.CourseGradesToSpreadsheetConverter
>>>>>>>        at
>>>>>>>org.sakaiproject.tool.gradebook.ui.CourseGradeDetailsBean.getSpreadsh
>>>>>>>ee
>>>>>>>tDa
>>>>>>>t
>>>>>>>a(CourseGradeDetailsBean.java:322)
>>>>>>>        at
>>>>>>>org.sakaiproject.tool.gradebook.ui.CourseGradeDetailsBean.exportCsv(C
>>>>>>>ou
>>>>>>>rse
>>>>>>>G
>>>>>>>radeDetailsBean.java:296)
>>>>>>>...
>>>>>>>
>>>>>>>
>>>>>>>--
>>>>>>>
>>>>>>>Christopher Gross
>>>>>>>University of Florida
>>>>>>>
>>>>>>>_______________________________________________
>>>>>>>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"
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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"
>>>>>>
>>>>>
>>>
>>>
>
>


More information about the sakai-dev mailing list