cancel
Showing results for 
Search instead for 
Did you mean: 

DB Look Ups : Error java.lang.NullPointerException

Former Member
0 Kudos

In my scenario i am using DB LOOK UPS IN UDF...

i am executing a select query with where clause..

i refered the below blogs..

Lookupu2019s in XI made simpler

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2219] [original link is broken] [original link is broken] [original link is broken];

i used JDBC receiver adapter only..

In a Bys System / Bys Serveice..

i am getting error , when i tested in Test mapping..

com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel DBase_CC (Party: , Service: BD1, Object ID: 0dcb4ab2b9533d6c8b7e77e0c32f3fc1) XI AF API call failed. Module exception: Error ACK handling failed: java.lang.NullPointerException. Cause Exception: (No information available).

Regards

AjayP

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This error occurs in your message mapping when your mapping doesnt produce a target element that has been mapped. Check your message mapping. If there are more than one occurrence in the target , then a value has to be present in runtime for each of the occurrence.

regards

chandra

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

At first glance it seems it can get the channel or the accessor, anyway

in order to see where the problem raised out, I would put some trace code in the UDF:


Channel channel = null;
DataBaseAccessor  accessor = null;
String Query =" ";
DataBaseResult  resultSet = null;

//trace
AbstractTrace trace;
 
Query = "Select USRID from  GODB.BATCHTABLES  where BID = '" + BID[0] + "' and SESSIONID = '" +  SESSIONID[0] +"' and GROUPID = '" + GROUPID[0] +"'";
 
try{
      //trace istance
      trace = container.getTrace();

      //trace to display query
      trace.addInfo("Query string:" + Query);

       channel = LookupService.getChannel("BD1","DBase_CC"); 
       
       //trace to check if the channel exsits
       if(channel == null){
	trace.addInfo("Cannot find the channel");
         }
       accessor = LookupService.getDataBaseAccessor(channel);
      
       //trace to check if the accessor exsits
        if(accessor == null){
	trace.addInfo("Accessor object null");
       }
       resultSet = accessor.execute(Query);
        
        //trace to check if the resulset exsits
        if(resultSet == null){
	trace.addInfo("Resulset null");
         }
        for(Iterator rows = resultSet.getRows();rows.hasNext();)
        {
           Map rowMap = (Map)rows.next();
           result.addValue((String)rowMap.get("USRID"));
         }
       }
       catch(Exception ex){
           result.addValue(ex.getMessage());
        }
 
        finally{
            try{
                 if (accessor!=null) accessor.close();
              }
            catch(Exception e){
                  result.addValue(e.getMessage());
            }
        }.

Then set the trace level to "All", and test it.

Another useful thing to do is to go to CC monitoring and see if there is further log info.

Regards,

Emiliano

Former Member
0 Kudos

Hi Emiliano & Ajay,

I am having the same requirement but my problem is i have the scenario RFC - SOAP and i need to query the DB for a particular filed in the SOAP structure as source and get the response back from the DB and map it to the target field in the RFC structure in the response mapping.

Is it possible to do it with out defining the DB structure in XI? any help or suggestions would be appreciated

Thanks,

Srini

Former Member
0 Kudos

Hi Srini,

it is possible to do that by following the weblog

[Lookupu2019s in XI made simpler|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2219] [original link is broken] [original link is broken] [original link is broken];

first of all you need to create a JDBC channel towards the DB.

When you map the response of the WebService, you need

to implement an UDF to get the channel for having the connection to the DB and make the query.

Regards,

Emiliano

Former Member
0 Kudos

Hi Emiliano,

Thanks for the quick reply and i have followed the web blog and i am getting the following error.

Problem when calling an adapter by using communication channel CC_JDBC_Reciver (Party: , Service: Srini_DEV, Object ID: d961bebff36a35bd9bd199e79be91a7b) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error when attempting to get processing resources: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: DriverManagerException: Cannot establish connection to URL 'jdbc:microsoft:sqlserver://XXX:1443;DatabaseName=WEBSERVICES01': SAPClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver'

any help would be appreciated

