Why the code XPathFactory.newInstance().newXPath() throws NullPointerException in EAP6
Issue
-
Application is packaged within a war file, tested as working on tomcat 7. The Web Application contains the camel jar
"WEB-INF/lib/camel-core-2.12.1.jar"inside it. -
The application is trying to run camel xpath on eap6, always throws a NullPointerException when trying to execute the following code:
XPath xPathEvaluator = XPathFactory.newInstance().newXPath();
- The Exception encountered at the execution of above code is as following:
org.apache.camel.RuntimeCamelException: java.lang.NullPointerException
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1344)
at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:186)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:107)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1103)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1095)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:992)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NullPointerException
at javax.xml.xpath.XPathFactoryFinder._newFactory(XPathFactoryFinder.java:220)
at javax.xml.xpath.XPathFactoryFinder.newFactory(XPathFactoryFinder.java:141)
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:182)
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:96)
And
15:26:06,467 ERROR [stderr] (Camel (camelContext) thread #7 - JmsConsumer[camel.b]) at javax.xml.xpath.XPathFactoryFinder.newFactory(XPathFactoryFinder.java:141)
15:26:06,467 ERROR [stderr] (Camel (camelContext) thread #7 - JmsConsumer[camel.b]) at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:182)
15:26:06,456 ERROR [stderr] (Camel (camelContext) thread #7 - JmsConsumer[camel.b]) JAXP: Looking up system property 'javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom'
15:26:06,457 ERROR [stderr] (Camel (camelContext) thread #7 - JmsConsumer[camel.b]) JAXP: The value is '__redirected.__XPathFactory'
15:26:06,458 ERROR [stderr] (Camel (camelContext) thread #7 - JmsConsumer[camel.b]) JAXP: createInstance(__redirected.__XPathFactory)
15:26:06,459 ERROR [stderr] (Camel (camelContext) thread #7 - JmsConsumer[camel.b]) java.lang.ClassNotFoundException: __redirected/__XPathFactory
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
- Apache Camel Core
- 2.12.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
