[MAGNOLIA-1392] ClassCastException in openwfe when a filter sets a request parameter with value "true" Created: 20/Feb/07  Updated: 23/Jan/13  Resolved: 15/Nov/07

Status: Closed
Project: Magnolia
Component/s: workflow
Affects Version/s: 3.0.1
Fix Version/s: 3.5 RC1

Type: Bug Priority: Critical
Reporter: Fabrizio Giustina Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
duplicates MAGNOLIA-1797 Can't proceed workflow : ClassCastExc... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Not sure if this should be handled in openwfe or if it should be handled in magnolia.
If a filter sets a request attribute with value "true" (as a string, not a boolean) workflow doesn't work anymore: the following stacktrace is what happens when doing an activation:
(spring filters always set this attribute...)

ERROR info.magnolia.module.workflow.WorkflowUtil WorkflowUtil.java(proceed:172) 20.02.2007 14:20:51 Error while accessing the workflow engine
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at openwfe.org.engine.workitem.BooleanAttribute.booleanValue(BooleanAttribute.java:94)
at openwfe.org.engine.workitem.BooleanAttribute.clone(BooleanAttribute.java:99)
at openwfe.org.engine.workitem.MapAttribute.clone(MapAttribute.java:215)
at openwfe.org.engine.workitem.MapAttribute.clone(MapAttribute.java:206)
at openwfe.org.engine.workitem.InFlowWorkItem.clone(InFlowWorkItem.java:224)
at openwfe.org.engine.expressions.SubProcessRefExpression.doLaunch(SubProcessRefExpression.java:627)
at openwfe.org.engine.expressions.SubProcessRefExpression.innerLaunch(SubProcessRefExpression.java:549)
at openwfe.org.engine.expressions.SubProcessRefExpression.apply(SubProcessRefExpression.java:268)
at openwfe.org.engine.expressions.raw.RawExpression.apply(RawExpression.java:371)
at openwfe.org.engine.expressions.state.NormalState.apply(NormalState.java:112)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.applyOrLaunch(SimpleExpressionPool.java:529)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:542)
at openwfe.org.engine.expressions.IfExpression.applyConsequence(IfExpression.java:254)
at openwfe.org.engine.expressions.IfExpression.apply(IfExpression.java:144)
at openwfe.org.engine.expressions.raw.RawExpression.apply(RawExpression.java:371)
at openwfe.org.engine.expressions.state.NormalState.apply(NormalState.java:112)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.applyOrLaunch(SimpleExpressionPool.java:529)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:542)
at openwfe.org.engine.expressions.SequentialFlowExpression.apply(SequentialFlowExpression.java:140)
at openwfe.org.engine.expressions.state.NormalState.apply(NormalState.java:112)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.applyOrLaunch(SimpleExpressionPool.java:529)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:542)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:554)
at openwfe.org.engine.expressions.SequenceExpression.reply(SequenceExpression.java:130)
at openwfe.org.engine.expressions.state.NormalState.reply(NormalState.java:118)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.reply(SimpleExpressionPool.java:713)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.replyToParent(SimpleExpressionPool.java:644)
at openwfe.org.engine.expressions.AbstractFlowExpression.replyToParent(AbstractFlowExpression.java:479)
at openwfe.org.engine.expressions.AbstractFlowExpression.applyToParent(AbstractFlowExpression.java:494)
at openwfe.org.engine.expressions.LogExpression.apply(LogExpression.java:153)
at openwfe.org.engine.expressions.raw.RawExpression.apply(RawExpression.java:371)
at openwfe.org.engine.expressions.state.NormalState.apply(NormalState.java:112)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.applyOrLaunch(SimpleExpressionPool.java:529)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:542)
at openwfe.org.engine.expressions.SequentialFlowExpression.apply(SequentialFlowExpression.java:140)
at openwfe.org.engine.expressions.state.NormalState.apply(NormalState.java:112)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.applyOrLaunch(SimpleExpressionPool.java:529)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:542)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:554)
at openwfe.org.engine.expressions.SequenceExpression.reply(SequenceExpression.java:130)
at openwfe.org.engine.expressions.state.NormalState.reply(NormalState.java:118)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.reply(SimpleExpressionPool.java:713)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.replyToParent(SimpleExpressionPool.java:644)
at openwfe.org.engine.expressions.AbstractFlowExpression.replyToParent(AbstractFlowExpression.java:479)
at openwfe.org.engine.expressions.IfExpression.applyConsequence(IfExpression.java:260)
at openwfe.org.engine.expressions.IfExpression.apply(IfExpression.java:144)
at openwfe.org.engine.expressions.raw.RawExpression.apply(RawExpression.java:371)
at openwfe.org.engine.expressions.state.NormalState.apply(NormalState.java:112)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.applyOrLaunch(SimpleExpressionPool.java:529)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:542)
at openwfe.org.engine.expressions.SequentialFlowExpression.apply(SequentialFlowExpression.java:140)
at openwfe.org.engine.expressions.state.NormalState.apply(NormalState.java:112)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.applyOrLaunch(SimpleExpressionPool.java:529)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:542)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.apply(SimpleExpressionPool.java:554)
at openwfe.org.engine.expressions.SequenceExpression.reply(SequenceExpression.java:130)
at openwfe.org.engine.expressions.state.NormalState.reply(NormalState.java:118)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.reply(SimpleExpressionPool.java:713)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.replyToParent(SimpleExpressionPool.java:644)
at openwfe.org.engine.expressions.AbstractFlowExpression.replyToParent(AbstractFlowExpression.java:479)
at openwfe.org.engine.expressions.OneOrZeroChildExpression.reply(OneOrZeroChildExpression.java:92)
at openwfe.org.engine.expressions.ParticipantExpression.reply(ParticipantExpression.java:655)
at openwfe.org.engine.expressions.state.NormalState.reply(NormalState.java:118)
at openwfe.org.engine.impl.expool.SimpleExpressionPool.reply(SimpleExpressionPool.java:713)
at openwfe.org.embed.impl.engine.AbstractEngine.reply(AbstractEngine.java:264)
at info.magnolia.module.workflow.WorkflowUtil.proceed(WorkflowUtil.java:169)
at info.magnolia.module.workflow.WorkflowUtil.proceed(WorkflowUtil.java:152)
at info.magnolia.module.workflow.WorkflowUtil.proceed(WorkflowUtil.java:129)
at info.magnolia.module.workflow.inbox.Inbox.proceed(Inbox.java:259)
at java.lang.reflect.Method.invoke(Method.java:597)
at info.magnolia.cms.servlets.MVCServletHandlerImpl.execute(MVCServletHandlerImpl.java:96)
at info.magnolia.cms.servlets.CommandBasedMVCServletHandler.execute(CommandBasedMVCServletHandler.java:66)
at info.magnolia.cms.servlets.MVCServlet.doPost(MVCServlet.java:111)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)



 Comments   
