Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

You can get up to 1000 points with this question

I have a program CORBA, server side using C++ and client side using Java and OrbixWeb3.2. TxLogOnCheckReq function have some parameters, one of parameters is "Any" type. Code to initialize:

       orb = IE.Iona.OrbixWeb.CORBA.ORB.init(args, null);
       try
     {
     pptSM = PPTServiceManagerHelper.bind(":PPTSM", "ManhVien");
     pptUser = new pptUser_struct();
     pptLogOnCheckReqResult_struct logOnCheck = new pptLogOnCheckReqResult_struct();
       if (pptSM != null)
     {
     logOnCheck = pptSM.TxLogOnCheckReq(pptUser, "MM" ,null);
        }
.........
}
catch( ...)
{}


Error stop in line logOnCheck = pptSM.TxLogOnCheckReq(.....);
And Error message is:


java.lang.NullPointerException
     at com.ibm.rmi.corba.TypeCodeImpl.<init>(TypeCodeImpl.java:499)
     at com.ibm.rmi.corba.TypeCodeImpl.convertToNative(TypeCodeImpl.java:891)
     at com.ibm.rmi.corba.TypeCodeImpl.<init>(TypeCodeImpl.java:634)
     at com.ibm.rmi.corba.ORBSingleton.create_struct_tc(ORBSingleton.java:91)
     at com.gcs.wopi.idl2java.pptUser_structHelper.type(pptUser_structHelper.java:34)
     at com.gcs.wopi.idl2java.pptUser_structHolder._type(pptUser_structHolder.java:30)
     at IE.Iona.OrbixWeb.CORBA.Any.insert_Streamable(Any.java:424)
     at com.gcs.wopi.idl2java.pptUserHelper.insert(pptUserHelper.java:14)
     at com.gcs.wopi.idl2java._PPTServiceManagerStub.TxLogOnCheckReq(_PPTServiceManagerStub.java:2408)
     at com.gcs.wopi.servlets.MainServlet.doGet(MainServlet.java:102)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:580)
0
hongnd
Asked:
hongnd
  • 3
  • 3
  • 2
  • +2
1 Solution
 
objectsCommented:
Not really enough info to work out what the problem is.
The only thing I can see to check is the null you are passing as the 3rg argument, maybe try passing a value here instead.
0
 
stimpyjcatCommented:
What is the interface for TxLogOnCheckReq?  Apparently the program is trying to insert a "Streamable" into an Any, but without the interface, it's difficult to tell which of your args it is trying to insert.  However, given that your third argument is null, you might have trouble coming up with a TypeCode for that, if the null is what's being inserted into the Any.  If your intention is to insert a CORBA::nil value into the Any, I don't think that's the way to do it.
0
 
nebekerCommented:
You will need to post the section of IDL that contains:

TxLogOnCheckReq
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
hongndAuthor Commented:
This is some related files
//---------------------------------------------------------
//logon.idl
typedef struct objectIdentifier_struct { string identifier; string stringifiedObjectReference; }  objectIdentifier;

typedef struct pptFuncID_struct {
    string   categoryID;
    string   functionID;
    string   permission;
    any siInfo;
} pptFuncID;

typedef sequence <pptFuncID> pptFuncIDSequence;

typedef struct pptFuncList_struct {
    string            subSystemID;
    pptFuncIDSequence strFuncIDs;
    any siInfo;
} pptFuncList;

typedef sequence <pptFuncList> pptFuncListSequence;

typedef struct pptRetCode_struct {
    string transactionID;
    string returnCode;
    string messageID;
    string messageText;
    string reasonText;
    any siInfo;
} pptRetCode;

typedef struct pptUser_struct
{
    objectIdentifier    userID;
    string              password;
    string              newPassword;
    string              functionID;
    string              clientNode;
    any siInfo;
} pptUser;

typedef struct pptLogOnCheckReqResult_struct {
    pptRetCode           strResult;
    pptFuncListSequence  subSystemFuncLists;
    any siInfo;
} pptLogOnCheckReqResult;


