We are migrating fairly new web application from tomcat to glassfish and everything is working well except for some xpath code that is used to parse some xml returned from a third party service. The code works wonderful in tomcat but not in glassfish for some reason.
Here is a snippet that throws an null pointer exception:
XPathExpression ex = xpath.compile("*/text()");
Object issued = ex.evaluate(licenses.item(i),XPathConstants.NODESET);// ex is null
The code compiles fune but throws a null pointer exception at runtime. Again, this code runs fine on tomcat.
If this change is made in the code:
Object issued = xpath.evaluate("*/text()",licenses.item(i),XPathConstants.NODESET);
Glassfish is happy and the code works just as it has for the last couple of years. Does anyone have any ideas as to why this is happening? All the jars, etc that are used in tomcat are also in glassfish.
Any help would be appreciated.
EDIT - Stack Trace [#|2010-07-01T07:55:26.712-0400|SEVERE|glassfish3.0.1|javax.enterprise.s ystem.std.com.sun.enterprise.v3.services.impl|_ThreadID=27;_ThreadName=T hread-1;|java.lang.NullPointerException
at
company.MvrRecord.parseLicense(MvrRecord.java:32 6)
at
company.MvrRecord.parseLicenses(MvrRecord.java:2 97)
at
company.servlets.ClueMvr.processRequest(ClueMvr. java:173)
at
company.servlets.ClueMvr.doGet(ClueMvr.java:747)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:15 23)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:279)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:188)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:6 41)
at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESession LockingStandardPipeline.java:85)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :185)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java :325)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2 26)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMap per.java:165)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter .java:170)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtoc olChain.java:135)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:1 02)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:8 8)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76 )
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask .java:53)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.jav a:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool .java:330)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.ja va:309)
at java.lang.Thread.run(Thread.java:619)
|#]