Configure a Resource
There are several methods to configure a NoSQL resource.
Configure a Resource with WLST Online
Use WebLogic Scripting Tool (WLST) online to create, configure, target, inspect, edit, and remove NoSQL system resources in a running domain. See Using the WebLogic Scripting Tool in Understanding the WebLogic Scripting Tool.
The following table identifies some WLST configuration operations which may be useful when administering NoSQL system resources. For a complete list of WLST commands, see WLST Command Reference for Oracle WebLogic Server.
| Task | Configuration Operation |
|---|---|
| Create, locate, or remove a resource | DomainMBean.createNoSQLSystemResource, lookupNoSQLSystemResource, destroyNoSQLSystemResource |
| Configure the descriptor | NoSQLSystemResourceMBean.getNoSQLResource() |
| Create or edit a property | getProperties().createProperty(name) or lookupProperty(name) |
| Assign or remove a target | addTarget(target) or removeTarget(target) |
| Inspect committed configuration | domainConfig() and resource lookup |
| Commit or discard an edit | Existing save/activate or undo/cancel procedures |
For an example using the personNoSqlResource definitions shipped with WebLogic Server examples, see Create and Target a Resource Online. Run the complete sample script for its connection, activation, and cleanup behavior.
The following script examples are based on the configure-nosql.py script included in the optional Jakarta Data and NoSQL code samples. See Sample Applications and Code Examples in Understanding Oracle WebLogic Server.
configure-nosql.py creates a NoSQL system resource configured to use the Oracle NoSQL provider and to target the Administration Server. When building your own WLST scripts to create and configure NoSQL system resources, use the configure-nosql.py script as a starting point and update the properties and values as needed.
Create and Target a Resource Online
Run the configure-nosql.py script from the sample directory with the Administration Server running. Set WLS_ADMIN_USER, WLS_ADMIN_PASSWORD, WLS_ADMIN_URL, and WLS_NOSQL_ENDPOINT as described in the sample README. Use the connection settings appropriate to your environment.
"$ORACLE_HOME/oracle_common/common/bin/wlst.sh" configure-nosql.py
The script connects to the domain, opens an edit session, and configures the resource using the following definitions. This is an excerpt from the resource configuration portion of the script. Run the complete supplied script for its connection, activation, and cleanup handling.
resource_name = 'personNoSqlResource'
resource_jndi_name = 'nosql/' + resource_name
existing = cmo.lookupNoSQLSystemResource(resource_name)
if existing is not None:
cmo.destroyNoSQLSystemResource(existing)
system_resource = cmo.createNoSQLSystemResource(resource_name)
descriptor = system_resource.getNoSQLResource()
descriptor.setProviderName('oracle-nosql')
descriptor.setDatabaseType('DOCUMENT')
descriptor.setJNDIName(resource_jndi_name)
properties = descriptor.getProperties()
properties.createProperty(
'jnosql.document.database').setValue('person_catalog')
properties.createProperty(
'jnosql.oracle.nosql.deployment').setValue('ON_PREMISES')
properties.createProperty(
'jnosql.oracle.nosql.host').setValue(nosql_endpoint)
admin_server = cmo.lookupServer(cmo.getAdminServerName())
system_resource.addTarget(admin_server)
In the supplied script, nosql_endpoint comes from WLS_NOSQL_ENDPOINT. The script does not set DefaultResource. PersonRepository explicitly selects the local alias nosql/person.
Run the setup before deploying the application. Rerunning it destroys and recreates an existing personNoSqlResource. If that replacement occurs while the application is deployed, fully redeploy the application before using it again. This script replacement is distinct from a compatible property-only update.
For deployments requiring credentials, configure the applicable protected properties through the supported credential input. The local sample settings do not define a production credential recipe.
After activation, verify the committed configuration. Provider creation and database connectivity are verified separately through an authorized application operation.
Inspect the Committed Configuration
Use the domain configuration tree to inspect individual non-secret attributes.
domainConfig()
resource = cmo.lookupNoSQLSystemResource('personNoSqlResource')
if resource is None:
raise Exception('personNoSqlResource is not configured')
descriptor = resource.getNoSQLResource()
print(descriptor.getProviderName())
print(descriptor.getDatabaseType())
print(descriptor.getJNDIName())
Avoid printing the entire properties tree.
Edit or Remove a Resource Online
For a property update, begin an edit session and look up the existing resource. Use getProperties().lookupProperty(name) to find the property before changing its value. Save and activate a valid edit. Undo and cancel a rejected prepared edit.
For target removal, use removeTarget(target) on the resource. For resource removal, use DomainMBean.destroyNoSQLSystemResource(resource) within the edit session.
Review dependent applications before either operation. Removal and untargeting can terminally invalidate deployments. See Update a Resource and Recover Applications.
Configure a Resource using Offline Tools
Use WLST offline or the supported domain-creation tooling with an inactive domain. Keep offline configuration separate from online edit sessions.
For an existing domain, open it with readDomain, configure the resource through the supported offline hierarchy, persist it with updateDomain, and close it with closeDomain.
For a new domain, use the template and writeDomain procedure.
The offline result must persist the domain resource entry, external descriptor, properties, protected representations, and targets together. Copying a descriptor alone does not register the resource.
Verify the persisted configuration at the next startup using the following checks:
| Persisted Item | Startup Verification | Failure to Investigate |
|---|---|---|
| Domain resource entry | Lookup by management-resource name succeeds | Descriptor copied without domain registration |
| External descriptor | Provider, type, JNDI, default flag, and properties load correctly | Missing, invalid, or incorrectly mapped descriptor |
| Target references | Intended servers register the resource locally | Missing or incorrect targets |
| Protected properties | Intended-property use works with the platform security material | Unsupported protected input or incomplete domain configuration |
| Application binding | Application deploys with its complete effective mapping | Missing declarations, scope mismatch, or ambiguous selection |
After startup, verify the resource by management name, inspect its loaded descriptor and targets, and deploy the bound application without online configuration repair. Offline configuration does not supply runtime metrics or prove database connectivity.
Configure a Resource with WebLogic Remote Console
You can use WebLogic Remote Console to configure a NoSQL system resource. See Configure a NoSQL System Resource in WebLogic Remote Console Online Help.