interface PPTServiceManager
{
    pptLogOnCheckReqResult TxLogOnCheckReq(in pptUser requestUserID, in string subSystemID, in string categoryID);
};

//---------------------------------------------------------
//PPTServiceManagerImpl

import test.*;

public class PPTServiceManagerImpl extends _PPTServiceManagerImplBase
{
    public PPTServiceManagerImpl()
    {
    }
   
    public pptLogOnCheckReqResult_struct TxLogOnCheckReq(pptUser_struct requestUserID, String subSystemID, String categoryID)
    {
        System.out.println("TxLogOnCheckReq() is invoked");
       
        IE.Iona.OrbixWeb.CORBA.Any retCodeAny = new IE.Iona.OrbixWeb.CORBA.Any();
        retCodeAny.insert_string("RetCode Any");
       
        pptRetCode_struct retCode = new pptRetCode_struct("TRANS0", "0", "MESS0", "A Message", "NONE", retCodeAny);
       
/*
        retCode.transactionID = "TRANS0";
        retCode.returnCode = "0";
        retCode.messageID = "MESS0"
        retCode.messageText = "A Message";
        retCode.reasonText = "NONE";
        retCode.siInfo = retCodeAny;
*/        
       
        IE.Iona.OrbixWeb.CORBA.Any funcIDAny = new IE.Iona.OrbixWeb.CORBA.Any();
        funcIDAny.insert_string("FuncID Any");
       
        pptFuncID_struct funcID = new pptFuncID_struct("CAT0", "FUNC0", "PERMISSION", funcIDAny);
       
/*        
        funcID.categoryID = "CAT0";
        funcID.functionID = "FUNC0";
        funcID.permission = "PERMISSION";
        funcID.siInfo = funcIDAny;
*/        
        pptFuncID_struct[] funcIDSeq = new pptFuncID_struct[1];
       
        funcIDSeq[0] = funcID;

        IE.Iona.OrbixWeb.CORBA.Any funcListAny = new IE.Iona.OrbixWeb.CORBA.Any();
        funcListAny.insert_string("FuncList Any");
       
        pptFuncList_struct funcList = new pptFuncList_struct("SYSTEM0", funcIDSeq, funcListAny);
/*        
        funcList.subSystemID = "SYSTEM0";
        funcList.strFuncIDs = funcIDSeq;
        funcList.siInfo = funcListAny;
*/        
        pptFuncList_struct[] funcListSeq = new pptFuncList_struct[1];
       
        funcListSeq[0] = funcList;
       
        IE.Iona.OrbixWeb.CORBA.Any resultAny = new IE.Iona.OrbixWeb.CORBA.Any();
        resultAny.insert_string("Result Any");

        pptLogOnCheckReqResult_struct res = new pptLogOnCheckReqResult_struct(retCode, funcListSeq, resultAny);
       
/*        
        res.strResult = retCode;
        res.subSystemFuncLists = funcListSeq;
        res.siInfo = resultAny;
*/        
       
        return res;
    }
}


//-------------------------------------------------------
//TestClient

import IE.Iona.OrbixWeb._CORBA;
import IE.Iona.OrbixWeb._OrbixWeb;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.ORB;
import IE.Iona.OrbixWeb.CORBA.*;

import test.*;

public class TestClient
{

