IIQ plugin java classes not showing in IIQ console

I am developing a plugin using a custom API, but the java classes in my project does not show up on my plugin when I run the plugin classes command in the IIQ console, as if they are not working. My file structure looks likes this:

Specifically, it is the restResource I am intrested in using, declared in the manifest.xml file:

In my lib folder I have the .jar file of the project, generated through maven packaging and containing all the backend classes. But I get the error “javax.servlet.ServletException: java.lang.IllegalStateException: Request scope has been already shut down.” when looking in the logs and trying the API using Postman.

1 Like

Can you validate if the class files are compiled when running maven install by looking

  • into the directory target/classes
  • open the dist-directory in a terminal and run jar tvf .\<artifactId>-<version>.jar (see pom.xml for artifactId and version)
  • extracting the zip file <artifactId>-<version>.zip

I also noticed issues when installing a plugin via the console. Can you also install the plugin via the UI and see if that makes a difference (assuming the above is correct).

– Remold

This is my file structure from using mvn clean package to install the plugin as a .zip file. I do not have a dist directory in my project.
image

The .jar in the lib folder:

A maven clean will indeed delete the dist directory :wink:

What if you run maven install or maven package, you should have a dist file and you van validate the above.

— Remold

I never install the plugins via the console only UI, but it makes sense that the resource class is not loading but the service class is for example after reading this comment that is a few years old:

Here I got my java service-class to be identified in the console. I had to downgrade my java version to 8 since it was too new. But I still cannot get my API call with Postman to work.

Hey it’s me!

A couple of things:

First, I wouldn’t store “Response” as a class level variable. Yes, Jersey will construct a new instance of your PluginManager class for each call, but you may end up with weirdness anyway. Response objects should be returned via the return Response....build() pattern in your method. You shouldn’t ever have to store them anywhere.

(Alternatively, if you use my iiq-common-public library and extend BaseCommonPluginResource instead, you never have to worry about Response objects at all, ever.)

Second, that error can be thrown when an API call hits a previous version of the plugin class, usually because the classloader got screwed up. The old Jersey Application context is indeed shut down, which is what the error is telling you. I’ve seen this happen when you deploy the plugin to one appserver, and then hit the API on a different appserver before the plugin service has propagated the plugin to all servers.

Third, you ought to get any class loading failures on install, not when you call the service. Do you see any errors in the logs on install? They would not appear in the console, but rather in the server logs. They would be prior to all of those ServletExceptions.

Fourth, the folder name in your plugin zip, which should contain the JAR files, is “jars”, not “libs”. The plugin ZIP structure should look something like this example (where RR-obf.jar is the key one). Can you verify that?

▶ unzip -l build/distributions/RuleRunnerPlugin.zip
Archive:  build/distributions/RuleRunnerPlugin.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  09-27-2022 15:24   jars/
    34988  09-27-2022 15:24   jars/RR-obf.jar
    13880  09-27-2022 15:24   jars/proguard.map
  3122418  02-18-2022 13:46   jars/ecj-3.24.0.jar
   210529  06-22-2021 15:31   jars/iiq-common-public.jar
        0  09-27-2022 15:24   import/
        0  09-27-2022 15:24   import/install/
      353  08-27-2020 15:43   import/install/AuditConfig.xml
     1045  08-02-2022 21:35   import/install/QuickLink.xml
      758  08-27-2020 15:43   import/install/PluginRights.xml
        0  09-27-2022 15:24   import/upgrade/
      353  08-27-2020 15:43   import/upgrade/AuditConfig.xml
     1044  08-02-2022 21:35   import/upgrade/QuickLink.xml
      758  08-27-2020 15:43   import/upgrade/PluginRights.xml
        0  03-10-2022 10:37   ui/
        0  01-14-2022 12:53   ui/css/
     3068  01-14-2022 12:53   ui/css/app.css
        0  09-27-2022 15:24   ui/js/
     1296  05-26-2021 16:03   ui/js/LoadedRule.js
     4412  03-07-2022 09:06   ui/js/RunningRule.js

Hello, thanks for your reply. The errors in the rolling sailpoint.log is related to ServletExceptions. I think I will try to restart the Tomcat server.

I do get this error at the end which is strange because I have never set PluginManagar as a service:

Ok, I see. All the other plugins I have seen put the .jar files in the lib folder. Is this a crucial detail?
image

It helped to restart the Tomcat server to get rid of the Servletexception error, but now I am getting this error about plugin authorization:

I would read the plugin guide. You’ll need to add an annotation on your resource method, I.e. @AllowAll means any authenticated user could call the endpoint. The guide will explain this.

I have read the guide and tried both with @AllowAll and @RightRequired on my method but still get HTTP Status 403 – Forbidden.

image

Can you paste your manifest file? Also are you using basic auth or OAuth to authenticate?

I am using basic auth with the login to IIQ, spadmin + password. This is my manifest faile:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE Plugin PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Plugin displayName="KPIMetrics" minSystemVersion="7.1" name="KPIMetrics" version="0.1" rightRequired="KPI Administrator">
  <Attributes>
    <Map>
      <entry key="minUpgradableVersion" value="0.1"/>
      <entry key="fullPage">
        <value>
          <FullPage title="KPIMetrics"/>
        </value>
      </entry>
      		<entry key="restResources">
				<value>
					<List>
						<String>com.sailpoint.plugin.kpimetrics.rest.PluginManager</String>
					</List>
				</value>
			</entry>
		<entry key="scriptPackages">
			<value>
				<List>
					<String>com.sailpoint.plugin.kpimetrics.rest</String>
				</List>
			</value>
		</entry>
		<!-- <entry key="taskExecutors">
			<value>
				<List>
					<String></String>
				</List>
			</value>
		</entry>-->
			<!-- <entry key="serviceExecutors">
				<value>
					<List>
						<String>com.sailpoint.plugin.kpimetrics.server.KPIService</String>
					</List>
				</value>
			</entry> -->
						<entry key="snippets">
				<value>
					<List>
						<Snippet>
							<Scripts>
								<String>ui/js/snippets/widgetnav.js</String>
							</Scripts>
							<StyleSheets>
								<String>ui/css/main.css</String>
							</StyleSheets>
						</Snippet>
					</List>
				</value>
			</entry>
    </Map>
  </Attributes>
</Plugin>

Can it have anything to do with Spring Security since it is a spring boot project?

Still getting the same error


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.