I am new to GWT.
Here is my case.
I have one package which connects to some server (using XmlRpcClient) and get xml-view definition on defined object. (Say this package name in `connection`)
When I run this package separately, it works fine.
Now I want to use this package in GWT project.
I have created one GWT-project (say 'myclient`) and referred `connection` in `Projects` of `myclient` (using eclipse `Java Build Path` option).
I can import `connection`'s classes in GWT-servlet (Say `ViewServiceImpl`) class. but Connection to my server does not establish.
My task is, in `onModuleLoad` I do one RPC call to `ViewServiceImpl` and want to fetch xml-view using `connection` package. But this does not work in GWT.
Note: I have tried to solve the problem by making .jar of `connection` and including it to `Libraries` (using eclipse `Java Build Path` option) of `myclient`. but that too does not work. I am working on Ubuntu.
Я могу успешно запустить проект GWT как веб-приложение.Но когда я запускаю указанный URL в браузере (то есть, onModuleLoad
вызывается, и он вызывает RPC один метод сервлета ViewServiceImpl
), и я получаю следующую ошибку:
[ОШИБКА] Не удалосьподключиться к серверу с помощью admin: admin@127.0.0.1/designer org.apache.xmlrpc.XmlRpcException: не удалось создать поток ввода: не удалось получить URL-адрес: http://127.0.0.1:8069/xmlrpc/common в org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(XmlRpcSunHttpTransport.java:99) в org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest (XmlRpcStreamTransport.java:152) в org.apache.xmlrpc.client.XmlRpcttp.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest (XmlRpcSunHttpTransport.java:69) в org.apache.xmlrpc.client.XmlRpcClientWorker.execute (XmlRpcClientWorker.jml.xc.cp.cp.cp.cc.cp.cp.cp.cp_c_c_c_c_c_c_64)167) в org.apache.xmlrpc.client.XmlRpcClient.execute (XmlRpcClient.java:137) в org.apache.xmlrpc.client.XmlRpcClient.execute (XmlRpcClient.java: 126) на connection.openerp.OpenERP.loginOpenERP (OpenERP.java:225) на connection.openerp.OpenERP. (OpenERP.java:149) на connection.openerp.DevelopmentTemplate. (DevelopmentTemplate.java:68) на openerp.client.web.server.ViewServiceImpl.getView (ViewServiceImpl.java:19) в sun.reflect.NativeMethodAccessorImpl.invoke0 (нативный метод) в sun.reflect.NativeMethodAccessorImpl.invoke.invoke (DelegatingMethodAccessorImpl.java:43) на java.lang.reflect.Method.invoke (Method.java:616) на com.google.appengine.tools.development.agent.runtime.Runtime.invoke (Runtime.java:100) на com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse (RPC.java:569) на com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall (RemoteServiceServlet.java:208) на com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost (RemoteServiceServlet.java:248) на com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost (AbstractRemoteServiceServlet.java:62) в javax.servlet.http.HttpServlet.service (HttpServlet.java:637) в javax.servlet.http.HttpServlet.service (HttpServlet.java:717) на org.mortvlet.jt..handle (ServletHolder.java:511) в org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java:1166) в com.google.appengine.api.blobstore.dev.ServeBlobFilter.job (: 58) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java:1157) на com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter (TransactionCleanupFilter.java.mb).jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java:1157) в com.google.appengine.tools.development.StaticFileFilter.doFilter (StaticFileFilter.java:122) в org.mortbay.jetty.lethaSler.Shlet.doFilter (ServletHandler.java:1157) в org.mortbay.jetty.servlet.ServletHandler.handle (ServletHandler.java:388) в org.mortbay.jetty.security.SecurityHandler.handle (SecurityHandler.java:216) в org.mortbay.jetty.servlet.SessionHandler.handle (SessionHandler.java:182) в org.mortbay.jetty.handler.ContextHandler.handle (ContextHandler.java:765) в орг..mortbay.jetty.webapp.WebAppContext.handle (WebAppContext.java:418) при com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle (DevAppEngineWebAppContext.java:70) при org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) в com.google.appengine.tools.development.JettyContainerService $ ApiProxyHandler.handle (JettyContainerService.java:351) в org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.15).org.mortbay.jetty.Server.handle (Server.java:326)в org.mortbay.jetty.HttpConnection.handleRequest (HttpConnection.java:542) в org.mortbay.jetty.HttpConnection $ RequestHandler.content (HttpConnection.java:938) в org.mortbay.jetty.HttpParser: 755) в org.mortbay.jetty.HttpParser.parseAvailable (HttpParser.java:218) в org.mortbay.jetty.HttpConnection.handle (HttpConnection.java:404) в org.mortbay.io.nio.nd.ChanВыберитеChannelEndPoint.java:409) в org.mortbay.thread.QueuedThreadPool $ PoolThread.run (QueuedThreadPool.java:582). Причина: java.io.IOException: Не удалось получить URL: http://127.0.0.1:8069/xmlrpc/common в com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationException (URLFetchServiceImpl.java:110) по адресу com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch (URLFetchServiceImpl.cht.chl.dll).URLFetchServiceStreamHandler $ Connection.fetchResponse (URLFetchServiceStreamHandler.java:418) в com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler $ Connection.getInputStream (URLFetchServiceStreamHandler.java:297) по адресу com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler $ Connection.getResponseCode (URLFetchServiceStreamHandler.jttml.play.xp.PlaySport.RecPHP)XmlRpcSunHttpTransport.java:92) ... еще 47 Обусловлено: java.io.IOException: Не удалось получить URL: http://127.0.0.1:8069/xmlrpc/common на com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationException (URLFetchSjava.mpl:110) по адресу com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch (URLFetchServiceImpl.java:41) по адресу com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler $ Connection.fetchResponerService.Fl).google.chServiceStreamHandler.java:150) в org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream (XmlRpcSunHttpTransport.java:92) в org.apache.xmlrpc.client.XmlRpcream.jp_t_p_t_p_t_t_p_cr_t_t_t_cr_t_p_t_t_t_t_t_cr).client.XmlRpcHttpTransport.sendRequest (XmlRpcHttpTransport.java:143) в org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest (XmlRpcSunHttpTransport.javaml.xer.liv.Cli.dll)) в org.apache.xmlrpc.client.XmlRpcClient.execute (XmlRpcClient.java:167) в org.apache.xmlrpc.client.XmlRpcClient.execute (XmlRpcClient.java:137) в orgrxp.cache.pc.выполнить (XmlRpcClient.java:126) в connection.openerp.OpenERP.loginOpenERP (OpenERP.java:225) в connection.openerp.OpenERP. (OpenERP.java:149) в connection.openerp.DevelopmentTemplate. (DevelopmentTemplate.java:68) в openerp.client.web.server.ViewServiceImpl.getView (ViewServiceImpl.java:19) в sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57) в sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpho.ava.j.v.fl.Java: 616) на com.google.appengine.tools.development.agent.runtime.Runtime.invoke (Runtime.java:100) на com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse (RPC.java:569) на com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall (RemoteServiceServlet.java:208) на com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost (RemoteServiceServlet.java:24).google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost (AbstractRemoteServiceServlet.java:62) в javax.servlet.http.HttpServlet.service (HttpServlet.java:637)на javax.servlet.http.HttpServlet.service (HttpServlet.java:717) на org.mortbay.jetty.servlet.ServletHolder.handle (ServletHolder.java:511) на org.mortbay.jetty.servlet.SerdoletHerin(ServletHandler.java:1166) в com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter (ServeBlobFilter.java:58) в org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (Serv).) в com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter (TransactionCleanupFilter.java:43) по адресу org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java:1157) в com.gtools.development.StaticFileFilter.doFilter (StaticFileFilter.java:122) в org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java:1157) в org.mortbay.jetty.letler.erlet.Java: 388) в org.mortbay.jetty.security.SecurityHandler.handle (SecurityHandler.java:216) в org.mortbay.jetty.servlet.SessionHandler.handle (SessionHandler.java:182) в org.mortbay.jetty.handler.ContextHandler.handle (ContextHandler.java:765) в org.mortbay.jetty.webapp.WebAppContext.handle (WebAppContext.java:418) в com.google..apphosting..handle (JettyContainerService.java:351) в org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java:152) в org.mortbay.jetty.Server.handle (Server.java:326) в org.mortbay.jetty.HttpConnection.handleRequest (HttpConnection.java:542) по адресу org.mortbay.jetty.HttpConnection $ RequestHandler.content (HttpConnection.java:938) по адресу org.mortbay.jetty.HttpParser.parseNaxt.jt5).mortbay.jetty.HttpParser.parseAvailable (HttpParser.java:218) в org.mortbay.jetty.HttpConnection.handle (HttpConnection.java:404) в org.mortbay.io.nio.SelectChannelEndPoint.run (SelectChannelEndPoint.java:409) в org.mortbay.thread.QueuedThreadPool $ PoolThread.run (QueuedThreadPool.java:582) [ОШИБКА] javax.servlet.ServletContext log: исключение при отправке входящего вызова RPC com.g.g.user.server.rpc.UnexpectedException: метод службы 'public abstract openerp.client.web.client.View openerp.client.web.client.ViewService.getView (java.lang.String)' вызвал неожиданное исключение: java.security.AccessControlException: доступ запрещен (java.lang.RuntimePermission exitVM.-1) по адресу com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure (RPC.java:385) по адресу com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse (RPC.java:588) на com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall (RemoteServiceServlet.java:208) на com.google.gwt.user.server.rerServprocessPost (RemoteServiceServlet.java:248) на com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost (AbstractRemoteServiceServlet.java:62) на javax.servlet.http.HttpServlet.service (HttpServlet.java:637) на javax.servlet.http.HttpServlet.service (HttpServlet.java:717) на org.mortbay.jetty.servlet.ServletHolder.handle (ServletHolder.java:5b at at11) на веб-сайте.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java:1166) в com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter (ServeBlobFilter.java:58) в org.mortbay.jetty.servlet.ServletHandler$ CachedChain.doFilter (ServletHandler.java:1157) в com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter (TransactionCleanupFilter.java:43) в org.mortbay.jetty.servlet.ServletHandlerjF: 1157) по адресу com.google.appengine.tools.development.StaticFileFilter.doFilter (StaticFileFilter.java:122) по адресу org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java:1157).на org.mortbay.jetty.servlet.ServletHandler.handle (ServletHandler.java:388)
в org.mortbay.jetty.security.SecurityHandler.handle (SecurityHandler.java:216)
в org.mortbay.jetty.servlet.SessionHandler.handle (SessionHandler.java:182)
на org.mortbay.jetty.handler.ContextHandler.handle (ContextHandler.java:765)
на org.mortbay.jetty.webapp.WebAppContext.handle (WebAppContext.java:418)
на com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle (DevAppEngineWebAppContext.java:70)
на org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java:152)
на com.google.appengine.tools.development.JettyContainerService $ ApiProxyHandler.handle (JettyContainerService.java:351)
на org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java:152)
на org.mortbay.jetty.Server.handle (Server.java:326)
на org.mortbay.jetty.HttpConnection.handleRequest (HttpConnection.java:542)
в org.mortbay.jetty.HttpConnection $ RequestHandler.content (HttpConnection.java:938)
в org.mortbay.jetty.HttpParser.parseNext (HttpParser.java:755)
в org.mortbay.jetty.HttpParser.parseAvailable (HttpParser.java:218)
на org.mortbay.jetty.HttpConnection.handle (HttpConnection.java:404)
на org.mortbay.io.nio.SelectChannelEndPoint.run (SelectChannelEndPoint.java:409)
в org.mortbay.thread.QueuedThreadPool $ PoolThread.run (QueuedThreadPool.java:582)
Вызывается: java.security.AccessControlException: доступ запрещен (java.lang.RuntimePermission exitVM.-1)
в java.security.AccessControlContext.checkPermission (AccessControlContext.java:393)
в java.security.AccessController.checkPermission (AccessController.java:553)
at java.lang.SecurityManager.checkPermission (SecurityManager.java:549)
на com.google.appengine.tools.development.DevAppServerFactory $ CustomSecurityManager.checkPermission (DevAppServerFactory.java:166)
at java.lang.SecurityManager.checkExit (SecurityManager.java:761)
at java.lang.Runtime.exit (Runtime.java:105)
в java.lang.System.exit (System.java:923)
at connection.openerp.DevelopmentTemplate. (DevelopmentTemplate.java:72)
в openerp.client.web.server.ViewServiceImpl.getView (ViewServiceImpl.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
в java.lang.reflect.Method.invoke (Method.java:616)
на com.google.appengine.tools.development.agent.runtime.Runtime.invoke (Runtime.java:100)
на com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse (RPC.java:569)
... еще 30
this method is in one of the class of `connection` package, it runs perfect as an individual Java application but throws Exception while calling from GWT-servlet
public boolean loginServer () выбрасывает MalformedURLException, XmlRpcException {
XmlRpcClient xmlrpcLogin = new XmlRpcClient();
XmlRpcClientConfigImpl xmlrpcConfigLogin = new XmlRpcClientConfigImpl();
xmlrpcConfigLogin.setEnabledForExtensions(true);
URL serverURL = null;
// processing is done with /common, unlike queries (/object)
serverURL = new URL("http", "127.0.0.1", 8069, "/xmlrpc/common");
xmlrpcConfigLogin.setServerURL(serverURL);
xmlrpcLogin.setConfig(xmlrpcConfigLogin);
// Connect
Object[] params = new Object[] { "designer", "admin", "admin"};
Object id = xmlrpcLogin.execute("login", params);// error from this line of code
if (id instanceof Integer) {
openERPuserid = ((Integer) id).intValue();
System.out.println("Userid: " + openERPuserid);
}
// return "true" if user id exists
return (openERPuserid > 0);
}