加载序列化策略时出错

时间:2013-07-23 14:36:20

标签: gwt tomcat

我的gwt项目有问题。

我在两个TomCat服务器上实例化了我的项目,当我尝试将服务器与服务器通信时,Eclipse会返回以下错误:

Jul 23, 2013 4:23:02 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract int     it.ronf.client.RonfService.checkCarAgenzia(java.lang.String,java.lang.String)' threw an unexpected exception: com.google.gwt.user.client.rpc.InvocationException: Error while loading serialization policy 4B8D0D03E16542B6163548C2B2ACD7CA
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:389)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:579)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.google.gwt.user.client.rpc.InvocationException: Error while loading serialization policy 4B8D0D03E16542B6163548C2B2ACD7CA
at com.gdevelop.gwt.syncrpc.RemoteServiceSyncProxy.<init>(RemoteServiceSyncProxy.java:89)
at com.gdevelop.gwt.syncrpc.RemoteServiceInvocationHandler.invoke(RemoteServiceInvocationHandler.java:99)
at com.sun.proxy.$Proxy0.CheckAuto(Unknown Source)
at it.ronf.server.RonfServiceImpl.checkCarAgenzia(RonfServiceImpl.java:86)
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.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
... 21 more
Caused by: java.lang.NullPointerException: inputStream
at com.google.gwt.user.server.rpc.SerializationPolicyLoader.loadFromStream(SerializationPolicyLoader.java:110)
at com.gdevelop.gwt.syncrpc.RemoteServiceSyncProxy.<init>(RemoteServiceSyncProxy.java:87)
... 29 more

这就是我在客户端调用服务器到服务器功能的方式:

    btnVerificaDisponibilit.addClickHandler(new ClickHandler(){
        @Override
        public void onClick(ClickEvent event){
            RonfService.checkCarAgenzia("b","Mini", new AsyncCallback<Integer>(){
                @Override
                public void onFailure(Throwable caught){

                }
                @Override
                public void onSuccess(Integer result){
                    if(result > 1){
                    btnAvviaTrasferimento.setVisible(true);
                    System.out.println("c'è");
                    }
                    else errorLabel.setText("Non ci sono modelli disponibile in altre agenzie.");
                }
            });     
        }
    });

这是我服务器端的功能:

@Override
public int checkCarAgenzia(String agenzia, String tipologia){
    int n = 0;

    if(agenzia.compareTo("b")==0){
        final RonfService rpcService  = (RonfService) SyncProxy.newProxyInstance(RonfService.class,"http://localhost:8081/Ronf-project/ronf/", "ronfservice");
        n = rpcService.CheckAuto(tipologia);
    }
    else if(agenzia.compareTo("a")==0){
        final RonfService rpcService = (RonfService) SyncProxy.newProxyInstance(RonfService.class, "http://localhost:8082/Ronf-project/ronf", "ronfservice");
        n = rpcService.CheckAuto(tipologia);
    }       
    return n;
}


@Override
public int CheckAuto(String tipologia){
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();
    List<Auto> auto = new ArrayList<Auto>(session.createQuery("from Auto where Tipologia ='" + tipologia + "' and Disponibilita='true'").list());
    session.getTransaction().commit();

    return auto.size();
}

为什么序列化问题仅在我尝试与服务器B通信时出现,而在我尝试与服务器A通信时却不出现?

ps:这是我的rpc.gwt文件

 com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException, true, true, true, true, com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533, 3936916533
 com.google.gwt.user.client.rpc.RpcTokenException, true, true, false, false,               com.google.gwt.user.client.rpc.RpcTokenException/2345075298, 2345075298
 com.google.gwt.user.client.rpc.XsrfToken, false, false, true, true,      com.google.gwt.user.client.rpc.XsrfToken/4254043109, 4254043109
 it.ronf.client.RonfService, false, false, false, false, _, 1028614166
 it.ronf.client.dto.AccountDTO, true, true, true, true,      it.ronf.client.dto.AccountDTO/2817033572, 2817033572
 it.ronf.client.dto.AgenziaDTO, true, true, true, true,      it.ronf.client.dto.AgenziaDTO/2138136895, 2138136895
 [Lit.ronf.client.dto.AgenziaDTO;, true, true, false, false,      [Lit.ronf.client.dto.AgenziaDTO;/2014206060, 2014206060
 it.ronf.client.dto.AutoDTO, true, true, true, true,      it.ronf.client.dto.AutoDTO/3433806794, 3433806794
 [Lit.ronf.client.dto.AutoDTO;, true, true, false, false,      [Lit.ronf.client.dto.AutoDTO;/1522893402, 1522893402
 it.ronf.client.dto.ClienteDTO, true, true, true, true,      it.ronf.client.dto.ClienteDTO/2249269015, 2249269015
 it.ronf.client.dto.NoleggioDTO, true, true, true, true,      it.ronf.client.dto.NoleggioDTO/2812187262, 2812187262
 [Lit.ronf.client.dto.NoleggioDTO;, true, true, false, false,      [Lit.ronf.client.dto.NoleggioDTO;/1459858797, 1459858797
 it.ronf.client.dto.RichiestaRifornimentoDTO, true, true, true, true,      it.ronf.client.dto.RichiestaRifornimentoDTO/413727488, 413727488
 [Lit.ronf.client.dto.RichiestaRifornimentoDTO;, true, true, false, false,      [Lit.ronf.client.dto.RichiestaRifornimentoDTO;/793440202, 793440202
 it.ronf.client.dto.RichiestaTrasferimentoDTO, true, true, true, true,      it.ronf.client.dto.RichiestaTrasferimentoDTO/3484920730, 3484920730
 [Lit.ronf.client.dto.RichiestaTrasferimentoDTO;, true, true, false, false,      [Lit.ronf.client.dto.RichiestaTrasferimentoDTO;/1065675269, 1065675269
 java.lang.Exception, true, false, true, false, java.lang.Exception/1920171873, 1920171873
 java.lang.Long, true, true, true, true, java.lang.Long/4227064769, 4227064769
 java.lang.Number, true, false, true, false, java.lang.Number/300033342, 300033342
 java.lang.RuntimeException, true, false, true, false,      java.lang.RuntimeException/515124647, 515124647
 java.lang.String, true, true, true, true, java.lang.String/2004016611, 2004016611
 java.lang.Throwable, true, false, true, false, java.lang.Throwable/2953622131, 2953622131
 java.util.ArrayList, true, true, false, false, java.util.ArrayList/4159755760, 4159755760
 java.util.Arrays$ArrayList, true, true, false, false,      java.util.Arrays$ArrayList/2507071751, 2507071751
 java.util.Collections$EmptyList, true, true, false, false,      java.util.Collections$EmptyList/4157118744, 4157118744
 java.util.Collections$SingletonList, true, true, false, false,      java.util.Collections$SingletonList/1586180994, 1586180994
 java.util.LinkedList, true, true, false, false, java.util.LinkedList/3953877921, 3953877921
 java.util.Stack, true, true, false, false, java.util.Stack/1346942793, 1346942793
 java.util.Vector, true, true, false, false, java.util.Vector/3057315478, 3057315478

0 个答案:

没有答案