cancel
Showing results for 
Search instead for 
Did you mean: 

NullPointerException in WDSystemLandscape.getJCOClientConnection

Former Member
0 Kudos

Hi All,

In order to fetch jco details i am using the following code in a java class in java dc.The java dc is deployed using a j2ee server library DC and then i call the java method getPassword() in a web dynpro dc


public String getPassword()
	{
String password=null,strUser=null;
	try{
		String myDestination = "jcotest"; 
		IWDJCOClientConnection client = 
		   WDSystemLandscape.getJCOClientConnection(myDestination);
		   
		 strUser = client.getUser();
		password = client.getPassword();
			}
			catch(Exception e)
			{
				e.toString();
				password=+e.toString();
			}
	return password+"a"+strUser;
	}
}

Iam getting a nullpointer exception in IWDJCOClientConnection client =

WDSystemLandscape.getJCOClientConnection(myDestination);

Any pointers?The same code works fine in a standalone web dynpro dc application

Regards

Shilpa

Accepted Solutions (0)

Answers (1)

Answers (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Shilpa

It's easy to answer the question. Usage WebDynpro API outside WebDynpro applications is very restricted! The API will not work in standalone server library DCs. You can use the API only in WebDynpro application or at least in the places (libraries) directly invoked from WebDynpro application. Because the API requires opened WebDynpro client session. Without the session it'll not work.

In you case I'd suggest to use J2EE Destination Service API to work with JCo destinations (do not mix with WebDynpro JCo destinations).

BR, Siarhei

former_member187702
Active Participant
0 Kudos

Hi,

Thanks for the reply.

But incase if i use Destination Service it gives me class cast exception in

RFCDestination dst =

(RFCDestination) dstService.getDestination("RFC", "dst-2");

where dst-2 is a destination created in VA.

I need to fetch the details in java dc.So as to deploy it im deploying it in j2ee library server sc and calling the method in web dynpro dc to test the result.

Any poiters for the same as to the steps i should follow in order to use destination service.

Regards

Shilpa

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi

Class cast exception can indicate about wrong buildtime/runtime references to Destination Service DC. Right now I cannot say anymore because I do not know your server version and your references.

BR, Siarhei

former_member187702
Active Participant
0 Kudos

Hi,

Server version is sp16.

I have tried giving all type of refernces but no success.

If i can get step by step procedure how to fetch jco details would be of great help using destination service.

Regards

Shilpa

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Shilpa

See the following information about Destination Service:

[Destination Service API|http://help.sap.com/saphelp_nw70/helpdata/en/8b/8e7dac1e661d44bf2a676fd3948cc6/content.htm],

[Examples for Using the Destination Service API|http://help.sap.com/saphelp_nw70/helpdata/en/17/d609b48ea5f748b47c0f32be265935/content.htm]

BR, Siarhei