Absent Member.
Absent Member.

ucmdb 10.20: SecurityException while using Java 8, same code worked with Java 6

Using ucmdb server version 10.20 at 

After downloading ucmdb-api.jar, executing the javascript code to get the client context fails.
(Attached the full stack trace of the error)

java.lang.NoClassDefFoundError: com/hp/ucmdb/api/client/session/SessionProperties
root cause being:
java.security.AccessControlException: access denied ("java.net.SocketPermission" " :8080" "connect,resolve")

Javascript Executed:
Line 1: var serviceProvider = UcmdbServiceFactory.getServiceProvider("http","",8080);
Line 2: var clientContext = serviceProvider.createClientContext("UCSD");
Line 3: var credentials = serviceProvider.createCredentials("admin", "Temporal0");

Line 2/3 in reverse order also lands in this error.

Line 1 works: var serviceProvider = UcmdbServiceFactory.getServiceProvider("http","",8080);

During this step, from uCMDB/ucmdb-api.jar – there are HTTP GET calls which downloads various classes, namely:

com.hp.ucmdb.api.client.http.bootstrap.SDKClassLoader and others

So the javascript code, has no problem interacting with – ucmdb server and getting data from it.

Now when the class: com.hp.ucmdb.api.client.http.bootstrap.SDKClassLoader
tries to download more classes from – ucmdb server – it complains about java.net.SocketPermission – connect,resolve.

(This happens in the next line: var clientContext = serviceProvider.createClientContext("UCSD");)

Probably the SDKClassLoader context does not have this permission given to it.
Is there a way to give this permission to the ClassLoader downloaded from ucmdb server.

The same code works in java 6 context (nashorn vs rhino context would come into the picture)


The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.