Tapestry/Javassist reading the wrong class type

View: New views
4 Messages — Rating Filter:   Alert me  

Tapestry/Javassist reading the wrong class type

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have the following contrib:Table that reds a Set of users from the servletContext (they're added to it as they login to maintain a list of active users).

<table jwcid="table@contrib:Table" class="table contribTable" id="user"
    rowsClass="ognl:beans.rowsClass.next" row="ognl:row"
    columns="user.username:username, activeUsers.fullName:fullName"
    source="ognl:getServletContext().getAttribute('userNames')" initialSortColumn="username"
    arrowUpAsset="asset:upArrow" arrowDownAsset="asset:downArrow">
</table>

Even thought "userNames" is a list of User objects in the ServletContext, javassist doesn't seem to recognize that. It seems to cast it to its UserDetails interface instead of the User object. Any ideas how to fix this?

ERROR [btpool0-2] HiveMindExpressionCompiler.compileExpression(224) | Error generating OGNL statements for expression username with root org.appfuse.model.User@791a53[username=admin,enabled=false,accountExpired=false,credentialsExpired=false,accountLocked=false,Granted Authorities: ]
org.apache.hivemind.ApplicationRuntimeException: Unable to add method void set(ognl.OgnlContext, java.lang.Object, java.lang.Object) to class $ASTProperty_114b3aa67a1: [source error] setUsername(java.lang.String) not found in org.acegisecurity.userdetails.UserDetails
        at org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
        at org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression(HiveMindExpressionCompiler.java:214)
        at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
        at ognl.Ognl.compileExpression(Ognl.java:141)
        at org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(ExpressionCacheImpl.java:152)
        at org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression(ExpressionCacheImpl.java:115)
        at $ExpressionCache_114b3aa6746.getCompiledExpression($ExpressionCache_114b3aa6746.java)
        at org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.read(ExpressionEvaluatorImpl.java:108)
        at $ExpressionEvaluator_114b3aa6744.read($ExpressionEvaluator_114b3aa6744.java)
        at org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.getColumnValue(OgnlTableColumnEvaluator.java:59)

Thanks,

Matt

Re: Tapestry/Javassist reading the wrong class type

by Kalle Korhonen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Matt,

it's the OGNL expression compiler. It still works, you just see the
exception logged as OGNL switches to interpreted mode, right? I've reported
this issue as http://jira.opensymphony.com/browse/OGNL-115. Vote for the
issue and downgrade your OGNL to 2.6.7. I wouldn't get my hopes up that
anybody would fix it before Jesse comes back from his vacation...

Kalle


On 8/29/07, mraible <matt@...> wrote:

>
>
> I have the following contrib:Table that reds a Set of users from the
> servletContext (they're added to it as they login to maintain a list of
> active users).
>
> <table jwcid="table@contrib:Table" class="table contribTable" id="user"
>     rowsClass="ognl:beans.rowsClass.next" row="ognl:row"
>     columns="user.username:username, activeUsers.fullName:fullName"
>     source="ognl:getServletContext().getAttribute('userNames')"
> initialSortColumn="username"
>     arrowUpAsset="asset:upArrow" arrowDownAsset="asset:downArrow">
> </table>
>
> Even thought "userNames" is a list of User objects in the ServletContext,
> javassist doesn't seem to recognize that. It seems to cast it to its
> UserDetails interface instead of the User object. Any ideas how to fix
> this?
>
> ERROR [btpool0-2] HiveMindExpressionCompiler.compileExpression(224) |
> Error
> generating OGNL statements for expression username with root
> org.appfuse.model.User@791a53
> [username=admin,enabled=false,accountExpired=false,credentialsExpired=false,accountLocked=false,Granted
> Authorities: ]
> org.apache.hivemind.ApplicationRuntimeException: Unable to add method void
> set(ognl.OgnlContext, java.lang.Object, java.lang.Object) to class
> $ASTProperty_114b3aa67a1: [source error] setUsername(java.lang.String) not
> found in org.acegisecurity.userdetails.UserDetails
>         at
> org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
>         at
>
> org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression
> (HiveMindExpressionCompiler.java:214)
>         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
>         at ognl.Ognl.compileExpression(Ognl.java:141)
>         at
> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(
> ExpressionCacheImpl.java:152)
>         at
>
> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression
> (ExpressionCacheImpl.java:115)
>         at
>
> $ExpressionCache_114b3aa6746.getCompiledExpression($ExpressionCache_114b3aa6746.java)
>         at
> org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.read(
> ExpressionEvaluatorImpl.java:108)
>         at
>
> $ExpressionEvaluator_114b3aa6744.read($ExpressionEvaluator_114b3aa6744.java)
>         at
>
> org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.getColumnValue
> (OgnlTableColumnEvaluator.java:59)
>
> Thanks,
>
> Matt
> --
> View this message in context:
> http://www.nabble.com/Tapestry-Javassist-reading-the-wrong-class-type-tf4350783.html#a12396880
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

Re: Tapestry/Javassist reading the wrong class type

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Kalle - you are correct in that it still works.

Thanks,

Matt

Kalle Korhonen-2 wrote:
Matt,

it's the OGNL expression compiler. It still works, you just see the
exception logged as OGNL switches to interpreted mode, right? I've reported
this issue as http://jira.opensymphony.com/browse/OGNL-115. Vote for the
issue and downgrade your OGNL to 2.6.7. I wouldn't get my hopes up that
anybody would fix it before Jesse comes back from his vacation...

Kalle


On 8/29/07, mraible <matt@raibledesigns.com> wrote:
>
>
> I have the following contrib:Table that reds a Set of users from the
> servletContext (they're added to it as they login to maintain a list of
> active users).
>
> <table jwcid="table@contrib:Table" class="table contribTable" id="user"
>     rowsClass="ognl:beans.rowsClass.next" row="ognl:row"
>     columns="user.username:username, activeUsers.fullName:fullName"
>     source="ognl:getServletContext().getAttribute('userNames')"
> initialSortColumn="username"
>     arrowUpAsset="asset:upArrow" arrowDownAsset="asset:downArrow">
> </table>
>
> Even thought "userNames" is a list of User objects in the ServletContext,
> javassist doesn't seem to recognize that. It seems to cast it to its
> UserDetails interface instead of the User object. Any ideas how to fix
> this?
>
> ERROR [btpool0-2] HiveMindExpressionCompiler.compileExpression(224) |
> Error
> generating OGNL statements for expression username with root
> org.appfuse.model.User@791a53
> [username=admin,enabled=false,accountExpired=false,credentialsExpired=false,accountLocked=false,Granted
> Authorities: ]
> org.apache.hivemind.ApplicationRuntimeException: Unable to add method void
> set(ognl.OgnlContext, java.lang.Object, java.lang.Object) to class
> $ASTProperty_114b3aa67a1: [source error] setUsername(java.lang.String) not
> found in org.acegisecurity.userdetails.UserDetails
>         at
> org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
>         at
>
> org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression
> (HiveMindExpressionCompiler.java:214)
>         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
>         at ognl.Ognl.compileExpression(Ognl.java:141)
>         at
> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(
> ExpressionCacheImpl.java:152)
>         at
>
> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression
> (ExpressionCacheImpl.java:115)
>         at
>
> $ExpressionCache_114b3aa6746.getCompiledExpression($ExpressionCache_114b3aa6746.java)
>         at
> org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.read(
> ExpressionEvaluatorImpl.java:108)
>         at
>
> $ExpressionEvaluator_114b3aa6744.read($ExpressionEvaluator_114b3aa6744.java)
>         at
>
> org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.getColumnValue
> (OgnlTableColumnEvaluator.java:59)
>
> Thanks,
>
> Matt
> --
> View this message in context:
> http://www.nabble.com/Tapestry-Javassist-reading-the-wrong-class-type-tf4350783.html#a12396880
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Tapestry/Javassist reading the wrong class type

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried downgrading to OGNL 2.6.7 (I'm using Tapestry 4.1.3-SNAPSHOT). Unfortunately, I get the following error after this change:

java.lang.NoClassDefFoundError: ognl/enhance/ExpressionAccessor
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
        at java.lang.Class.privateGetPublicMethods(Class.java:2488)
        at java.lang.Class.getMethods(Class.java:1406)
        at org.apache.hivemind.service.MethodIterator.(MethodIterator.java:47)
        at org.apache.hivemind.impl.ProxyBuilder.addServiceMethods(ProxyBuilder.java:125)
        at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxyClass(SingletonServiceModel.java:183)
        at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy(SingletonServiceModel.java:102)
        at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getService(SingletonServiceModel.java:57)
        at org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:210)
        at org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:223)
        at org.apache.hivemind.impl.RegistryInfrastructureImpl.getService(RegistryInfrastructureImpl.java:207)
        at org.apache.hivemind.impl.ModuleImpl.getService(ModuleImpl.java:105)

