ImportImpl throws error when importing RuleSets
Symptom
You can use the command line option ImportImpl
to run an Apache Ant script and import Process Commander class instances or RuleSets from an external database. (See How to import and export ZIP archives from a command line for more information.)
ImportImpl
retrieves a ZIP file containing the new classes and writes the exported class instances to a target Process Commander database. On the command line you can specify database options that control how the records are written to the database.
For example:
com.pega.pegarules.engine.database.ImportImpl –a test_ruleset.zip –o
indicates that the file test_ruleste.zip will be imported and will not overwrite any existing RuleSets (-o).
When using ImportImpl to import RuleSets and classes, you may receive the following NoInitialContextException
error:
java] 2007-12-07 11:56:19,387 [ main] ( priv.context.JNDIEnvironment) INFO - Enterprise-tier default Engine bean name is EngineBMT
[java] 2007-12-07 11:56:19,394 [ main] (etier.context.EtierEnvironment) ERROR - Enterprise tier error retrieving local JNDI context
[java] factory =
[java] url =
[java] path =
[java] javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
[java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657) [java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:259) [java] at javax.naming.InitialContext.getEnvironment(InitialContext.java:500)
[java] at com.pega.pegarules.etier.context.EtierEnvironment.runDiscovery
This error occur because, when using Ant to import rulesets to the database, JNDI lookup is done for EngineBMT while initializing the engine. Since no JNDI provider is present in the standalone environment, the lookup fails and throws the above exception
You can ignore this error, as it does not affect the import process.
Solution
You can suppress the NoInitialContextException
error using the java.naming.factory.initial environment property and a suitable provider, such as the Sun "file system" provider . This property contains the name of the environment property that specifies which initial context format to use. This environment property is passed to initial context constructor, applet parameter, system property, or application resource file.
Set this property in the service provider’s environment parameter, for example:
java.naming.factory.initial = com.sun.jndi.fscontext.RefFSContextFactory
Download and install Sun Microstystem's File System Service Provider for JNDI 1.2.1 as follows:
- From the above link, scroll down to the JNDI 1.2.1 section and click the Download button.
- Click the Accept License Agreement radio button.
- Select the File System Service Provider checkbox and click Download selected with Sun Download Manager.
- Save the file to your hard drive.
- Locate the file and double-click to begin the download and installation.
- Follow the on-screen instructions to download the
fscontext zip
file. Note that this file will have version numbers as part of its name. - Extract the contents of the .zip file to your hard drive to use the Service Provider.
NOTE: The .zip file contains two HTML files that provide documentation on using and configuring the Service Provider.