Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

when cast Service to IClusterInformation ava.lang.NoClassDefFoundError:

Hi experts,

want to use the Portal Service IClusterInformation in an Abstract Portal Application. To do so I have imported / added

- the jar com.sap.portal.runtime.system.clusterinformation_api.jar to the project

- and the reference <property name="ServiceReference" value="com.sap.portal.runtime.system.clusterinformation"/> to portalapp.xml

IPortalRuntimeResources runtimeResources = PortalRuntime.getRuntimeResources();
IService iService = runtimeResources.getService("com.sap.portal.runtime.system.clusterinformation.clusterinformation");
//response.write(iService.getKey());
IClusterInformation clusterInfo = (IClusterInformation)iService;   <-- EXCEPTION

In the cast IClusterInformation (last line of code) i get the exception java.lang.NoClassDefFoundError: com/sapportals/portal/prt/service/clusterinformation/IClusterInformation

The application is running on EP70 SP16

What I am doing wrong !?!? Can anybody help me, please ?

Regards

Flo

replied

Hi,

I tried this its working fine

Abstract Portal Component

IPortalRuntimeResources runtimeResources =	PortalRuntime.getRuntimeResources();
		IService aService =
		runtimeResources.getService(IClusterInformation.KEY);
		IClusterInformation myService = (IClusterInformation)aService;
		
		String lok = myService.getSAPJ2EEServerDirectory();
		response.write(lok);

Portalapp.xml

<application>
  <application-config>
    <property name="SharingReference" value="com.sap.portal.runtime.system.clusterinformation"/>
  </application-config>
  <components>
    <component name="accesservice">
      <component-config>
        <property name="ClassName" value="com.lok.accesservice"/>
      </component-config>
      <component-profile/>
    </component>
  </components>
  <services/>
</application>

Thanks & Regards,

Lokesh

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question