[ https://issues.apache.org/jira/browse/TAPESTRY-1423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490873 ]
Massimo Lusetti commented on TAPESTRY-1423: ------------------------------------------- Would you like to elaborate a little more on what you are meaning by install? Thanks. > Tapestry IoC fail to get the correct class from javassist.CtClass when the > instance is already a proxy > ------------------------------------------------------------------------------------------------------ > > Key: TAPESTRY-1423 > URL: https://issues.apache.org/jira/browse/TAPESTRY-1423 > Project: Tapestry > Issue Type: Bug > Components: tapestry-ioc > Affects Versions: 5.0.4 > Reporter: Massimo Lusetti > > Using tapestry-spring to wire spring beans and have spring (I'm using 2.x) > deal with hibernate entities and transaction management by AoP result in > having entities being a proxy class. > This cause, for example, the BeanEditForm to fail: > # java.lang.RuntimeException > Unable to add method java.lang.Object get(java.lang.Object) to class > $PropertyConduit_11214ae4ca6: [source error] no such class: > it.datacode.tapestry.t5js.entities.Clients$$EnhancerByCGLIB$$4429b0f8 > # javassist.CannotCompileException > [source error] no such class: > it.datacode.tapestry.t5js.entities.Clients$$EnhancerByCGLIB$$4429b0f8 > reason > [source error] no such class: > it.datacode.tapestry.t5js.entities.Clients$$EnhancerByCGLIB$$4429b0f8 > # javassist.compiler.CompileError > no such class: > it.datacode.tapestry.t5js.entities.Clients$$EnhancerByCGLIB$$4429b0f8 > Stack trace > * > javassist.compiler.MemberResolver.searchImports(MemberResolver.java:416) > * > javassist.compiler.MemberResolver.lookupClass(MemberResolver.java:392) > * > javassist.compiler.MemberResolver.lookupClassByJvmName(MemberResolver.java:310) > * > javassist.compiler.MemberResolver.resolveJvmClassName(MemberResolver.java:460) > * > javassist.compiler.MemberCodeGen.resolveClassName(MemberCodeGen.java:1064) > * javassist.compiler.CodeGen.atDeclarator(CodeGen.java:698) > * javassist.compiler.ast.Declarator.accept(Declarator.java:99) > * javassist.compiler.CodeGen.atStmnt(CodeGen.java:344) > * javassist.compiler.ast.Stmnt.accept(Stmnt.java:49) > * javassist.compiler.CodeGen.atStmnt(CodeGen.java:344) > * javassist.compiler.ast.Stmnt.accept(Stmnt.java:49) > * javassist.compiler.CodeGen.atMethodBody(CodeGen.java:285) > * javassist.compiler.Javac.compileBody(Javac.java:212) > * javassist.CtBehavior.setBody(CtBehavior.java:340) > * javassist.CtBehavior.setBody(CtBehavior.java:315) > * > org.apache.tapestry.ioc.internal.services.ClassFabImpl.addMethod(ClassFabImpl.java:218) > * > org.apache.tapestry.internal.services.PropertyConduitSourceImpl.buildGetter(PropertyConduitSourceImpl.java:227) > * > org.apache.tapestry.internal.services.PropertyConduitSourceImpl.build(PropertyConduitSourceImpl.java:114) > * > org.apache.tapestry.internal.services.PropertyConduitSourceImpl.create(PropertyConduitSourceImpl.java:75) > * > org.apache.tapestry.internal.beaneditor.BeanModelImpl.createConduit(BeanModelImpl.java:83) > * > org.apache.tapestry.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:67) > * > org.apache.tapestry.internal.services.BeanModelSourceImpl.create(BeanModelSourceImpl.java:95) > * > org.apache.tapestry.corelib.components.BeanEditForm.onPrepareFromForm(BeanEditForm.java:207) > * > org.apache.tapestry.corelib.components.BeanEditForm.handleComponentEvent(BeanEditForm.java) > * > org.apache.tapestry.internal.structure.ComponentPageElementImpl.handleEvent(ComponentPageElementImpl.java:895) > * > org.apache.tapestry.internal.structure.ComponentPageElementImpl.triggerEvent(ComponentPageElementImpl.java:1002) > * > org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.triggerEvent(InternalComponentResourcesImpl.java:141) > * > org.apache.tapestry.corelib.components.Form.beginRender(Form.java:223) > * org.apache.tapestry.corelib.components.Form.beginRender(Form.java) > * > org.apache.tapestry.internal.structure.ComponentPageElementImpl$10$1.run(ComponentPageElementImpl.java:345) > * > org.apache.tapestry.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:940) > * > org.apache.tapestry.internal.structure.ComponentPageElementImpl.access$100(ComponentPageElementImpl.java:69) > * > org.apache.tapestry.internal.structure.ComponentPageElementImpl$10.render(ComponentPageElementImpl.java:349) > * > org.apache.tapestry.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:57) > * > org.apache.tapestry.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:42) > * > org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:49) > * > org.apache.tapestry.internal.services.PageRenderDispatcher$1.renderPage(PageRenderDispatcher.java:82) > * > org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLinkHandlerImpl.java:89) > * > org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLinkHandlerImpl.java:49) > * > org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:91) > * > org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:1073) > * > it.datacode.tapestry.t5js.services.AppModule$1.service(AppModule.java:59) > So when the ioc get the CtClass should try to obtain the actual name of the > class discarding the proxy part. > This patch, actually an hack, fix the problem: > Index: src/main/java/org/apache/tapestry/ioc/services/ClassFabUtils.java > =================================================================== > --- src/main/java/org/apache/tapestry/ioc/services/ClassFabUtils.java > (revision 530468) > +++ src/main/java/org/apache/tapestry/ioc/services/ClassFabUtils.java > (working copy) > @@ -62,7 +62,9 @@ > public static String toJavaClassName(Class inputClass) > { > if (inputClass.isArray()) return > toJavaClassName(inputClass.getComponentType()) + "[]"; > - > + else if (inputClass.getName().indexOf("$$") != -1) > + return inputClass.getName().substring(0, > inputClass.getName().indexOf('$')); > + > return inputClass.getName(); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]