Highlighted
Absent Member.
Absent Member.
429 views

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

Using ucmdb server version 10.20 at 172.16.48.100 

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

Exception:
java.lang.NoClassDefFoundError: com/hp/ucmdb/api/client/session/SessionProperties
root cause being:
java.security.AccessControlException: access denied ("java.net.SocketPermission" "172.16.48.100 :8080" "connect,resolve")
from
com.hp.ucmdb.api.client.http.bootstrap.SDKClassLoader.downloadClassByteCode(SDKClassLoader.java:117)  

Javascript Executed:
Line 1: var serviceProvider = UcmdbServiceFactory.getServiceProvider("http","172.16.48.100",8080);
//FAILURE FROM HERE
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","172.16.48.100",8080);

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

com.hp.ucmdb.api.client.session.Session
com.hp.ucmdb.api.client.session.CustomerSession
com.hp.ucmdb.api.client.session.SessionProperty
com.hp.ucmdb.api.client.session.InternalCustomerContext
com.hp.ucmdb.api.client.http.bootstrap.SDKClassLoader and others

So the javascript code, has no problem interacting with 172.16.48.100 – 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 172.16.48.100 – 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)

 

0 Likes
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.