Strangely enough, viewing the page that causes the javassist/ognl exception causes an OOM error when I'm running tests. If I remove the test, no OOM error. I'm using Canoo WebTest (built on top of HtmlUnit).

Matt

Kalle Korhonen-2 wrote:
Matt,

it's the OGNL expression compiler. It still works, you just see the
exception logged as OGNL switches to interpreted mode, right? I've reported
this issue as http://jira.opensymphony.com/browse/OGNL-115. Vote for the
issue and downgrade your OGNL to 2.6.7. I wouldn't get my hopes up that
anybody would fix it before Jesse comes back from his vacation...

Kalle


On 8/29/07, mraible <matt@raibledesigns.com> wrote:
>
>
> I have the following contrib:Table that reds a Set of users from the
> servletContext (they're added to it as they login to maintain a list of
> active users).
>
> <table jwcid="table@contrib:Table" class="table contribTable" id="user"
>     rowsClass="ognl:beans.rowsClass.next" row="ognl:row"
>     columns="user.username:username, activeUsers.fullName:fullName"
>     source="ognl:getServletContext().getAttribute('userNames')"
> initialSortColumn="username"
>     arrowUpAsset="asset:upArrow" arrowDownAsset="asset:downArrow">
> </table>
>
> Even thought "userNames" is a list of User objects in the ServletContext,
> javassist doesn't seem to recognize that. It seems to cast it to its
> UserDetails interface instead of the User object. Any ideas how to fix
> this?
>
> ERROR [btpool0-2] HiveMindExpressionCompiler.compileExpression(224) |
> Error
> generating OGNL statements for expression username with root
> org.appfuse.model.User@791a53
> [username=admin,enabled=false,accountExpired=false,credentialsExpired=false,accountLocked=false,Granted
> Authorities: ]
> org.apache.hivemind.ApplicationRuntimeException: Unable to add method void
> set(ognl.OgnlContext, java.lang.Object, java.lang.Object) to class
> $ASTProperty_114b3aa67a1: [source error] setUsername(java.lang.String) not
> found in org.acegisecurity.userdetails.UserDetails
>         at
> org.apache.tapestry.enhance.ClassFabImpl.addMethod(ClassFabImpl.java:278)
>         at
>
> org.apache.tapestry.services.impl.HiveMindExpressionCompiler.compileExpression
> (HiveMindExpressionCompiler.java:214)
>         at ognl.OgnlRuntime.compileExpression(OgnlRuntime.java:523)
>         at ognl.Ognl.compileExpression(Ognl.java:141)
>         at
> org.apache.tapestry.services.impl.ExpressionCacheImpl.parse(
> ExpressionCacheImpl.java:152)
>         at
>
> org.apache.tapestry.services.impl.ExpressionCacheImpl.getCompiledExpression
> (ExpressionCacheImpl.java:115)
>         at
>
> $ExpressionCache_114b3aa6746.getCompiledExpression($ExpressionCache_114b3aa6746.java)
>         at
> org.apache.tapestry.services.impl.ExpressionEvaluatorImpl.read(
> ExpressionEvaluatorImpl.java:108)
>         at
>
> $ExpressionEvaluator_114b3aa6744.read($ExpressionEvaluator_114b3aa6744.java)
>         at
>
> org.apache.tapestry.contrib.table.model.ognl.OgnlTableColumnEvaluator.getColumnValue
> (OgnlTableColumnEvaluator.java:59)
>
> Thanks,
>
> Matt
> --
> View this message in context:
> http://www.nabble.com/Tapestry-Javassist-reading-the-wrong-class-type-tf4350783.html#a12396880
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>