You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org> on 2007/11/09 20:41:50 UTC

[jira] Commented: (TAPESTRY-1898) Leaky Framework: cannot implement a method named 'getServlerContext()' on a Page component

    [ https://issues.apache.org/jira/browse/TAPESTRY-1898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541420 ] 

Howard M. Lewis Ship commented on TAPESTRY-1898:
------------------------------------------------

You're making some innacurate guesses about what's going on  Tapestry should not care about the method names.  Trust me, if it was a case of a reserved name, you would get a much better exception message!

The exception you are seeing appears to be related to JDK 1.6 bytecode generation, which the currently used version of Javassist does not seem to handle correctly.

We'll be upgrading to the latest stable version of Javassist shortly, it should be more capable of handling this code.

In the meantime, change your compiler to generate 1.5 bytecode and retry with the original name, it should work.

> Leaky Framework: cannot implement a method named 'getServlerContext()' on a Page component
> ------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1898
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1898
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.6
>         Environment: JDK 1.6
> Windows XP
>            Reporter: Ezra Epstein
>
> Leaky Framework: cannot implement a method named 'getServlerContext()' on a Page component.
> I've got a page that's working fine.  Was getting the ServletContext via an injected ApplicationGlobals and using the ApplicationGlobals within methods that needed the ServletContext.  Started to be a few methods needed it so I created a simple convenience method:
> 	@Inject
> 	@Service("ApplicationGlobals")
> 	private ApplicationGlobals applicationGlobals;
> 	protected ServletContext getServletContextObj() {
> 		return (applicationGlobals == null ? null : applicationGlobals.getServletContext());
> 	}
> And:
> org.apache.tapestry.internal.services.TransformationException
>  
> StackMapTable format error: bad class index
> transformation 
> InternalClassTransformation[
> public com.bar.baf.pages.UploadClip extends java.lang.Object
>   implements org.apache.tapestry.runtime.Component, org.apache.tapestry.runtime.RenderCommand
> add default method: public void postRenderCleanup()
> <default>
> add default method: public void setupRender(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public void beginRender(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public void beforeRenderTemplate(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public void afterRenderTemplate(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public void beforeRenderBody(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public void afterRenderBody(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public void afterRender(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public void cleanupRender(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.Event $2)
> <default>
> add default method: public boolean handleComponentEvent(org.apache.tapestry.runtime.ComponentEvent $1)
> <default>
> add default method: public org.apache.tapestry.ComponentResources getComponentResources()
> <default>
> add default method: public void containingPageDidLoad()
> <default>
> add default method: public void containingPageDidDetach()
> <default>
> add default method: public void containingPageDidAttach()
> <default>
> add field: protected final org.apache.tapestry.internal.InternalComponentResources _$resources;
> replace method: public final org.apache.tapestry.ComponentResources getComponentResources()
> return _$resources
> ...
> Turns out that getServletContext() is "reserved" by Tapestry.  I tried 
> protected abstract ServletContext getServletContext();
> But no dice. 
> Work-around:  changed the name of the method.  That worked.  Downside: the getServletContext() method name is the obvious /desirable one.
> Suggestion:  Prefer to have Tapestry not take over method names.  If it must, prefer to give them scoped names that aren't likely to be used by regular apps.  E.g.,  get/setTap5Foo (in general) and  getTap5ServletContext() (in particular).
> Thanks.

-- 
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: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org