cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynpro : Null Pointer Exception : at Constructor

Former Member
0 Kudos

Hi,

I am trying to use the Bapi (BAPI_Gl_Acc_GetList)

I am getting java.lang.null pointer exception at the following line of code ; the portion of the code marked in bold ... while instantiating the Bapi_Gl_Acc_Getlist_Input Class.

public void wdDoInit()

{

//@@begin wdDoInit()

<b> Bapi_Gl_Acc_Getlist_Input input = new Bapi_Gl_Acc_Getlist_Input();</b>

wdContext.nodeBapi_Gl_Acc_Getlist_Input().bind(input);

////input.setCompanycode("1000");

//@@end

}

<b>Please help me in solving this.

Thanks

Satya</b>

<b>The exact stack trace is attached below</b>

java.lang.NullPointerException

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModelClass.createNewBaseTypeDescriptor(AiiModelClass.java:220)

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModelClass.descriptor(AiiModelClass.java:186)

at com.sap.demo.model.Bapi_Gl_Acc_Getlist_Input.<init>(Bapi_Gl_Acc_Getlist_Input.java:51)

at com.sap.demo.TestView1.wdDoInit(TestView1.java:98)

at com.sap.demo.wdp.InternalTestView1.wdDoInit(InternalTestView1.java:140)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)

at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:134)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:371)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:599)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

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

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

You are getting null pointer exception that means system is expecting value and you are not passing it.

Mandatory company code is commented,so we can understand the reason for null pointer.

do this

Bapi_Gl_Acc_Getlist_Input input = new Bapi_Gl_Acc_Getlist_Input();

input.setCompanycode("1000");

wdContext.nodeBapi_Gl_Acc_Getlist_Input().bind(input);

Former Member
0 Kudos

Hi.

I'm think that problem on the backend - types of parameters. They cannot be int. tables, strings, refs and ...

Former Member
0 Kudos

Hello

Dont know if this is the case for all related problems but I hade the same error.

I generated RFC model from DEV server, but my JCo was configured to access QAS system. So there are 2 solving scenarios for this silly problem

a) Transport ABAP objects

b) Change RFC destination and restart Java instance.

Dmitrij.

Edited by: Dmitrij M. on Jul 7, 2009 4:06 PM

tom_parle3
Explorer
0 Kudos

did you find a solution to this error?

Former Member
0 Kudos

Hi,

have u applied the action template for the button and choosen the bapi's execute method?

if not, u have to explicitly call the execute method for the bapi.

if u try to use the bapi before calling its execute method, it gives you a null pointer exception.

if u have created a button in the onaction method call the execute method of the bapi.

Regards,

Satya.

Former Member
0 Kudos

Hi,

I am getting the same error. I have no idea, what is the difference between the other ~200 RFCs I am using without any problems. I am so frustrated.

The problem is (as already mentioned by satya) in the constructor of the modelnode:

descriptor( com.sap.tc.webdynpro.modelimpl.dynamicrfc.RFCMetadataRepository.getSingleton(de.amadeus.iflt.dispool.models.GetPcDrvForTicket.DEFAULT_RFCMETADATA_SYSTEMNAME),
                       de.amadeus.iflt.dispool.models.GetPcDrvForTicket.wdGetStaticMetadataCache().getBaseTypeDescriptorMap(),
                       __Iflt__Get_Pc_Drv_For_Ticket_Input.class,
                       "/IFLT/GET_PC_DRV_FOR_TICKET",
                       PROXYTYPE_INPUT, 
                       "__Iflt__Get_Pc_Drv_For_Ticket_Input", 
                       "de.amadeus.iflt.dispool.models" )

I just initialize the modelnode with the following line:

__Iflt__Get_Pc_Drv_For_Ticket_Input nodeInput = new __Iflt__Get_Pc_Drv_For_Ticket_Input();

This line returns the following NullPointerException:

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModelClass.createNewBaseTypeDescriptor(AiiModelClass.java:256)
    at com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModelClass.descriptor(AiiModelClass.java:222)
    at de.amadeus.iflt.dispool.models.__Iflt__Get_Pc_Drv_For_Ticket_Input.<init>(__Iflt__Get_Pc_Drv_For_Ticket_Input.java:51)
    at flt.pool.dis.DispCustController.getTicket(DispCustController.java:3310)

After reading a lot of threads about this issue I already restarted the complete server multiple times, already reimported the model about 10 times, completely reset the Development Component and "recoded" everything without any success.

@Satya: I didn't understand your last post. What do you mean by "if u try to use the bapi before calling its execute method, it gives you a null pointer exception.". Do you want to say, that you can't execute the bapi as long as the model node is not bound?

This issue makes me sick :-/... Please help me!!!

Any suggestions are appreciated!

With best regards,

Markus

Former Member
0 Kudos

Satya,

Funny, how far invocation stack trace is got in your case

Most probable reason that you have some changes at back-end, that is not compatible with generated Adaptive RFC model. So right-click on model and re-generate it.

In any case, verify that your RFC connecions are ok (you can both ping them and connect)

VS

