Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Trigger Java Class from In-line Preprocessor during User import from Schema upload.

SugandhaVarma
New Contributor
New Contributor

Hey Techies,

I have configured a .sav file to upload users and want to validate email uniqueness against 1. Saviynt and 2. AD(all the domains) before assigning it to the respective user. To achieve this I configured an In-line preprocessor to trigger a custom Jar. But somehow I am getting an error saying Class not found.

I did following steps:

1. Created a jar file compiled on  Java Version 1.8

2. Uploaded the Jar from File Directory under External Jar.

3. Created a inline JSON :

{
  "ADDITIONALTABLES": {
    "USERS": "SELECT * FROM USERS"
  },
  "COMPUTEDCOLUMNS": [
    "CUSTOMPROPERTY50"
  ],
  "PREPROCESSQUERIES": [
    "CUSTOMFUNCTION###FUNCTION1"
  ],
  "CUSTOMFUNCTIONS": {
    "FUNCTION1": {
      "FULLCLASSNAME": "com.saviynt.utility.connection.EmailGenerationHandler",
      "METHODNAME": "doCustomPreprocess"
    }
  }
}

We are not consuming AD's check for unique as we want to generate and assign email to the user during its creation and before provisioning it to AD.

2022.x

regards,

Sugandha

16 REPLIES 16

sk
All-Star
All-Star

Did you upload the custom jar to Saviynt and then restarted the application?

If not please upload the custom jar to Saviynt under location Admin -> Settings -> File Directory -> External JARs and then use Upload New File Option to upload the JAR

sk_0-1679929918561.png

 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

Yes I have followed all the steps.

DixshantValecha
Saviynt Employee
Saviynt Employee

I would like to inquire whether you have successfully uploaded the custom jar to Saviynt and restarted the application. If not, I kindly suggest that you upload the custom jar to Saviynt by navigating to the Admin -> Settings -> File Directory -> External JARs location and using the "Upload New File" option to upload the JAR.

extjar.png

SugandhaVarma
New Contributor
New Contributor

Yes I have followed  Admin -> Settings -> File Directory -> External JARs and restarted the Application. 

I was able to consume Java file present in 

https://docs.saviyntcloud.com/bundle/SSM-Admin-v55x/page/Content/Chapter03-User-Management/User-Impo...

the logic worked for me. But as soon as I uploaded my own class it errored out. Am I missing any configuration?

Pls share the MODIFYUSERDATAJSON, Logs


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

{
  "ADDITIONALTABLES": {
    "USERS": "SELECT * FROM USERS"
  },
  "COMPUTEDCOLUMNS": [
    "CUSTOMPROPERTY50"
  ],
  "PREPROCESSQUERIES": [
    "CUSTOMFUNCTION###FUNCTION1"
  ],
  "CUSTOMFUNCTIONS": {
    "FUNCTION1": {
      "FULLCLASSNAME": "com.saviynt.utility.connection.EmailGenerationHandler",
      "METHODNAME": "doCustomPreprocess"
    }
  }
}

ecm,"2023-03-24T16:24:06.931+00:00","{"log":"java.lang.ClassNotFoundException: com.saviynt.utility.connection.EmailGenerationHandler\n","stream":"stdout","time":"2023-03-24T16:24:06.341114667Z"}"

 

Since you mentioned that you have uploaded new jar and still facing issue after restart. I assume may be it is looking for same class name as mentioned in doc. Did you try building your logic in same class and see if it works? Also make sure that you are not looking for any additional arguments to be passed as this logic doesn't support additional arguments other than default(Connection connection, Map tempTableNamesMap)


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

SugandhaVarma
New Contributor
New Contributor

If I use same class with different logic I can see the logic is picked from the documented code. And I have not added any argument. Replicated what's there in the doc and FAQ. Its just I have created a new class and the class is not getting picked up. 

Hemanath
Saviynt Employee
Saviynt Employee

Hi @SugandhaVarma ,

Have you added fileDirectory.externalJarPath=/application_instance/custom_code/saviynt/Import/externalJar/ in externalconfig.properties file?

if not please add and restart the service

And also creating indexing for the tables that you are consuming within the preprocess will help system performance

 

Thanks,

Hemanath J

SugandhaVarma
New Contributor
New Contributor

@Hemanath 

Does this look good to you? Or do i need to pass class name as well? it is still giving me same error 

SugandhaVarma_0-1680037126227.png

ecm,"2023-03-28T20:51:44.766+00:00","{"log":"java.lang.ClassNotFoundException: com.saviynt.utility.connection.EmailGenerationHandler\n","stream":"stdout","time":"2023-03-28T20:51:44.12913909Z"}"

SugandhaVarma
New Contributor
New Contributor

@Hemanath any input on this.?

@SugandhaVarma - have you done restart after the changes in properties

Yes,  do you think entry looks fine or do i need to mention jar file name as well?

Hemanath
Saviynt Employee
Saviynt Employee

@SugandhaVarma can you share your jar?

SugandhaVarma
New Contributor
New Contributor

hey,

please find the jar file.

Hemanath
Saviynt Employee
Saviynt Employee

Hi @SugandhaVarma 

try with attached one and package name  com.saviynt.preprocessor.connection.ConnectionUtlityService 

method name doCustomPreprocess