Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-2775

nullpointer by invoking web service and RPCMessageReceiver problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • window xp
      jdk5
      axis2
      eclipse3.2

    Description

      I have the Problem by invoking the Web Service with axis2,
      ------------------------Client:
      public void MyConnection(String user, String passwd)throws RemoteException{
      Options options = new Options();
      options.setManageSession(true);
      RPCServiceClient serviceClient = new RPCServiceClient();
      options.setTo(targetEPR);
      options.setAction("urn:MyConnection");
      options.setExceptionToBeThrownOnSOAPFault(false);
      serviceClient.setOptions(options);
      QName opSet = new QName("http://services.solver.nx.wp.com/xsd", "MyConncetion");
      Object response = serviceClient.invokeBlocking(opSet,new Object[]

      {user,passwd}

      );
      if(response instanceof AxisFault)

      { throw (RemoteException)response;}

      }
      -----------------------------------------------------------------------------
      -------------------------Service
      public void MyConnection(String user, String passwd) throws AxisFault
      {
      String connString = Const.getCONNECTIONSTRING();
      if(connString == null)

      { throw new AxisFault("Unknown server defined in web.xml."); }

      MessageContext mctx =MessageContext.getCurrentMessageContext();
      TransportListener listener = mctx.getTransportIn().getReceiver();
      SessionContext session = listener.getSessionContext(mctx);
      MessageContext.getCurrentMessageContext().setSessionContext(session);
      System.out.println("the session is:" + session +" ;and the sessionpropertiers is: "+session.getProperties().size());
      session.getProperties().remove(Const.SESSIONUSER);
      session.getProperties().remove(Const.SESSIONCUSTOMER);

      Connection conn;
      try

      { Class.forName(Const.DBDRIVERCLASS); }

      catch(ClassNotFoundException cnfe)

      { terminate(); throw new AxisFault("Database Driver-class not found."); }

      try

      { conn = DriverManager.getConnection(connString, user, passwd); }

      catch(SQLException sqle)

      { terminate(); throw new AxisFault("Connection as admin could not be established.\n" + connString + " User: " + user); }

      DBHandler dbHandler = new DBHandler();
      try
      {
      ResultSet result = dbHandler.performSelect(Const.getDBSQLUSERCUST(user), conn);
      if(!result.next())

      { conn.close(); terminate(); throw new AxisFault("The user is not linked with a customer."); }

      session.setProperty(Const.SESSIONUSER, result.getString(Const.DBCOLUSERNAME));
      session.setProperty(Const.SESSIONCUSTOMER, new Integer(result.getInt(Const.DBCOLCUSTID)));
      }
      catch(SQLException sqle)
      {
      try

      { conn.close(); }

      catch(SQLException sqle2)

      { terminate(); throw new AxisFault("Error while closing the connection."); }

      terminate();
      throw new AxisFault("Error while getting user and customer from database.");
      }
      try

      { conn.close(); }

      catch(SQLException sqle)

      { terminate(); throw new AxisFault("Error while closing the connection."); }

      }
      ----------------------------------------------------------
      ------------------------------------------the Problem:
      sessionContext.getproperties() is always null
      ------------------------------------------and:
      06.06.2007 15:42:43 org.apache.axis2.rpc.receivers.RPCMessageReceiver invokeBusinessLogic
      SCHWERWIEGEND: Exception occurred while trying to invoke service method estConnection
      java.lang.NullPointerException
      at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:127)
      at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
      at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
      at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:116)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Unknown Source)
      -------------------------------------------
      has any one idears?
      Help, pleas

      Attachments

        Issue Links

          Activity

            People

              deepal Deepal Jayasinghe
              haha1234567 haha
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: