This code adds getBean() methods to the classes we are using:
clazz.metaClass.getBean = { String name ->
return VaadinUtils.getBean(name)
}
clazz.metaClass.getBean = { Class type ->
return VaadinUtils.getBean(type)
}
It works without problem when the application is started and it also survives few recompilations. Recompilation is done like this:
def reloadedClass = application.classLoader.loadClass(vaadinGrailsClass.clazz.name)
After few recompilations, it says that getBean() method is missing and the exception is thrown (so one has to restart and redeploy the application under development).
Caused by MissingMethodException: No signature of method:
com.myapp.SaveIssueDetailListener.getBean() is applicable for argument types:
(java.lang.Class) values: [class agiletool.core.IssueService]
Possible solutions: getClass(), getForm(), getAt(java.lang.String)
->> 30 buttonClick in com.myapp.SaveIssueDetailListener$$ENRHmYFM
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
512 receiveEvent in com.vaadin.event.ListenerMethod
164 fireEvent . . . . . in com.vaadin.event.EventRouter
1219 fireEvent in com.vaadin.ui.AbstractComponent
550 fireClick . . . . . in com.vaadin.ui.Button
217 changeVariables in ''
1451 changeVariables . . in com.vaadin.terminal.gwt.server.AbstractCommunicationManager
1399 handleVariableBurst in ''
1318 handleVariables . . in ''
763 doHandleUidlRequest in ''
296 handleUidlRequest . in com.vaadin.terminal.gwt.server.CommunicationManager
501 service in com.vaadin.terminal.gwt.server.AbstractApplicationServlet
191 service . . . . . . in com.vaadin.terminal.gwt.server.GrailsAwareApplicationServlet
886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
908 run . . . . . . . . in ''
680 run in java.lang.Thread
This is how we call the getBean() method:
public void buttonClick(ClickEvent event) {
UserService userService = getBean(UserService) //...
Any idea what might be wrong?
The problem occurs only in old versions of plugin for Vaadin 6. Vaadin plugin (for Vaadin 7) for Grails has been done from scratch and this issue doesn’t exist there.
More info can be found in related JIRA issue.
More details about new Vaadin can be found on http://vaadinongrails.com/