Class: MediaType not found in namespace

Which IIQ version are you inquiring about?

8.4

Please share any images or screenshots, if relevant.

[Please insert images here, otherwise delete this section]

Please share any other relevant files that may be required (for example, logs).

[Please insert files here, otherwise delete this section]

Share all details about your problem, including any error messages you may have received.

Exception during aggregation. Reason: java.lang.RuntimeException: sailpoint.connector.ConnectorException: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: ``import sailpoint.object.QueryOptions; import sailpoint.object.Filter; import . . . ‘’ : Typed variable declaration : Class: MediaType not found in namespace : at Line: 82 : in file: inline evaluation of: ``import org.apache.log4j.Logger; import sailpoint.object.Application; import . . . ‘’ : MediaType Called from method: reassignTASK : at Line: 13 : in file: inline evaluation of: ``import sailpoint.object.QueryOptions; import sailpoint.object.Filter; import . . . ‘’ : reassignTASK ( application , object .getAttribute ( "sys_id" ) , "Identity Not Correlated" , "Global Office 365" ) BSF info: Orbia-ServiceNow-ResourceObjCustomization at line: 0 column: columnNo

Hi,

could you please confirm whether the correct package for the MediaType class has been imported? It might be missing, which could be causing the error.

Thank you.

Class MediaType not found in namespace suggests that you are missing import statement for MediaType class. Please add the import statement and retry.

Hi Vijay,

This is what i am struggling which class file is missing. I check in the entire system and unable to find class as mediatype. Please help as how to find the class file

thanks

Amit

Hi Sanjeev,

import com.squareup.okhttp.MediaType; statmenet is there it’s still failing

thanks

Amit

Then it seems to be conflicting with another class with same name for example “javax.ws.rs.core.MediaType;”. You can try to call your class using the full package name so that it does not confuse it with another class.

It looks like the issue isn’t just about the import but about which MediaType class is actually available in IdentityIQ.

There are two common MediaType classes you may be running into:

  • javax.ws.rs.core.MediaType → included with JAX-RS and usually available in IIQ.

  • com.squareup.okhttp.MediaType / okhttp3.MediaType → part of the OkHttp client library, which is not bundled with IIQ unless you explicitly add the JARs under WEB-INF/lib.

If you’ve already tried import com.squareup.okhttp.MediaType; but the JAR isn’t on your IIQ classpath, it will fail. That’s why you can’t find the class file in your system.

If you are making REST calls from workflows or rules, use javax.ws.rs.core.MediaType instead, since it’s already present. Example:

import javax.ws.rs.core.MediaType;

String contentType = MediaType.APPLICATION_JSON;

If you specifically need OkHttp, then you’ll have to add the appropriate OkHttp JAR (which provides okhttp3.MediaType) into IIQ’s WEB-INF/lib directory and reference it directly.

Hi @ayadav_12

Hi, I noticed that IdentityIQ provides two out-of-the-box import options for MediaType without requiring any external JARs:

  1. import okhttp3.MediaType;

  2. import javax.ws.rs.core.MediaType;

You can choose either of these based on your implementation needs.

Thank you.