Former Member
0 Kudos

Hi,

I have done reimport of the model again. still I am getting the same error. My RFC connection are ok and also JCO connection is also working fine. I am able to test and Ping successfully.

Inform me if there is in any setup issue with this?

Regards

satya

Former Member
0 Kudos

Hi Satya,

After reimporting did you re-start the server?

If not restart it. Because the J2EE engine caches the provious things.

I guess after re-start it will be ok.

Thanks and regards

RK.

Former Member
0 Kudos

I have restarted the Server and still I am getting the same error.

Please provide some suggestion on this.

satya

Former Member
0 Kudos

Hi Valery,

Do you have any suggestion on this? I am not able to proceed further.

One thing I am surprised that the Tutorial examples are working fine but when I am trying with the simplet BAPI it is giving exception.

Thanks

Satya

Former Member
0 Kudos

Please provide me some suggestion on this.

Former Member
0 Kudos

HI Panda,

DO you go through FlightList_init() example.

For BAPI functionality u can go through this example is easy to do.

If your all connections are Correct.

After following this.

Let me know any issues .

Thanks

Nageswara.

Former Member
0 Kudos

Hi,

I have gone through the FlightList_Init() examples and deployed that successfully but though I have followed exactly the same procedure for this case I am getting exception.

Please go through the complete stack trace and see if you can help me out.

Thanks

Satya

Former Member
0 Kudos

Hi,

Can you seen this what is this line mean.

wdDoInit(InternalTestView1.java:140)

Otherwise What you mention in exception.

send me that Cotrollerview code .

Thanks

nageswara.

Former Member
0 Kudos

Hi,

Can I contact you over email or phone?

This is the code (bold portion)at the line number which you have mentioned.

/**

  • Hook method called to initialize view controller.

*/

public void wdDoInit() {

logger.pathT("entering: wdDoInit");

<b>delegate.wdDoInit();</b>

logger.pathT("exiting: wdDoInit");

}

Thanks

Satya

Former Member
0 Kudos

HI Panda,

Are you through the Flight_init(), then what is the problem man.

Same procedure you have to follow yar.

First step Create your BAPI make it RFC enable and check your connection.

After Import your BAPI.

After that you need to create CustomeController you call follow as usaul in Flight_list .

Do you that Document follow stepwise .

Then you doesnt have any problem let me know .

Send me your controller code yar .

this is document.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/creating a web dynpro application accessing abap functions.pdf

Thanks

Nageswara.

Former Member
0 Kudos

Hi Nageswar,

I have followed the exact step as for flightlist_Init().

In my case the flightlist_init() as well as FlightBooking is working fine.

but I am getting the error in case of <b>(Bapi_Gl_Acc_Getlist)</b>.

I am attaching the controller code with this. It could be better if I will get your mail ID so that I can send you everything in detail.

My mail ID p_satya123@yahoo.com.

<b>Please find the code of Controller.java</b>

_________________________________________________________

// -


// This file has been generated partially by the Web Dynpro Code Generator.

// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.

// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.

// -


package com.sap.demo;

//

// IMPORTANT NOTE:

// ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED

// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN

// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR IPrivateAccountListController).

// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY

// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS

// OF IMPORT STATEMENTS.

//

//@@begin imports

import com.sap.demo.model.Bapi_Gl_Acc_Getlist_Input;

import com.sap.demo.wdp.IPrivateAccountListController;

//@@end

//@@begin documentation

//@@end

public class AccountListController

{

/**

  • Logging location.

*/

private static final com.sap.tc.logging.Location logger =

com.sap.tc.logging.Location.getLocation(AccountListController.class);

static

{

//@@begin id

String id = "$Id$";

//@@end

com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);

}

/**

  • Private access to the generated Web Dynpro counterpart

  • for this controller class. </p>

*

  • Use <code>wdThis</code> to gain typed access to the context,

  • to trigger navigation via outbound plugs, to get and enable/disable

  • actions, fire declared events, and access used controllers and/or

  • component usages.

*

  • @see com.sap.demo.wdp.IPrivateAccountListController for more details

*/

private final IPrivateAccountListController wdThis;

/**

  • Root node of this controller's context. </p>

*

  • Provides typed access not only to the elements of the root node

  • but also to all nodes in the context (methods node<i>XYZ</i>())

  • and their currently selected element (methods current<i>XYZ</i>Element()).

  • It also facilitates the creation of new elements for all nodes

  • (methods create<i>XYZ</i>Element()). </p>

*

  • @see com.sap.demo.wdp.IPrivateAccountListController.IContextNode for more details.

*/

private final IPrivateAccountListController.IContextNode wdContext;

/**

  • A shortcut for <code>wdThis.wdGetAPI()</code>. </p>

  • Represents the generic API of the generic Web Dynpro counterpart

  • for this controller. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDController wdControllerAPI;

/**

  • A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>

  • Represents the generic API of the Web Dynpro component this controller

  • belongs to. Can be used to access the message manager, the window manager,

  • to add/remove event handlers and so on. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;

public AccountListController(IPrivateAccountListController wdThis)

{

this.wdThis = wdThis;

this.wdContext = wdThis.wdGetContext();

this.wdControllerAPI = wdThis.wdGetAPI();

this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

}

//@@begin javadoc:wdDoInit()

/** Hook method called to initialize controller. */

