Highlighted
Absent Member.
Absent Member.
141 views

Re: Error when calling java class from policy

java.lang.Exception is a very generic exception and I wouldn't expect anything
in the IDM code to be throwing it, so I'm guessing something in your code or the
code being called by your code is throwing it.

But there is a slight chance it has something to do with the fact that your
extension function is declared as void but you are using it in a context that
wants a string to be returned. If that is what the problem is, it should go away
if you change the type of the variable you are assigning it to to be java object
instead of string.

moularbi <moularbi@no-mx.forums.novell.com> wrote:

>

Hi,
> I'm trying to call a java class from a policy:
>
> Action:

do-set-local-variable("association",scope="policy",token-xpath
("UARoleTools:setResourceAssociation($host,$port,$context,$username,$password,
$role-dn,$ressource-dn)")).
> arg-string(token-xpath("UARoleTools:setResourceAssociation($host,$port,

$context,$username,$password,$role-dn,$ressource-dn)"))
> token-xpath("UARoleTools:setResourceAssociation($host,$port,$context,

$username,$password,$role-dn,$ressource-dn)")
>
> I'm getting this error:
> Error evaluating XPATH expression

'token-xpath("UARoleTools:setResourceAssociation($host,$port,$context,$username,
$password,$role-dn,$ressource-dn)")'
: com.novell.xml.xpath.XPathEvaluationException: function call to
'UARoleTools:setResourceAssociation' resulted in an error:
'java.lang.Exception'.
>
> My class is public, the method is public static void, I put the jar

file in /opt/novell/eDirectory/lib/nds-modules/dirxml/classes


--
Shon

Labels (1)
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

Re: Error when calling java class from policy

On 6/25/12 11:16 AM, moularbi wrote:
>
> I found where the problem is coming from. My policy is supposed to
> create a resource manually then calls the function above which calls a
> web service to associate the resource to a role. The problem is that the
> web service is executed before the resource is created in the directory.
> How can I fix this?
>
>


Make sure that when you create the resource manually, you use
when=direct, and put your call to the web service in a downstream policy
so that it won't get call until after the resource is created.

Alternatively, don't use direct, and use the resulting status to trigger
the web service call. Use an operation property to tag the operation so
you can recognize the status as belonging to your resource and pass the
relevant information about the resource. This way is more convoluted,
but has the advantage of being able to detect if the resource creation
succeeded before making the web service call.


--
Shon
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.