commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "paul.hopper" <paul.hop...@mci.com>
Subject [configuration] VerifyError
Date Tue, 05 Apr 2005 17:42:09 GMT
Good day,

Thought that configuration might be an easy replacement for my properties 
configurator since it does both UNIX based key=value properties but also xml 
config files.  Mine only does the former 8-(

While setting up my test I came across an error while setting up this from example:

#more config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<configuration>
	<properties fileName="usergui.properties"/>
	<xml fileName="gui.xml"/>
</configuration>

My src code works fine with just the properties "fileName" but I get a

2005-04-05 13:25:52,211 [main] ERROR org.apache.commons.digester.Digester - 
Begin event threw error
java.lang.VerifyError: (class: org/apache/xerces/jaxp/DocumentBuilderImpl, 
method: parse signature: (Lorg/xml/sax/InputSource;)Lorg/w3c/dom/Document;) 
Incompatible object argument for function call
	at 
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:88)
......
......
......

with the xml "fileName" when using both loadConfigXML and loadConfigByFactory 
method class of my test class.  Any suggestions?

[[my src]]

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.ConfigurationFactory;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class TestProperties {
	private Logger logger = Logger.getLogger(TestProperties.class);
	protected Configuration config = null;
	
	public TestProperties() {
		this.loadConfigByFactory();
		//this.loadConfigXML();
		
		//System.out.println("CONFIG::" + config.getString("DATABASES.DATABASE.DRIVER"));
		logger.info("colors.background = " + config.getString("colors.background"));
		logger.info("application.title = " + config.getString("application.title"));
		logger.info("rowsPerPage = " + config.getInt("rowsPerPage"));
	}
	
	public void loadConfigXML() {
		//ConfigurationFactory factory = new ConfigurationFactory("config.conf");
		XMLConfiguration config = new XMLConfiguration();
		config.setFileName("test.xml");
		try {
			config.load();
		} catch (ConfigurationException e) {
			logger.error(e);
		}		
		logger.info("rowsPerPage = " + config.getInt("rowsPerPage"));
	}
	
	public void loadConfigByFactory() {
		ConfigurationFactory factory = new ConfigurationFactory();
		URL configURL = null;
		try {
			configURL = new File("config.xml").toURL();
		} catch (MalformedURLException mue) {
			logger.error("error loading config.conf:  ", mue);
		}
		factory.setConfigurationFileName(configURL.toString());
		
		try {
			config = factory.getConfiguration();
		} catch (ConfigurationException ce) {
			logger.error("error loading configuration:  ", ce);
		}
	}

	public static void main(String[] args) {
		PropertyConfigurator.configure("log4j.cfg");
		new TestProperties();
	}
}

[[my gui.xml]]

<?xml version="1.0" encoding="ISO-8859-1" ?>
<gui-definition>
   <colors>
     <background>#808080</background>
     <text>#000000</text>
     <header>#008000</header>
     <link normal="#000080" visited="#800080"/>
   </colors>
   <rowsPerPage>15</rowsPerPage>
</gui-definition>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message