Archive

Archive for the ‘xalan’ Category

TransformerException: Could not initialize BSF Manager

17 February 2010 Leave a comment

If you get the following exception

org.apache.xalan.extensions.ObjectFactory$ConfigurationError: Provider org.apache.bsf.BSFManager
not found
	at org.apache.xalan.extensions.ObjectFactory.newInstance(ObjectFactory.java:462)
	at org.apache.xalan.extensions.ExtensionHandlerGeneral.(ExtensionHandlerGeneral.java:204)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

and further down

Caused by: javax.xml.transform.TransformerException: Could not initialize BSF Manager at org.apache.xalan.extensions.ExtensionHandlerGeneral.<init>(Ext ensionHandlerGeneral.java:214) 

it means that the BSF manager could not be instantiated. This is because in ExtensionHandlerGeneral, xalan looks for a property called org.apache.xalan.extensions.bsf.BSFManager which points to the BSFManager it should use. If it does not find it then it tries to find the default BSFManager which is the org.apache.bsf.BSFManager class. If it does not find any of them then it throws the above exception. Normally xalan should be able to load the default manager (if you have the Bean Scripting Framework jar (bsf.jar) in your classpath) but in case it does not, you might have to explicitly define it by passing the org.apache.xalan.extensions.bsf.BSFManager either in the command line

java -Dorg.apache.xalan.extensions.bsf.BSFManager=org.apache.bsf.BSFManager ...

or by programmatically setting the property using the System class

System.setProperty("org.apache.xalan.extensions.bsf.BSFManager","org.apache.bsf.BSFManager");

This should make the error go away.

Categories: xalan Tags: , ,