cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCastException at HibernateNodeDaoServiceImpl

flin
Champ in-the-making
Champ in-the-making
I'm running alfresco at my appplication and suddently the following error is thrown:




Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
   at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.getTxnUpdateCount(HibernateNodeDaoServiceImpl.java:1191)

It's this line of code:
Integer count = (Integer) getHibernateTemplate().execute(callback);

I just started the server and after some seconds some scheduled job throws it.


Anyone already got an error like this?

Full stack
14:54:09,715 ERROR [org.quartz.core.ErrorLogger.schedulerError(QuartzScheduler.java:2156)] Job (DEFAULT.org.springframework.scheduling.quartz.JobDetailBean#497934 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer]
   at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
   at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.getTxnUpdateCount(HibernateNodeDaoServiceImpl.java:1191)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.alfresco.repo.transaction.TransactionalDaoInterceptor.invoke(TransactionalDaoInterceptor.java:68)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy1.getTxnUpdateCount(Unknown Source)
   at org.alfresco.repo.node.index.AbstractReindexComponent.isTxnIdPresentInIndex(AbstractReindexComponent.java:289)
   at org.alfresco.repo.node.index.FullIndexRecoveryComponent.reindexImpl(FullIndexRecoveryComponent.java:135)
   at org.alfresco.repo.node.index.AbstractReindexComponent$1.doWork(AbstractReindexComponent.java:217)
   at org.alfresco.repo.transaction.TransactionUtil.executeInTransaction(TransactionUtil.java:176)
   at org.alfresco.repo.transaction.TransactionUtil.executeInUserTransaction(TransactionUtil.java:82)
   at org.alfresco.repo.node.index.AbstractReindexComponent.reindex(AbstractReindexComponent.java:221)
   at org.alfresco.repo.node.index.IndexRecoveryJob.execute(IndexRecoveryJob.java:31)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   … 1 more
10 REPLIES 10

derek
Star Contributor
Star Contributor
Hi,

That code was fixed quite a while back, if I recall correctly.  What version are you running?

Regards

flin
Champ in-the-making
Champ in-the-making
i'm running Alfresco 2.0.

I just got a difference here…

Alfresco's hibernate (3.2.1 right?) jar file is different (less packages and less classes) than the hibernate 3.2.1 I got from hibernate.org.

Is it a patched version?

derek
Star Contributor
Star Contributor
Hi,

The name of our Hibernate jar is incorrect.  Actually, Alfresco is using the 3.1.3.  You can check in the manifest file in the jar.  We have a branch with the Hibernate upgrade on.  One of the effects of the upgrade to Hibernate is the error you are seeing.  We've fixed that on the code branch.

The Hibernate upgrade, which turned out to be a lot more complicated than just updating the jar, will be coming to HEAD soon.  Ofcourse, we like to keep the project stable as a priority.

If you just change the code at that exception, you'll still not be able to run the app with 3.2.x of Hibernate.  There're a whole package of fixes that will come with it.

Regards

flin
Champ in-the-making
Champ in-the-making
Ahn, got it. When I saw it was using hibernate 3.2.1 (through the jar's name) I left my own hibernate jar in the project.

So far I had problems only with this job runing Alfresco Embedded in my project.

Is this job (org.alfresco.repo.node.index.IndexRecoveryJob) mandatory for alfresco to run correctly? I'm using only the most basic features like adding and searching content, no workflow or versions.
I can't rollback hibernate's version in my project right now.

If it is not mandatory, how I disable it?

derek
Star Contributor
Star Contributor
You're on your own if you use another jar.  It is not the only issue.  But set the index recovery mode to NONE.

flin
Champ in-the-making
Champ in-the-making
I know that it's my responsability.

I'll use this this way until a new version comes out.

Thanks!

derek
Star Contributor
Star Contributor
The Hibernate, Spring and other necessary fixes have just gone in.

flin
Champ in-the-making
Champ in-the-making
Ha! GREAT! Smiley Happy

I'll checkout the HEAD today. Thanks a lot!!!!!!

[]'s

xmaniac
Champ in-the-making
Champ in-the-making
The Hibernate, Spring and other necessary fixes have just gone in.
That's an important change indeed. Are you releasing it other than in SVN?