//@@end

public void wdDoInit()

{

//@@begin wdDoInit()

Bapi_Gl_Acc_Getlist_Input input = new Bapi_Gl_Acc_Getlist_Input();

wdContext.nodeBapi_Gl_Acc_Getlist_Input().bind(input);

input.setCompanycode("1000");

//@@end

}

//@@begin javadoc:wdDoExit()

/** Hook method called to clean up controller. */

//@@end

public void wdDoExit()

{

//@@begin wdDoExit()

//@@end

}

//@@begin javadoc:executeBapi_Gl_Acc_Getlist_Input()

/** Declared method. */

//@@end

public void executeBapi_Gl_Acc_Getlist_Input( )

{

//@@begin executeBapi_Gl_Acc_Getlist_Input()

try

{

// Calls remote function module BAPI_GL_ACC_GETLIST

wdContext.currentBapi_Gl_Acc_Getlist_InputElement().modelObject().execute();

}

catch (Exception ex)

{

// If an exception is thrown, then the stack trace will be printed

ex.printStackTrace();

}

// Synchronise the data in the context with the data in the model

wdContext.nodeOutput().invalidate();

//@@end

}

/*

  • The following code section can be used for any Java code that is

  • not to be visible to other controllers/views or that contains constructs

  • currently not supported directly by Web Dynpro (such as inner classes or

  • member variables etc.). </p>

*

  • Note: The content of this section is in no way managed/controlled

  • by the Web Dynpro Designtime or the Web Dynpro Runtime.

*/

//@@begin others

//@@end

}

Former Member
0 Kudos

HI Panda,

Did you done the Model binding.

This method can add in between try catch and try.

not in outside of try catch.

wdContext.nodeOutput().invalidate();

Thanks

Nageswara.

Former Member
0 Kudos

Satya,

Your code looks ok.

It seems that error is related to loading metadata for your BAPI. Do you use predefined user for metadata connection? Does it the same user you are using during Adaptive RFC model import?

VS

Former Member
0 Kudos

Thanks for your reply. Yeah I have used the same user ID in both the case.

I have executed the BAPI in SAP R/3 with the same user ID and it is giving me proper data.

Thanks&Regards

Satya

Former Member
0 Kudos

Hi,

I tried to debug the application and it is failing in constructor call of Bapi_Gl_Acc_Getlist_Input.java file.

The code sniplet where the null pointer exception is coming is attached below.

Please check the code marked in Bold. The descriptor method of AiiModelClass is returning null pointer exception.

super

(<b>descriptor( com.sap.tc.webdynpro.modelimpl.dynamicrfc.RFCMetadataRepository.getSingleton(com.sap.tcs.demo.model.GLAccountListModel.DEFAULT_RFCMETADATA_SYSTEMNAME), com.sap.tcs.demo.model.GLAccountListModel.wdGetStaticMetadataCache().getBaseTypeDescriptorMap(),

Bapi_Gl_Acc_Getlist_Input.class,

"BAPI_GL_ACC_GETLIST",

PROXYTYPE_INPUT,

"Bapi_Gl_Acc_Getlist_Input",

"com.sap.tcs.demo.model" )</b>, staticGenerationInfo);

Thanks

Satya

Former Member
0 Kudos

Hi,

I have the same problem with Netweaver 2004s and ECC6.0.

The JCO and SLD works fine. The J2EE Server has been restarted and the problems continues.

Do you have an idea to help me ?

Thanks

Former Member
0 Kudos

Hi,

I have the same problem!

Executing standard BAPIs like BAPI_FLIGHT_GETLIST is ok but custom bapis don't works.

java.lang.NullPointerException

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModelClass.createNewBaseTypeDescriptor(AiiModelClass.java:256)

at com.sap.tc.webdynpro.modelimpl.dynamicrfc.AiiModelClass.descriptor(AiiModelClass.java:222)

at com.unilog.zflight.model.Zbapi_Flight_Getlist_Input.<init>(Zbapi_Flight_Getlist_Input.java:51)

at com.unilog.zflight.ZflightComp.wdDoInit(ZflightComp.java:101)

at com.unilog.zflight.wdp.InternalZflightComp.wdDoInit(InternalZflightComp.java:173)

I have a double stack Java-ABAP server nw2004s SP10.

If I execute it from a developer workplace SP9 it is working fine...

Any ideas?

Regards,

Claire

abhijeet_mukkawar
Active Contributor
0 Kudos

hi,

check out this thread, same like your problem

regards

appreciate answer if it helps

Former Member
0 Kudos

Hi all!

I have the same error.

I tried everything mentioned in this thread, but i'm not able to get it running.

My JCo destination also works, I can test it and ping the infrastructure.

Is there a working solution up to now?

Thanks for any help,

best regards

Edited by: Martin Rainer on Jul 9, 2008 12:17 PM