Solved

You can get up to 1000 points with this question

Posted on 2001-07-01
10
386 Views
Last Modified: 2012-06-22
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
Comment
Question by:hongnd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6243390
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
 
LVL 3

Expert Comment

by:stimpyjcat
ID: 6248490
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
 
LVL 5

Expert Comment

by:nebeker
ID: 6249783
You will need to post the section of IDL that contains:

TxLogOnCheckReq
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:hongnd
ID: 6251159
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
 
LVL 3

Expert Comment

by:stimpyjcat
ID: 6252309
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
 
LVL 92

Expert Comment

by:objects
ID: 6254215
Did you check out the null I mentioned above.
From memory, CORBA doesn't deal with null's that well.
0
 

Author Comment

by:hongnd
ID: 6254398
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
 

Author Comment

by:hongnd
ID: 6254472
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
 
LVL 3

Expert Comment

by:stimpyjcat
ID: 6255223
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
 

Accepted Solution

by:
phongnt earned 300 total points
ID: 6259027
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

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question