Thanks,

Srini

Edited by: srinivas kapu on Jun 9, 2008 8:16 AM

Edited by: srinivas kapu on Jun 9, 2008 8:17 AM

Edited by: srinivas kapu on Jun 9, 2008 8:18 AM

GabrielSagaya
Active Contributor
0 Kudos

thats the JDBC driver,did you install the drivers using SDM properly?

also have a look at the following

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bf4b1055-0d01-0010-32a3-b3848d77...

Former Member
0 Kudos

Hi Srini,

have a look at this thread:

Former Member
0 Kudos

the error details is :

Module exception: 'Error ACK handling failed: java.lang.NullPointerException'. Cause Exception: (No information available).

at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:131)

at com.sap.aii.ibrun.server.lookup.SystemAccessorInternal.execute(SystemAccessorInternal.java:68)

at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:149)

at com.sap.aii.ibrun.server.lookup.SystemAccessorHmiServer.process(SystemAccessorHmiServer.java:77)

at com.sap.aii.utilxi.hmis.server.HmisServiceImpl.invokeMethod(HmisServiceImpl.java:169)

at com.sap.aii.utilxi.hmis.server.HmisServer.process(HmisServer.java:178)

at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:296)

at com.sap.aii.utilxi.hmis.web.HmisServletImpl.processRequestByHmiServer(HmisServletImpl.java:211)

at com.sap.aii.utilxi.hmis.web.workers.HmisInternalClient.doWork(HmisInternalClient.java:70)

at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doWork(HmisServletImpl.java:496)

at com.sap.aii.utilxi.hmis.web.HmisServletImpl.doPost(HmisServletImpl.java:634)

at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))

at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java(Compiled Code))

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java(Compiled Code))

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java(Inlined Compiled Code))

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java(Compiled Code))

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java(Compiled Code))

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java(Compiled Code))

at com.sap.engine.services.httpserver.server.Client.handle(Client.java(Inlined Compiled Code))

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java(Compiled Code))

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java(Compiled Code))

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java(Compiled Code))

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java(Compiled Code))

at java.security.AccessController.doPrivileged1(Native Method)

at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java(Compiled Code))

Former Member
0 Kudos

hi ajay,

check the thread it is usefull

and blog

Lookupu2019s in XI made simpler

/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

regards

chandra

GabrielSagaya
Active Contributor
0 Kudos

This is timeout issue is never easy to solve.

For starters, have a look in your listener.ora file on the server where the database resides. See if you have the following parameters in your file:

CONNECT_TIMEOUT_LISTENER and CONNECT_TIMEOUT, if you set them both to 0 it will wait indefinately. Also have a look at network congestion at the time the timeouts occur.

http://en.allexperts.com/q/Oracle-1451/Solve-Time-problems.htm

Former Member
0 Kudos

My target MT is :

Result_MT 1..1

Userid 1..1

same as mentioned in blog.. provided in Ist thread link

i do'nt think its , a time out issue...

Regards

ajau p

Former Member
0 Kudos

My UDF has 3 input fields :-

the code which i used is :

Channel channel = null;
  DataBaseAccessor  accessor = null;
  String Query =" ";
  DataBaseResult  resultSet = null;
 
Query = "Select USRID from  GODB.BATCHTABLES  where BID = '" + BID[0] + "' and SESSIONID = '" +  SESSIONID[0] +"' and GROUPID = '" + GROUPID[0] +"'";

try{

channel = LookupService.getChannel("BD1","DBase_CC"); 
accessor = LookupService.getDataBaseAccessor(channel);
resultSet = accessor.execute(Query);

for(Iterator rows = resultSet.getRows();rows.hasNext();)
{
Map rowMap = (Map)rows.next();
result.addValue((String)rowMap.get("USRID"));
}
}
catch(Exception ex){
result.addValue(ex.getMessage());
}

finally{
try{
if (accessor!=null) accessor.close();
}
catch(Exception e){
result.addValue(e.getMessage());
}
}

Former Member
0 Kudos

hi ajay,

check the below thread for more info on it

regards

chandra