-
1. Re: ClassCastException
rebody Apr 8, 2010 8:50 PM (in response to rdelarosa)1 of 1 people found this helpfulHi ricardo,
I think you should make sure if there is more than one ClassLoader could load the ProcessEngineImpl class. It looks like the ProcessEngineImpl being loaded twice so it can't be cast from a ClassLoader to another one.
cheers.
-
2. Re: ClassCastException
neshap Apr 9, 2010 5:54 AM (in response to rdelarosa)1 of 1 people found this helpfulHi ricardo,
Huisheng Xu is right, check for classloading. Can you provide more information about how do you load ProcessEngine or scenario in which error occurs?
-
3. Re: ClassCastException
rdelarosa Apr 10, 2010 1:09 PM (in response to neshap)Hi Nenad ,
Where can I find more information about how do I load ProcessEngine ?
___
I changed the code to the following equivalent code:
Configuration configuration = new Configuration();
configuration = configuration.setResource("jbpm.cfg.xml");processEngine = configuration.buildProcessEngine();
___
The exception thrown is:
java.lang.ClassCastException: org.jbpm.pvm.internal.processengine.ProcessEngineImpl cannot be cast to
at org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(ConfigurationImpl.java:81)
at co.com.gestiontek.supercade.util.ManejadorJBPM4.<init>(ManejadorJBPM4.java:52)
at co.com.gestiontek.supercade.action.workflow.RegistroTramite.init(RegistroTramite.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)_____________________________________
The content of the file named "jbpm.cfg.xml" is the following:
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration jndi-name="java:/ProcessEngine">
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.hibernate.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" /></jbpm-configuration>
_______
Thank you in advance,
Ricardo
-
4. Re: ClassCastException
rdelarosa Apr 10, 2010 1:12 PM (in response to rebody)Hi Huisheng Xu ,
Where can I find more information about how do I load ProcessEngine ?
___
I changed the code to the following equivalent code:Configuration configuration = new Configuration();
configuration = configuration.setResource("jbpm.cfg.xml");processEngine = configuration.buildProcessEngine();
___The exception thrown is:
java.lang.ClassCastException: org.jbpm.pvm.internal.processengine.ProcessEngineImpl cannot be cast to
at org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(ConfigurationImpl.java:81)
at co.com.gestiontek.supercade.util.ManejadorJBPM4.<init>(ManejadorJBPM4.java:52)
at co.com.gestiontek.supercade.action.workflow.RegistroTramite.init(RegistroTramite.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)_____________________________________
The content of the file named "jbpm.cfg.xml" is the following:
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration jndi-name="java:/ProcessEngine">
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.hibernate.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" /></jbpm-configuration>
_______
Thank you in advance,
Ricardo
-
5. Re: ClassCastException
swiderski.maciej Apr 11, 2010 5:00 AM (in response to rdelarosa)Hi,
just make sure that you don't have multiple jbpm installation on your server. For instance, if you installed jbpm in JBoss following user guide and you developed your own application that embed jbpm this can probably cause ClassCastException.
In that scenario you don't need to create process engine any more. You could look it up from JNDI.
Another way is to have only jbpm embedded in your application and not deploy it as separate service.
HTH
Maciej
-
6. Re: ClassCastException
neshap Apr 12, 2010 8:17 AM (in response to rdelarosa)Hi ricardo,
Like maciej pointed out, check for multiple instances of jbpm if you are deploying it on AS. Also to add to his post, if you use Jboss and use jbpm as service in your application, check how you bind and unbind ProcessEngine to JNDI (I'm not sure whether the supplied service jbpm-jboss5.jar is properly written). This can cause classcast exceptions on application hot deploy.
-
7. Re: ClassCastException
rdelarosa Apr 12, 2010 10:42 AM (in response to swiderski.maciej)Macied and Nenad: thank you for your responses, they help me to solve the problem.
Effectively, the error is that jbpm.jar is present twice in the deployment environment. The first occurrence is in the directory "jboss-5.0.0.GA\server\default\deploy\jbpm\jbpm-service.sar". The second occurrence is inside the .ear file of my application.
To solve the problem, I deleted the second occurrence from the .ear file.
Besides, I added the class containing "configuration.buildEngine()" to the first occurrence of jbpm.jar.
Thank you for helping me,
Ricardo.