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 "haha (JIRA)" <ji...@apache.org> on 2007/06/12 11:24:26 UTC

[jira] Issue Comment Edited: (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:comment-tabpanel#action_12503789 ] 

haha edited comment on AXIS2-2775 at 6/12/07 2:23 AM:
------------------------------------------------------

Thanks for your helps very much.
I have no more those failures, but i don't know why, i guess, that the "RPCMessageReceiver" caused this, it needs always a returnvalue, so i did the follows:

I changed the "public void MyConnction()"  on the Server side to "public Boolean MyConnection()" with "return true", and on the client side i changed the code to:

public void MyConnection(String user, String passwd)throws RemoteException{
	
    Options options = new Options();
    RPCServiceClient serviceClient = new RPCServiceClient();
    options.setTo(targetEPR);
    options.setAction("urn:MyConnection");
    serviceClient.setOptions(options);  
    options.setExceptionToBeThrownOnSOAPFault(false);
    QName opSet = new QName("http://services.solver.nx.wp.com/xsd", "MyConnection");
    Object[] response = serviceClient.invokeBlocking(opSet,new Object[] {user,passwd},new Class[]{Boolean.class});
    Boolean result =(Boolean)response[0];
    if (result == false)System.out.println("no results!");
    else
    System.out.println("Result "+ result);
    if(response[0] instanceof AxisFault)
	{
		throw (RemoteException)response[0];
	} 
	}
---------------------------------------------------------------
so this time it works fine, but only local and only inside the Eclipse. If i put the Service and the client Programm onto differente Computers, it doesn't work any more, there occurt a Exception "AxisFault: Connection refused: connect". (I used the command "axis2.bat" under axis2\bin). How can i set the structure of the Client and the Server side? must be a Tomcat Server on cleint side Computer installed? can you tell me please?
---------------------------------------------------------------


 was:
Thanks for your helps very much.
I have no more those failures, but i don't know why, i guess, that the "RPCMessageReceiver" caused this, it needs always a returnvalue, so i did the follows:

I changed the "public void MyConnction()"  on the Server side to "public Boolean MyConnection()" with "return true", and on the client side i changed the code to:

public void MyConnection(String user, String passwd)throws RemoteException{
	
    Options options = new Options();
    RPCServiceClient serviceClient = new RPCServiceClient();
    options.setTo(targetEPR);
    options.setAction("urn:MyConnection");
    serviceClient.setOptions(options);  
    options.setExceptionToBeThrownOnSOAPFault(false);
    QName opSet = new QName("http://services.solver.nx.wp.com/xsd", "MyConnection");
    Object[] response = serviceClient.invokeBlocking(opSet,new Object[] {user,passwd},new Class[]{Boolean.class});
    Boolean result =(Boolean)response[0];
    if (result == false)System.out.println("no results!");
    else
    System.out.println("Result "+ result);
    if(response[0] instanceof AxisFault)
	{
		throw (RemoteException)response[0];
	} 
	}
---------------------------------------------------------------
so this time it works fine, but only local and only inside the Eclipse. If i put the Service and the client Programm onto differente Computers, it doesn't work any more, there occurt a Exception "AxisFault: Connection refused: connect". How can i set the structure of the Client and the Server side? must be a Tomcat Server on cleint side Computer installed? can you tell me please?
---------------------------------------------------------------

> 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