what is the wrong in my code..
Public MyServiceAsync my=GWT.create(MyService.class);
HTML serverResponseLabel = new HTML();
public void onModuleLoad() {
final Label errorLabel = new Label();
RootPanel rootPanel = RootPanel.get();
rootPanel.setSize("100%", "100%");
rootPanel.add(errorLabel);
serverResponseLabel=new HTML();
rootPanel.add(serverResponseLabel);
Button btnSearch = new Button("Search");
rootPanel.add(btnSearch, 558, 110);
btnSearch.setSize("63px", "29px");
btnSearch.addClickHandler(this);
}
#Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
System.out.println("clicked");
my.myMethod("ka",new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
serverResponseLabel.setHTML(SERVER_ERROR);
}
public void onSuccess(String result) {
serverResponseLabel.setHTML(result);
}
});
}
Sync
public interface MyService extends RemoteService {
public String myMethod(String s);
}
Async
public interface MyServiceAsync {
public void myMethod(String s, AsyncCallback<String> callback);
}
synImple
public class MyServiceImpl extends RemoteServiceServlet implements MyService {
public String myMethod(String s) {
return s+"example";
}
}
i am getting an uncaught exception escaped error.....
com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:214)
at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:96)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:155)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Unknown Source)
Caused by: com.google.gwt.user.client.rpc.ServiceDefTarget$NoServiceEntryPointSpecifiedException: Service implementation URL not specified
at com.google.gwt.user.client.rpc.impl.RemoteServiceProxy.doPrepareRequestBuilderImpl(RemoteServiceProxy.java:326)
at com.google.gwt.user.client.rpc.impl.RemoteServiceProxy.doInvoke(RemoteServiceProxy.java:265)
at com.test.test.client.MyService_Proxy.myMethod(MyService_Proxy.java:37)
at com.test.test.client.Test.onClick(Test.java:70)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:204)
at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:96)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:155)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Unknown Source)
You need to add #RemoteServiceRelativePath("some.path") to you interface.
See this tutorial.
When running your RPC call, development mode displays an exception NoServiceEntryPointSpecifiedException: Service implementation URL not specified. This error means that you did not specify a #RemoteServiceRelativePath in your service interface, and you also did not manually set target path by calling ServiceDefTarget.setServiceEntryPoint().
ServiceDefTarget target = (ServiceDefTarget) yourService;
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "yourpath");
Also note this one that's closely related to above one,
If invoking your RPC call fails with a 404 StatusCodeException, your web.xml may be misconfigured. Make sure you specified a #RemoteServiceRelativePath and that the specified in your web.xml matches this value, prepended with the location of your GWT output directory within the war directory.
For every annotation definition given above, corresponding entry for service impl should be given in web deployment descriptor i.e web.xml. As an example,
<servlet>
<servlet-name>sampleServlet</servlet-name>
<servlet-class>samples.gwt.SampleServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>sampleServlet</servlet-name>
<url-pattern>/sample-gwt-module/sampleService</url-pattern>
</servlet-mapping>
where
sample-gwt-module
is the (alternate) name of the sample GWT module as defined in module definition as
Related
I want to dynamically load JAR Files using a ClassLoader from a ByteArray. It works fine with every executable JAR Files I've tried it with so far, except a Program using WebLaF. I always get the following set of Errors:
javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.DocumentBuilderFactory cannot be created
at javax.xml.parsers.FactoryFinder.findServiceProvider(Unknown Source)
at javax.xml.parsers.FactoryFinder.find(Unknown Source)
at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at com.thoughtworks.xstream.io.xml.DomDriver.<init>(DomDriver.java:64)
at com.thoughtworks.xstream.io.xml.DomDriver.<init>(DomDriver.java:56)
at com.thoughtworks.xstream.io.xml.DomDriver.<init>(DomDriver.java:48)
at com.alee.utils.XmlUtils.initializeXStream(XmlUtils.java:90)
at com.alee.utils.XmlUtils.getXStream(XmlUtils.java:77)
at com.alee.utils.XmlUtils.processAnnotations(XmlUtils.java:141)
at com.alee.laf.WebLookAndFeel$2.propertyChange(WebLookAndFeel.java:855)
at java.beans.PropertyChangeSupport.fire(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
at com.alee.laf.WebLookAndFeel.install(WebLookAndFeel.java:932)
at com.alee.laf.WebLookAndFeel.install(WebLookAndFeel.java:918)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at xx.ByteCodeClassLoader.main(ByteCodeClassLoader.java:178)
Caused by: java.lang.RuntimeException: Provider for class javax.xml.parsers.DocumentBuilderFactory cannot be created
... 24 more
Caused by: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Error locating configuration files
at java.util.ServiceLoader.fail(Unknown Source)
at java.util.ServiceLoader.access$100(Unknown Source)
at java.util.ServiceLoader$LazyIterator.hasNextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.hasNext(Unknown Source)
at java.util.ServiceLoader$1.hasNext(Unknown Source)
at javax.xml.parsers.FactoryFinder$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 24 more
Caused by: java.io.IOException: Cannot fetch URL out of res
at xx.ByteCodeClassLoader.findResources(ByteCodeClassLoader.java:72)
at java.lang.ClassLoader.getResources(Unknown Source)
... 29 more
java.lang.NullPointerException
at com.alee.utils.XmlUtils.processAnnotations(XmlUtils.java:141)
at com.alee.laf.WebLookAndFeel$2.propertyChange(WebLookAndFeel.java:855)
at java.beans.PropertyChangeSupport.fire(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
at com.alee.laf.WebLookAndFeel.install(WebLookAndFeel.java:932)
at com.alee.laf.WebLookAndFeel.install(WebLookAndFeel.java:918)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at xx.ByteCodeClassLoader.main(ByteCodeClassLoader.java:178)
After this, the JAR runs successfully until it has to load the GUI. Then it crashes with another error:
javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.DocumentBuilderFactory cannot be created
My Code is the following:
public class ByteCodeClassLoader extends ClassLoader {
final Map<String, byte[]> classes;
final Map<String, byte[]> res;
-snip-
#Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
byte[] code = classes.get(name);
if (code != null){
return defineClass(name, code, 0, code.length);
}
return super.findClass(name);
}
#Override
public URL getResource(String name) {
URL ur = ByteCodeClassLoader.class.getResource(name);
if (ur != null) {
return ur;
}
try {
return new URL(null, "bytes:///" + name, new BytesHandler());
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
#Override
public InputStream getResourceAsStream(String name) {
return new ByteArrayInputStream(res.get(name));
}
#Override
protected Enumeration<URL> findResources(String name) throws IOException {
throw new IOException("Cannot fetch URL out of res");
}
-snip-
If you know a solution to this issue, it would help me greatly. Even just a lead in the right direction would be awesome. I hope I supplied all the important information.
When I open "EditAwardsView1" for the first time the Window.alert displays once. I enter data, select the "Save" button and my save to the DB occurs once. So far so good.
However, I then go back to the previous view "SelectPerson" and then open "EditAwardsView1" a second time. This time Window.alert displays twice and I get one "Uncaught exception escaped" error. I enter data, select the "Save" button and my save to the DB occurs twice.
If I repeat this again (go back to "SelectPerson" and then back to "EditAwardsView1") Window.alert displays five times and I get four "Uncaught exception escaped" errors. I enter data, select the "Save" button and my save to the DB occurs five times.
The calling code from the "SelectPerson" view is:
btnEditAward.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
navHandler2.go("EditAwards1");
}
});
btnEditAward.setStyleName("gwt-PushButton-up");
btnEditAward.setText("Edit Awards");
btnEditAward.setWidth("184px");
btnEditAward.setHeight("40px");
horizontalPanel.add(btnEditAward);
The entry point in "EditAwards1" is:
public EditAwardsView1(final NavHandler navHandler) {
rpc = (DBConnectionAsync) GWT.create(DBConnection.class);
ServiceDefTarget target = (ServiceDefTarget) rpc;
String moduleRelativeURL = GWT.getModuleBaseURL() + "MySQLConnection";
target.setServiceEntryPoint(moduleRelativeURL);
navHandler2 = navHandler;
//On load of page get the stored view data
//TODO Fix null pointer on reload.
verticalPanel.addAttachHandler(new Handler() {
int pog = 0;
public void onAttachOrDetach(AttachEvent event) {
if (pog == 0) {
pog++;
verticalPanel.clear();
listBoxAwardType.clear();
awardGrouped = null;
Window.alert("EditAwardsView1.");
//Retrieve stored data for this view.
AsyncCallback<ViewData> callback = new ViewDataHandler2<ViewData>(EditAwardsView1.this);
rpc.getViewData(callback);
}else{
pog = 0;
}
}
});
initWidget(verticalPanel);
}
The calling code from "EditAwardsView1" to return to the "SelectPerson" view is:
//Button btnSelectYouthMember = new Button("Select Youth Member");
btnSelectYouthMember.setStyleName("gwt-PushButton-up");
btnSelectYouthMember.setText("Select Youth Member");
btnSelectYouthMember.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
navHandler2.go("SelectPerson");
}
});
btnSelectYouthMember.setWidth("184px");
btnSelectYouthMember.setHeight("40px");
horizontalPanel_Menu.add(btnSelectYouthMember);
The error is:
[ERROR] [org.AwardTracker.AwardTracker] - Uncaught exception escaped
15:58:18.009 [ERROR] [org.AwardTracker.AwardTracker] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError) #com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(12426), JavaScript object(2059), JavaScript object(12432)]): Unable to set property 'onfocus' of undefined or null reference
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:299)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
at com.google.gwt.user.client.Window.alert(Window.java)
at org.AwardTracker.client.EditAwardsView1$3.onAttachOrDetach(EditAwardsView1.java:131)
at com.google.gwt.event.logical.shared.AttachEvent.dispatch(AttachEvent.java:100)
at com.google.gwt.event.logical.shared.AttachEvent.dispatch(AttachEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.event.logical.shared.AttachEvent.fire(AttachEvent.java:52)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:351)
at com.google.gwt.user.client.ui.Composite.onAttach(Composite.java:162)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:475)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:127)
at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97)
at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97)
at org.AwardTracker.client.NavHandler.go(NavHandler.java:53)
at org.AwardTracker.client.SelectPersonView$ViewDataHandler$2.onClick(SelectPersonView.java:131)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:56)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Unknown Source)
Please see http://forums.whirlpool.net.au/forum-replies.cfm?t=2265752 for an answer.
In short I:
deleted NavHandler.java,
changed AwardTracker.java to allow for history and remove need for NavHandler.java,
changed new view call to History.newItem("selectPerson", true);
added the test if (event.isAttached()) to the AttachHandler and
moved the following code into the AttachHandler -
rpc = (DBConnectionAsync) GWT.create(DBConnection.class);
ServiceDefTarget target = (ServiceDefTarget) rpc;
String moduleRelativeURL = GWT.getModuleBaseURL() + "MySQLConnection";
target.setServiceEntryPoint(moduleRelativeURL);
Regards,
Glyn
i have problems with gwt using openlayers and openstreetmaps to get a simple
example projekt to work.
When i run the projekt it always throws an exception:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:5 26)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Unknown Source) Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) #org.gwtopenmaps.openlayers.client.layer.OSMImpl::Osmarender(Ljava/lang/String;)([string: 'Osmarender']): $wnd.OpenLayers.Layer.OSM.Osmarender is not a constructor
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:24 9)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at org.gwtopenmaps.openlayers.client.layer.OSMImpl.Osmarender(OSMImpl.java)
at org.gwtopenmaps.openlayers.client.layer.OSM.Osmarender(OSM.java:38)
at de.iisys.sara2.sara2lightWebclient.client.View.initMap(View.java:33)
at de.iisys.sara2.sara2lightWebclient.client.View.onModuleLoad(View.java:26) ... 9 more
My Example Code:
public class View implements EntryPoint {
public View() {
}
public void onModuleLoad() {
initMap();
}
private void initMap() {
MapOptions defaultMapOptions = new MapOptions();
MapWidget mapWidget = new MapWidget("684px", "330px", defaultMapOptions);
OSM osm_1 = OSM.Osmarender("Osmarender");
OSM osm_2 = OSM.Mapnik("Mapnik");
OSM osm_3 = OSM.CycleMap("CycleMap");
OSM osm_4 = OSM.Maplint("Maplint");
osm_1.setIsBaseLayer(true);
osm_2.setIsBaseLayer(true);
osm_3.setIsBaseLayer(true);
osm_4.setIsBaseLayer(true);
Map map = mapWidget.getMap();
map.addLayer(osm_1);
map.addLayer(osm_2);
map.addLayer(osm_3);
map.addLayer(osm_4);
map.addControl(new LayerSwitcher());
map.addControl(new MousePosition());
LonLat lonLat = new LonLat(6.95, 50.94);
lonLat.transform("EPSG:4326", "EPSG:900913");
map.setCenter(lonLat, 12);
RootPanel.get().add(mapWidget);
}
Does anybody know how to solve this problem?
After some research I can tell you that osmarender as well as maplint are not supported anymore: http://wiki.openstreetmap.org/wiki/Tiles#home
If you delete those to layers from your function (osm_1 and osm_4) everything works perfectly.
I have got a problem with my code and i cant seem to fix it. I want to add some customer data to a array list in java/GWT when submitting a button.
the form from which i add the data.
ok.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (!voornaamTB.getText().equalsIgnoreCase("") && !achternaamTB.getText().equalsIgnoreCase("") && !emailTB.getText().equalsIgnoreCase("") && !geboortedatumTB.getText().equalsIgnoreCase("")) {
boolean addVG;
System.out.println(voornaamTB.getText());
System.out.println(tussenvoegselTB.getText());
System.out.println(achternaamTB.getText());
System.out.println(emailTB.getText());
System.out.println(geboortedatumTB.getText());
--> the error is generated here addVG = VGC.addVakantieganger(voornaamTB.getText(), tussenvoegselTB.getText(), achternaamTB.getText(), emailTB.getText(), geboortedatumTB.getText());
if (addVG) {
Window.alert("Vakantieganger toegevoegd.");
} else {
Window.alert("Vakantieganger niet toegevoegd.");
}
} else {
voornaamTB.addStyleName("invalide-TextBox");
tussenvoegselTB.addStyleName("invalide-TextBox");
achternaamTB.addStyleName("invalide-TextBox");
emailTB.addStyleName("invalide-TextBox");
geboortedatumTB.addStyleName("invalide-TextBox");
}
}
});
the controller class.
import java.util.ArrayList;
import com.vakantievibes.client.domein.Vakantieganger;
public class VakantiegangerController {
private String msg;
private ArrayList<Vakantieganger> vakantiegangers = new ArrayList<Vakantieganger>();
public VakantiegangerController(){
}
#SuppressWarnings("static-access")
public boolean heeftVakantieganger(String email) {
boolean result = false;
for (Vakantieganger v : vakantiegangers) {
if (v.getEmail().equalsIgnoreCase(email)){
result = true;
}
}
return result;
}
public boolean addVakantieganger(String voornaam, String tussenvoegsel, String achternaam, String email, String geboortedatum) {
//boolean result = false;
//if (!heeftVakantieganger(email)) {
Vakantieganger v = new Vakantieganger(voornaam, tussenvoegsel, achternaam, email, geboortedatum);
vakantiegangers.add(v);
boolean result = true;
System.out.println("klant toegevoegd");
//}
return result;
}
}
with the methode addVakantieganger it should add the data to the arraylist. but it doesn't seem to do that it should then report true back to the form. the !heeftVakantieganger(email) should check if the person is already in the array list but is disabled now for testing purpose's
the errors i recieve in eclipse.
14:17:03.207 [ERROR] [vakantie_vibes] Uncaught exception escaped
com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:124)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:172)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1321)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1277)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NullPointerException: null
at com.vakantievibes.client.GUI.FormToevoegenVakantieganger$8.onClick(FormToevoegenVakantieganger.java:153)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:124)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:172)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1321)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1277)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:679)
You get a NullPointerException. This happens because you are using a reference which is null. In your case this is one of the fields in the line that you marked.
Use a debugger, put a breakpoint on that line, and inspect which field in null.
Since you use all the variables, only VGC can be null at this time.
But I suspect this is a class name. My first guess is that the type VGC is part of the server API and not of the client API or something along these lines.
The following applet is compiled and packed into jar which is then signed with a self-signed cert.
import java.applet.Applet;
import java.io.File;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
public class Test extends Applet {
private static final long serialVersionUID = -3127185193501384816L;
private final class DirectoryLister implements PrivilegedAction<File[]> {
private final String attachmentsFolder;
private DirectoryLister(String attachmentsFolder) {
this.attachmentsFolder = attachmentsFolder;
}
public File[] run() {
return new File(attachmentsFolder).listFiles();
}
}
public File[] getFiles() throws PrivilegedActionException {
String attachmentsFolder = getParameter("attachmentsFolder");
if (attachmentsFolder != null) {
return AccessController.doPrivileged(new DirectoryLister(
attachmentsFolder));
}
return null;
}
}
Applet is instantiated as follows:
<applet id="applet"
code="Test"
archive="applet.jar">
<param name="attachmentsFolder"
value="c:/test" />
</applet>
Applet is used as follows:
var files = applet.getFiles();
for (var file in files) {
// Do something to file.
}
The ff. error is encountered:
java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.liveconnect.SecureInvocation$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.liveconnect.PrivilegedCallMethodAction.run(Unknown Source)
... 4 more
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission c:\test read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.list(Unknown Source)
at java.io.File.listFiles(Unknown Source)
at Test$DirectoryLister.run(Test.java:20)
at Test$DirectoryLister.run(Test.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at Test.getFiles(Test.java:28)
... 14 more
Which leads me to ask if I still need to explicitly grant perms in one of the config files in the Java home directory to read c:/test? If so, can anyone point me to a guide on how to do this?
Caching problem apparently. Clearing all caches and re-building/re-deploying solved the problem. I.e., no additional perms set-up needed.