Comment by Fabrizio Giustina [ 20/Feb/07 ]

quick fix in openwfe:

openwfe.org.engine.workitem.BooleanAttribute

public boolean booleanValue()
{
if (this.value instanceof String)

{ return Boolean.parseBoolean((String) this.value); }

return ((Boolean) this.value).booleanValue();
}

still checking if it could be a problem in how magnolia sets workitem attributes

Comment by John Mettraux [ 20/Feb/07 ]

checked in into OpenWFE svn.

Thanks,

John

Comment by Fabrizio Giustina [ 20/Feb/07 ]

thanks John!

I had a deeper look at BooleanAttribute and it seems that the only way you can set an invalid (non boolean) internal value is by using the setter method inherited by AtomicAttribute. This is why you ends up with a String value in magnolia (it doesn't use the constructor but the getter).
A better way to definitively fix it is to override the setValue() method in order to be sure that value is always a boolean... this is what I would add in BooleanAttribute:

public void setValue(Object value)
{
if (value == null)

{ throw new IllegalArgumentException("Cannot set to a null value"); }

else

{ this.value = "true".equalsIgnoreCase(value.toString()); }

}

Comment by John Mettraux [ 20/Feb/07 ]

Hi Fabrizio,

I did that :

http://openwfe.svn.sourceforge.net/viewvc/openwfe/trunk/openwfe/openwfe-engine/src/main/java/openwfe/org/engine/workitem/BooleanAttribute.java?r1=3087&r2=3627

which should be roughly equal to your suggestion.

Thanks to you.

Comment by Django [ 07/Mar/07 ]

I'm having the same exception on one particular machine. When I extract the Magnolia bundle (3, 3rc3, 3.0.1) and try to activate an arbitrary page I got a
ERROR info.magnolia.module.workflow.WorkflowUtil WorkflowUtil.java(proceed:172) 07.03.2007 09:57:28 Error while accessing the workflow engine
java.lang.ClassCastException: java.lang.String
at openwfe.org.engine.workitem.IntegerAttribute.intValue(IntegerAttribute.java:103)
at openwfe.org.engine.workitem.IntegerAttribute.clone(IntegerAttribute.java:108)
at openwfe.org.engine.workitem.MapAttribute.clone(MapAttribute.java:215)
at openwfe.org.engine.workitem.MapAttribute.clone(MapAttribute.java:206)
at openwfe.org.engine.workitem.InFlowWorkItem.clone(InFlowWorkItem.java:224)
at openwfe.org.engine.expressions.SubProcessRefExpression.doLaunch(SubProcessRefExpression.java:627)
...
ERROR info.magnolia.module.workflow.jcr.JCRWorkItemAPI JCRWorkItemAPI.java(getWorkItemById:153) 07.03.2007 09:57:28 get work item by id failed, path = activation/j0.0.2/44/1173257835044/activate/0.0.4.0
javax.jcr.PathNotFoundException: activation/j0.0.2/44/1173257835044/activate/0.0.4.0
at org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:2369)
at info.magnolia.cms.core.Content.<init>(Content.java:109)
at info.magnolia.cms.core.HierarchyManager.getContent(HierarchyManager.java:253)
at info.magnolia.module.workflow.jcr.JCRWorkItemAPI.getWorkItemById(JCRWorkItemAPI.java:150)
...

