Search the FirstSpirit Knowledge Base
Hello Community,
working on a FirstSpirit plattform version 4.2.446 I'm facing the following issue:
Given a custom SwingGadget that uses a server side custom service.
Both implementations, the Gadget and the service, are deployed an run perfectly.
Then I try to access the service from within the gadget, using the following code:
SpecialistsBroker broker = context.getBroker();
ServicesBroker servicesBroker = broker.requireSpecialist(ServicesBroker.TYPE);
MyService service = servicesBroker.getService(MyService.class);
The last line of code leads to the following stack trace:
ERROR 16.12.2011 23:30:05.541 (de.espirit.firstspirit.client.AWTDispatchingEventQueue): Error during dispatching of java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=de.espirit.firstspirit.client.gui.applications.FormTabConfiguration$GomFormView$1@1803641,notifier=null,catchExceptions=false,when=1324074605385] on sun.awt.windows.WToolkit@1ed2ae8
FSVersion=4.2.446.45868#2522;JDK=1.6.0_29 32bit Sun Microsystems Inc.;OS=Windows 7 6.1 x86;Date=16.12.2011 23:30:05
java.lang.ClassCastException
at java.lang.Class.cast(Unknown Source)
at de.espirit.firstspirit.server.io.AbstractServiceLocator.getService(AbstractServiceLocator.java:83)
at de.espirit.firstspirit.server.io.AbstractServerConnection.getService(AbstractServerConnection.java:504)
at de.espirit.firstspirit.client.io.ProjectConnection.getService(ProjectConnection.java:114)
at de.espirit.firstspirit.agency.ServicesBrokerImpl.getService(ServicesBrokerImpl.java:30)
at com.mycompany.firstspirit.extranet.mygadget.MyControlControlSwingGadget.<init>(TaggingControlSwingGadget.java:48)
at com.mycompany.firstspirit.extranet.mygadget.MyControlSwingGadgetFactory.create(TaggingControlSwingGadgetFactory.java:15)
at de.espirit.firstspirit.ui.gadgets.swing.SwingGadgets.create(SwingGadgets.java:36)
at de.espirit.firstspirit.ui.gadgets.swing.ValueHoldingSwingGadgetMediator.<init>(ValueHoldingSwingGadgetMediator.java:234)
at de.espirit.firstspirit.ui.gadgets.swing.ValueHoldingSwingGadgetMediator._create(ValueHoldingSwingGadgetMediator.java:266)
at de.espirit.firstspirit.ui.gadgets.swing.ValueHoldingSwingGadgetMediator.create(ValueHoldingSwingGadgetMediator.java:259)
at de.espirit.firstspirit.ui.gadgets.swing.SwingGadgetMediatorFactory.create(SwingGadgetMediatorFactory.java:27)
at de.espirit.firstspirit.ui.gadgets.swing.AggregatingSwingGadgetMediator.getMediators(AggregatingSwingGadgetMediator.java:348)
at de.espirit.firstspirit.ui.gadgets.swing.AggregatingSwingGadgetMediator.setEditable(AggregatingSwingGadgetMediator.java:144)
at de.espirit.firstspirit.client.gui.SwingFormView.setEditable(SwingFormView.java:185)
at de.espirit.firstspirit.client.gui.SwingFormView$Builder.toView(SwingFormView.java:361)
at de.espirit.firstspirit.client.gui.SwingMultiFormView.getComponent(SwingMultiFormView.java:230)
at de.espirit.firstspirit.client.gui.tree.store.pagestore.GomModuleView.getComponent(GomModuleView.java:158)
at de.espirit.firstspirit.client.gui.GomModulePanel.getViewComponent(GomModulePanel.java:253)
at de.espirit.firstspirit.client.gui.GomModulePanel.initialize(GomModulePanel.java:146)
at de.espirit.firstspirit.client.gui.GomModulePanel$3.run(GomModulePanel.java:226)
at de.espirit.common.gui.EventDispatchThreadHelper.invokeLater(EventDispatchThreadHelper.java:78)
at de.espirit.firstspirit.client.gui.GomModulePanel.setVisibleLanguage(GomModulePanel.java:224)
at de.espirit.firstspirit.client.gui.applications.FormTabConfiguration$GomFormView$1.run(FormTabConfiguration.java:161)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at de.espirit.firstspirit.client.AWTDispatchingEventQueue.defaultDispatchEvent(AWTDispatchingEventQueue.java:130)
at de.espirit.firstspirit.client.AWTDispatchingEventQueue._dispatchEvent(AWTDispatchingEventQueue.java:122)
at de.espirit.firstspirit.client.AWTDispatchingEventQueue.dispatchEvent(AWTDispatchingEventQueue.java:108)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Any help highly appreciated.
Greetings,
Carsten
Are gadget and service deployed as separate modules? If so, are service classes included in the gadget module?
No, both are deployed in the same module.The Gadget as <public>-component, the service as <service>-component and the implementation of both (in the same jar-archive) as <ressource>.
Maybe the scopes of my components are wrong.
You get the error every time? If all classes are in a single jar I can't spot the mistake. You could file a request at our helpdesk if you don't mind providing the module (or a test case version of it).
Yes, I get the error every time. I'll try the helpdesk.
Do you have an example of a SwingGadget that connects to a service and receives some data?
This would help me a lot. The examples provided with the installation 4.2R4 contain a service and a SwingGadget, but not the required combination of both.
Greetings from stormy Hamburg,
Carsten Büchert