cancel
Showing results for 
Search instead for 
Did you mean: 

NullPointerException while using ICacheService interface.

former_member185029
Active Contributor
0 Kudos

Hello Xperts,

I am using ICacheService and following part of code is throws exception

		
ICacheService cache = (ICacheService) PortalRuntime.getRuntimeResources().getService(ICacheService.KEY);
			
cache.put(EB_Constants.CKEY_COMPANIES, companies, true);

Any idea if I am missing any configuration on the server?

-Ashutosh

Accepted Solutions (1)

Accepted Solutions (1)

pravesh_verma
Active Contributor
0 Kudos

Hi Ashutosh,

Are you just trying to do this by "Deploy Archive and Run"?? If yes then try testing your application, by creating an iView in the portal.

Since you are using PortalRuntime class (ICacheService ), therefore you have to take the PRT runtime to successfully execute the ICacheService interface. It will receive an object reference only if it is able to find that class. And this class will be available only at PRT level.

I hope this solves the issues.

Thanks and Regards

Pravesh

former_member185029
Active Contributor
0 Kudos

Hi Parvesh,

The application is running inside the portal environment as an Iview.

Still the same exception is thrown.

-Ashutosh

Answers (2)

Answers (2)

Former Member
0 Kudos

check if the cache is null before using it

maybe those help

/message/209202#209202 [original link is broken]

Former Member
0 Kudos

Hi,

create an iView in the portal and then test your application.

You are using PortalRuntime class, may be this class is not getting the object reference so you are getting this exception when you deploy and run...

Regards,

Saleem