By default, Java™ EE
applications do not have access to the third-party APIs available
in the Liberty profile. You can also remove access explicitly in
the server.xml file, or an included file.
About this task
In the following example, an application called Scholar has
previously been configured to access third-party APIs, as described
in Accessing third-party APIs from a Java EE application. You want to
remove this access, and to make it explicit in the configuration that
the application now uses the default access setting.
The application
also uses a common library called Alexandria. This
library is in the ${server.config.dir}/mylib/Alexandria directory.
Procedure
- Configure class loading for the application, to show that
the application can no longer access the third-party APIs.
In
the
server.xml file, or an included file, remove
third-party from
the set of values included for the apiTypeVisibility attribute:
<application id="scholar" name="Scholar" type="ear" location="scholar.ear">
<classloader apiTypeVisibility="spec, ibm-api" commonLibraryRef="Alexandria" />
</application>
- Optional: If the application uses any common
libraries, set those libraries to use the same API type visibility
setting.
In the
server.xml file, or
an included file, add the following code:
<library id="Alexandria" apiTypeVisibility="spec, ibm-api">
<fileset dir="${server.config.dir}/mylib/Alexandria" includes="*.jar" scanInterval="5s" />
</library>