commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david2 <David.Bue...@l-3comcept.com>
Subject XPathFactoryFinder.
Date Thu, 09 Aug 2007 14:30:17 GMT

We have a Web Services Notification application that uses Muse, Xalan, and
XML commons (we have tried both xml-apis-1.3.03.jar and
xml-apis-1.3.04.jar).  We are using XPath message pattern filtering as the
filtering mechanism for web service notification, but we also require some
custom filtering (subclassing MessagePatternFilter with
ExtnMessagePatternFilter).

Our ExtnMessagePatternFilter accept method is as follows:


public boolean accepts(NotificationMessage message) {

	Document doc = XmlUtils.createDocument();
	logger.debug("doc = " + doc);
	Element messageXML = message.toXML(doc);
	ogger.debug("messageXML = " + messageXML);
	doc.appendChild(messageXML);
	logger.debug("appended doc = " + doc);

	XPathFactory factory = XPathFactory.newInstance();
	XPath xpath = factory.newXPath();
		
	CompositeNamespaceContext namespaceContext = new
CompositeNamespaceContext();
	namespaceContext.addNamespaceContext(new ExtensionNamespaceContext());
	namespaceContext.addNamespaceContext(new SnaNamespaceContext());

	xpath.setNamespaceContext(namespaceContext);

	xpath.setXPathFunctionResolver(new XPathFunctionResolverImpl());

	try {
		boolean result = ((Boolean)xpath.evaluate(this._pattern, doc, 
			XPathConstants.BOOLEAN)).booleanValue();
		logger.debug("result = " + result);
		return result;
	}
	catch (Exception error) {
		error.printStackTrace();
		return false;
	}
}


This code works fine in the Eclipse debugger using the Maven Dependencies
plugin.  However, when we perform a Maven build and deploy to Tomcat, we get
the following exception when the XPathFactory is instantiated (bold line
above):


java.lang.NullPointerException
        at
javax.xml.xpath.XPathFactoryFinder._newFactory(XPathFactoryFinder.java:222)
        at
javax.xml.xpath.XPathFactoryFinder.newFactory(XPathFactoryFinder.java:143)
        at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:185)
        at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:99)
        at
com.myorg.myapp.ws.notification.impl.ExtnMessagePatternFilter.accepts(ExtnMessagePatternFilter.java:69)
        at
org.apache.muse.ws.notification.impl.FilterCollection.accepts(FilterCollection.java:64)
        at
com.myorg.myapp.ws.notification.impl.BufferedSubscriptionManager.publish(BufferedSubscriptionManager.java:73)
        at
com.myorg.myapp.ws.notification.impl.NewsNotificationProducer.publish(NewsNotificationProducer.java:38)
        at
org.apache.muse.ws.notification.impl.SimpleNotificationProducer.publish(SimpleNotificationProducer.java:420)
        at com.myorg.myapp.ws.handler.DDSHandler.run(DDSHandler.java:304)
        at
com.myorg.commons.util.reactor.ReactorAdapter.run(ReactorAdapter.java:19)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)


Have there been any previous issues with instantiating XPathFactory with
Muse using a Maven build?

-David
-- 
View this message in context: http://www.nabble.com/XPathFactoryFinder.-tf4242920.html#a12073372
Sent from the Commons - User mailing list archive at Nabble.com.


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


Mime
View raw message