      public static void main (String args[])
      {
          if (args.length != 2)
          {
              System.out.println("Usage: TestClient serverName hostName");
              System.exit(1);
          }
          String[] arr = null;    

          ORB orb = ORB.init (arr, null);
                    
          String serverName = args[0];
            String hostName = args[1];
          
          PPTServiceManager testProxy = null;
          try
          {
                testProxy = PPTServiceManagerHelper.bind (":" + serverName, hostName);

            objectIdentifier_struct anID = new objectIdentifier_struct("NTT", "9999");
           
            Any userAny = new IE.Iona.OrbixWeb.CORBA.Any();
            userAny.insert_string("User Any");

            pptUser_struct pptUser = new pptUser_struct(anID, "NTT", "NTT", "FUNC0", "NODE0", userAny);
            //pptUser.userID = anID;
            //pptUser.password = new String("NTT");
            //pptUser.newPassword = new String("NTT");
            //pptUser.functionID = new String("Func0");
            //pptUser.clientNode = new String("Node0");
            //pptUser.siInfo = userAny;
           
            System.out.println ("Calling TxLogOnCheckReq() method ...");
            pptLogOnCheckReqResult_struct logOnCheck = testProxy.TxLogOnCheckReq(pptUser, "MM", "WOPI");
           
                  if (logOnCheck != null)
                  {
                      System.out.println("Result is NOT NULL");
                      
                        String Tx_id = logOnCheck.strResult.transactionID;
                        String result = logOnCheck.strResult.returnCode;
                        System.out.println("TX ID = " + Tx_id + " Result = " + result);
                  }
                  else
                  {
                      System.out.println("Result is NULL");
                  }
          }
          catch (SystemException ex)
          {
                System.out.println ("==//== System Excpetion caught : " + ex.toString());
          }
          finally
          {
              _OrbixWeb.ORB(orb).shutdown(true);
          }             
    }
}


//-------------------------------------------------------
//TestServer

import org.omg.CORBA.*;
import IE.Iona.OrbixWeb.*;
import org.omg.CORBA.*;

public class TestServer
{
      public static void main(String[] args)
      {
          ORB orb = ORB.init (args, null);
          
          PPTServiceManagerImpl obj = new PPTServiceManagerImpl();
          
            try
            {
                  _CORBA.Orbix.impl_is_ready ("PPTSM");
            }
            
            catch (SystemException se)
            {
                  System.out.println ("Exception during impl_is_ready" + se.toString());
                  System.exit (1);
            }         
      }    
}

0
 
stimpyjcatCommented:
You've got a stack trace.  You've got the source code.  You should have a debugger.  You have all the tools you need to step through it to find out which argument you're passing in the CORBA call that is producing the null pointer exception (try pptUser).

The exception is happening in generated code, i.e. you're never reaching the method in your impl.

You need to examine the args you're passing (likely something is not initialized properly) and possibly the generated code (i.e. XXXStub) to see why it's doing an insert on the Any portion of your pptUser struct.

There isn't anything magical here that can't be found using standard debugging methods.  Don't be lazy and expect someone else to do the work for you.

0
 
objectsCommented:
Did you check out the null I mentioned above.
From memory, CORBA doesn't deal with null's that well.
0
 
hongndAuthor Commented:
hi stimpyjcat and objects,

I did things all of you say before I post source to here. But error still occurs. I think you had better test code which I posted and give me your asnswer about:
1. Is this OrbixWeb3.2's error when excecute nested struct
2. If not, do you have any decision to help me solve this error.

Thank for your help to solve this problem.
Hong
0
 
hongndAuthor Commented:
hi stimpyjcat and objects,

I did things all of you say before I post source to here. But error still occurs. I think you had better test code which I posted and give me your asnswer about:
1. Is this OrbixWeb3.2's error when excecute nested struct
2. If not, do you have any decision to help me solve this error.

Thank for your help to solve this problem.
Hong
0
 
stimpyjcatCommented:
The error occurs within code that is generated by Orbix's IDL compiler (com.gcs.wopi.idl2java._PPTServiceManagerStub.TxLogOnCheckReq).  Perhaps you could post that source code as well.

Guessing from the stack trace, the generated code is attempting to insert your pptUser struct into an Any, but failing to generate a struct TypeCode.  

You should certainly check the Orbix mailing lists to see if there are any known problems with nested structs.  You can also write a simple test case which attempts to insert one of your nested structs into an Any.  If that fails, then there is an Orbix problem.
0
 
phongntCommented:
Hi hongnd,
This is an error of OrbixWeb (an Iona product). You can get the latest patch is patch 13 at Iona at ftp.iona.com. For more information, please contact support@iona.com.
Regards,
Phong
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now