Page 1 of 1

Migrating from in memory database to Oracle11g (11.2.0)

Posted: Tue Oct 30, 2012 10:22 am
by obedmhg@gmail.com
Hi All,

I am starting Broadleaf Commerce Demo with oracle 11g, and I am almost able to, but I have a problem with a class cast exception, here is the stack trace:

Hibernate: select ID_VAL from SEQUENCE_GENERATOR where ID_NAME = 'OrderImpl'
[ERROR] 07:52:33 ContextLoader - Context initialization failed
java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.math.BigInteger
at org.broadleafcommerce.common.persistence.SequenceGeneratorCorruptionDetection.onApplicationEvent(SequenceGeneratorCorruptionDetection.java:127)
at org.broadleafcommerce.common.persistence.SequenceGeneratorCorruptionDetection.onApplicationEvent(SequenceGeneratorCorruptionDetection.java:47)
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:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy88.onApplicationEvent(Unknown Source)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:929)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.broadleafcommerce.common.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListener.java:42)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

And looking into SequenceGeneratorCorruptionDetection.java there is this line of code that tries to get a BigInteger from an oracle NUMBER

Code: Select all

Long maxSequenceId = ((BigInteger) results2.get(0)).longValue();


That is why is failing in my case, does any of you found a workaround for this?

Regards,
Obed

Re: Migrating from in memory database to Oracle11g (11.2.0)

Posted: Tue Oct 30, 2012 12:50 pm
by phillipuniverse
I created an issue to track this: http://jira.broadleafcommerce.org/browse/BLC-710

Which version of the framework are you on? In the mean time, you can disable this component by putting the following in your properties file:

Code: Select all

detect.sequence.generator.inconsistencies = false

Re: Migrating from in memory database to Oracle11g (11.2.0)

Posted: Tue Oct 30, 2012 12:52 pm
by phillipuniverse
In your stack trace it also looks like the line numbers cut off. Can you confirm that the line number is 127 where the ClassCastException occurs?

Re: Migrating from in memory database to Oracle11g (11.2.0)

Posted: Tue Oct 30, 2012 2:40 pm
by phillipuniverse
This has been resolved. The fix is in 2.0.2-SNAPSHOT as well as 2.1 and 2.2 snapshots.

Re: Migrating from in memory database to Oracle11g (11.2.0)

Posted: Wed Oct 31, 2012 10:02 am
by obedmhg@gmail.com
Thank you phillip,

That worked just fine :D

Now I do not have to do any workaround in the database.

Regards,
Obed