File Upload in IdentityIQ

Which IIQ version are you inquiring about?

8.4

Hi Experts,

Was trying to develop file upload utility in identityiq8.4 referring to this Upload file QuickLink - Compass

Stuck at below error while click submit button. Anyone has any idea?

<EventMessage>Caught unhandled JSF exception: Unable to create managed bean fileUploadClass.  The following problems were found:
     - Bean or property class sailpoint.services.standard.fileUpload.FileUploadClass for managed bean fileUploadClass cannot be found.</EventMessage>
  <Stacktrace>com.sun.faces.mgbean.ManagedBeanCreationException: Unable to create managed bean fileUploadClass.  The following problems were found:
     - Bean or property class sailpoint.services.standard.fileUpload.FileUploadClass for managed bean fileUploadClass cannot be found.

xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:c="http://java.sun.com/jstl/core" 
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:t="http://myfaces.apache.org/tomahawk"
	  xmlns:sp="http://sailpoint.com/ui"
      xmlns:p="http://primefaces.org/ui">

<h:body>
<ui:composition template="/ngAppPage.xhtml">
<ui:define name="body">
    <h:form enctype="multipart/form-data">

        <p:panel header="Upload Section"
                 style="padding:1.5rem; background-color:#f9f9f9; border:1px solid #ccc; border-radius:8px; box-shadow:0 0 5px rgba(0,0,0,0.1);">

            <f:facet name="header">
                <h:outputText value="File Upload Section"
                              style="font-size:2rem; color:#037DA1; font-weight:bold;" />
            </f:facet>

            <h:panelGrid columns="1" style="row-gap:1rem;">

                <h:outputLabel value="📁 File Upload to Server"
                               style="font-weight:bold; font-size:1.2rem; color:#333;" />

                <p:fileUpload value="#{fileUploadClass.uploadFile}" 
                              mode="simple" 
                              dragDropSupport="true" 
                              update="messages"
                              style="width:100%; font-weight:bold; font-size:1.2rem; color:#333;" />

                <h:commandButton value="Submit"
                                 action="#{fileUploadClass.uploadFileMethod}"
                                 style="margin-top:3rem; background-color:#007ad9; color:white; padding:0.5rem 1rem; border:none; border-radius:4px;"
                                 onmouseover="this.style.backgroundColor='#005ea3';"
                                 onmouseout="this.style.backgroundColor='#007ad9';" />

            </h:panelGrid>

        </p:panel>

        <h:messages id="messages" style="margin-top:1rem; font-size:0.95rem; color:#444;" />

    </h:form>
</ui:define>
</ui:composition>
</h:body>
</html>

java class:

package sailpoint.services.standard.fileUpload;

import org.primefaces.model.UploadedFile;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import java.io.*;

@ManagedBean(name = "fileUploadClass")
@SessionScoped
public class FileUploadClass {

    private UploadedFile uploadFile;

    public UploadedFile getUploadFile() {
        return uploadFile;
    }

    public void setUploadFile(UploadedFile uploadFile) {
        this.uploadFile = uploadFile;
    }

    public String uploadFileMethod() {
        if (uploadFile != null) {
            String destinationPath = "C:\\temp\\" + uploadFile.getFileName();  // Example path
            try (InputStream input = uploadFile.getInputstream();
                 OutputStream output = new FileOutputStream(destinationPath)) {

                byte[] buffer = new byte[1024];
                int bytesRead;

                while ((bytesRead = input.read(buffer)) != -1) {
                    output.write(buffer, 0, bytesRead);
                }

                System.out.println("File uploaded to: " + destinationPath);

            } catch (IOException e) {
                System.err.println("Upload failed: " + e.getMessage());
            }
        }
        return null; // stay on the same page
    }
}

Faces-config:

  <managed-bean>
    <managed-bean-name>fileUploadClass</managed-bean-name>
    <managed-bean-class>sailpoint.services.standard.fileUpload.FileUploadClass</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

  <navigation-rule>
    <description>fileUpload</description>
    <from-view-id>*</from-view-id>
    <navigation-case>
        <from-outcome>FileUploadClass</from-outcome>
        <to-view-id>/workitem/fileUpload.xhtml</to-view-id>
        <redirect />
    </navigation-case>
  </navigation-rule>

Screenshot:
1.

Hi @Bernardc ,

You’re on the right track with trying to implement a file upload utility in IdentityIQ 8.4, but the error message you’re seeing means that IIQ can’t find or load your FileUploadClass bean, which typically points to one of the following root causes:


