You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Deepal Jayasinghe (JIRA)" <ji...@apache.org> on 2007/06/11 15:56:26 UTC

[jira] Resolved: (AXIS2-2775) nullpointer by invoking web service and RPCMessageReceiver problem

     [ https://issues.apache.org/jira/browse/AXIS2-2775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe resolved AXIS2-2775.
--------------------------------------

    Resolution: Fixed

First you do not need to get the session context as you have done , you can just get the session context from the MessageContext.

MessageContext mctx =MessageContext.getCurrentMessageContext(); 
TransportListener listener = mctx.getTransportIn().getReceiver(); 
SessionContext session = listener.getSessionContext(mctx); 
MessageContext.getCurrentMessageContext().setSessionContext(session); 


And other thing is you have only valid session context only if you have deploy your service in transport session. So please try to do the following,

First deploy your service in transport session
Get the session context from the messagecontext.
MessageContext.getCurrentMessageContext().getSessionContext(); 



I will resolve the issues , since the error is due to user code. Please try to follow the steps that I mentioned and please re-open the issue if the issue is still there.

> nullpointer by invoking web service and RPCMessageReceiver problem 
> -------------------------------------------------------------------
>
>                 Key: AXIS2-2775
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2775
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>         Environment: window xp
> jdk5
> axis2
> eclipse3.2
>            Reporter: haha
>            Assignee: Deepal Jayasinghe
>
> 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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org