The same installation works fine on other machines.

I tried to replace the openwfe engine jar by one build from the head but then I get an continuing dump of
INFO: Illegal access: this web application instance has been stopped already (the eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact)
Mar 7, 2007 12:36:57 PM org.apache.catalina.loader.WebappClassLoader loadClass

So is there a hint on how to work around the problem. What 'true' is causing the problem? Is it something machine specific? Something I did wrong? Please help. Our company wants to use Magnolia and I need to get this environment up and running. It is blocking me for a while now.

Cheers

Comment by John Mettraux [ 07/Mar/07 ]

Hi Django, Hi Fabrizio,

I will tighten the IntegerAttribute and all the other attributes as we did for the BooleanAttribute.

Too bad I haven't the time now to fix the cause common to all attributes.

Stay tuned,

John

Comment by John Mettraux [ 08/Mar/07 ]

OK,

code tightened

svn 3630

SNAPSHOT jars uploaded. direct link : http://maven.openwfe.org/snapshots/org/openwfe/openwfe-engine/1.7.3-SNAPSHOT/openwfe-engine-1.7.3-20070308.091235-10.jar

Best regards,

John

Comment by Django [ 08/Mar/07 ]

Hi John,

Unfortunately this does not work for me. After replacing the jars magnolia doesn't start up:
INFO info.magnolia.cms.beans.config.ModuleLoader ModuleLoader.java(load:147) 08.03.2007 19:44:44 start initialization of module workflow
INFO info.magnolia.module.workflow.WorkflowModule WorkflowModule.java(startEngine:106) 08.03.2007 19:44:44 Starting openwfe engine
Mar 8, 2007 7:44:44 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Mar 8, 2007 7:44:44 PM org.apache.catalina.core.StandardContext start
SEVERE: Context startup failed due to previous errors
INFO info.magnolia.cms.beans.config.ShutdownManager ShutdownManager.java(contextDestroyed:82) 08.03.2007 19:44:44 Executing shutdown tasks
INFO info.magnolia.cms.beans.config.ModuleLoader ModuleLoader.java(execute:165) 08.03.2007 19:44:44 Shutting down module: samples
INFO info.magnolia.cms.beans.config.ModuleLoader ModuleLoader.java(execute:165) 08.03.2007 19:44:44 Shutting down module: mail
INFO info.magnolia.cms.beans.config.ModuleLoader ModuleLoader.java(execute:165) 08.03.2007 19:44:44 Shutting down module: templating
INFO info.magnolia.cms.beans.config.ModuleLoader ModuleLoader.java(execute:165) 08.03.2007 19:44:44 Shutting down module: dms
INFO info.magnolia.cms.beans.config.ModuleLoader ModuleLoader.java(execute:165) 08.03.2007 19:44:44 Shutting down module: cache
INFO info.magnolia.cms.cache.BaseCacheManager BaseCacheManager.java(stop:228) 08.03.2007 19:44:44 Stopping CacheManager...
INFO info.magnolia.cms.cache.BaseCacheManager BaseCacheManager.java(stop:240) 08.03.2007 19:44:44 CacheManager is now stopped.
INFO info.magnolia.cms.beans.config.ModuleLoader ModuleLoader.java(execute:165) 08.03.2007 19:44:44 Shutting down module: adminInterface
INFO info.magnolia.jackrabbit.ProviderImpl ProviderImpl.java(execute:188) 08.03.2007 19:44:44 Shutting down repository bound to 'magnoliaPublic'
Shutting down Log4J

And after that there is an continuing error:
INFO: Illegal access: this web application instance has been stopped already (the eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact)
Mar 8, 2007 7:45:44 PM org.apache.catalina.loader.WebappClassLoader loadClass

Is there any hint on what integer is causing the underlying problem I have on this particular machine?

Comment by Django [ 09/Mar/07 ]

Hi John,

I'm not sure my comments are really related directly to this issue. My actual problem is that magnolia activation is not working on SuSE 10.x. (I accidentally used SuSE because I had a boot CD around). I now use Ubuntu and activation works fine.

Cheers

Django

Comment by Fabrizio Giustina [ 22/Apr/07 ]

Setting fix version to 3.1 to remember that we neet to upgrade to openwfe 1.7.3 in order to have this fixed, hoping that a new openwfe release is out before we are ready to release magnolia 3.1

Comment by Magnolia International [ 25/Oct/07 ]

Actually this is really the same as in MAGNOLIA-1797. We'll branch of openwfe-1.7.2 and fix it there.
(Fabrizio's fix has been applied to the trunk, and similar fixes to the other XXXAttribute classes, but also another bunch of changes, including API changes, so we can't afford to migrate this now)

Comment by Magnolia International [ 02/Nov/07 ]

We branched openwfe-1.7.2 and just deployed 1.7.2.1-SNAPSHOTs, which should fix this issue.

Comment by Magnolia International [ 15/Nov/07 ]

The update to openwfe to 1.7.2.1 fixes this.

Generated at Mon Feb 12 03:26:28 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.