:cross_mark: Root Cause: Custom Class Not Available in Classpath

IdentityIQ does not automatically pick up your Java class just because it’s referenced in an .xhtml or faces-config.xml file. For a class like sailpoint.services.standard.fileUpload.FileUploadClass to be available:

  • It must be compiled
  • It must be placed in the correct location under $IIQ_HOME/WEB-INF/classes (for exploded deployments), or inside the deployed .war or .ear
  • IIQ must be restarted so the class loader sees it

:white_check_mark: Fix Steps

1. Compile the Class

Compile your FileUploadClass.java using a JDK version compatible with your IIQ environment (typically Java 8 for IIQ 8.4):

javac -cp "identityiq.jar:other-needed-jars" FileUploadClass.java

You must ensure you compile it into the correct package path:

sailpoint/services/standard/fileUpload/FileUploadClass.class

2. Place the Class in the Runtime Classpath

Move the .class file into the correct directory:

cp sailpoint/services/standard/fileUpload/FileUploadClass.class $IIQ_HOME/WEB-INF/classes/sailpoint/services/standard/fileUpload/

If you’re using a WAR or EAR deployment, you’d need to repack and redeploy.

:check_box_with_check: Note: Create the directory structure if it doesn’t exist.


3. Restart IdentityIQ

After placing the .class file, restart Tomcat (or your app server) so IdentityIQ picks up the new bean.


4. Consistency Check

You declared the bean in faces-config.xml like this:

<managed-bean>
  <managed-bean-name>fileUploadClass</managed-bean-name>
  <managed-bean-class>sailpoint.services.standard.fileUpload.FileUploadClass</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

:green_circle: This is fine, but make sure the class name and package exactly match the path and compiled class.


:test_tube: Optional Tip: Test with a Simpler Bean First

If you’re unsure your deployment is picking up custom classes correctly, try deploying a basic HelloWorldBean first to confirm the class loading works.

Hope this helps! :rocket: Let me know if you have any questions.

Hi @angelborrego ,

A really big thanks for your response! It was really helpful and easy to understand!

However, I tried to compile my class with below prompt:

First, I change directory to “C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\identityiq\WEB-INF\classes\sailpoint\services\standard\fileUpload” first and enter below prompt:

javac -cp "identityiq.jar;primefaces-9.0.12.jar;javax.faces-2.2.20.jar" FileUploadClass.java

But some errors occur and even if I included the required .jar in my prompt.

C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\identityiq\WEB-INF\classes\sailpoint\services\standard\fileUpload>javac -cp "identityiq.jar:primefaces-9.0.12.jar:javax.faces-2.2.20.jar" FileUploadClass.java
FileUploadClass.java:3: error: package org.primefaces.model does not exist
import org.primefaces.model.UploadedFile;
                           ^
FileUploadClass.java:5: error: package javax.faces.bean does not exist
import javax.faces.bean.ManagedBean;
                       ^
FileUploadClass.java:6: error: package javax.faces.bean does not exist
import javax.faces.bean.SessionScoped;
                       ^
FileUploadClass.java:9: error: cannot find symbol
@ManagedBean(name = "fileUploadClass")
 ^
  symbol: class ManagedBean
FileUploadClass.java:10: error: cannot find symbol
@SessionScoped
 ^
  symbol: class SessionScoped
FileUploadClass.java:13: error: cannot find symbol
    private UploadedFile uploadFile;
            ^
  symbol:   class UploadedFile
  location: class FileUploadClass
FileUploadClass.java:15: error: cannot find symbol
    public UploadedFile getUploadFile() {
           ^
  symbol:   class UploadedFile
  location: class FileUploadClass
FileUploadClass.java:19: error: cannot find symbol
    public void setUploadFile(UploadedFile uploadFile) {
                              ^
  symbol:   class UploadedFile
  location: class FileUploadClass
8 errors

Wonder if I am missing some prerequisites steps before compile the class?

Hi @angelborrego ,

I was able to compile the Java class after carefully checking the syntax and including the correct class path.

Here is an example of the syntax if you’re running on Windows OS:

javac -cp ".;C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\identityiq\WEB-INF\lib\*" FileUploadClass.java

Make sure you’re in the correct directory (i.e., the same directory as your Java class) and that you’ve included the full class path with all the necessary JAR files required for your project. This ensures that the compilation works successfully.

1 Like