views:

29

answers:

1

The current architecture has a web application (in a WAR distribution), being used to provide information to the web client via a Servlet. This Servlet garners this information from an external service via Glassfish Metro (SOAP), and then formats it accordingly for the client (JavaScript).

A proxy component (JAR) has been developed to manage access to this external service (via Glassfish Metro), and the external service is completely accessible and usable by this component via the command-line, JUnit tests, and even the web project, when it is executed as a command-line application.

Once this web project is executed through Glassfish, the Servlet runs into issues when attempting to call this service (via the proxy component).

Below is the stack trace:

java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
    at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
    at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
    at com.sun.org.apache.xml.internal.resolver.readers.SAXCatalogReader.readCatalog(SAXCatalogReader.java:238)
    at com.sun.org.apache.xml.internal.resolver.Catalog.parseCatalog(Catalog.java:680)
    at com.sun.xml.ws.util.xml.XmlUtil.createDefaultCatalogResolver(XmlUtil.java:299)
    at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:267)
    at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:230)
    at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:178)
    at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:106)
    at javax.xml.ws.Service.<init>(Service.java:57)
    at com.acme.MLSWebServicesInterface.<init>(MLSWebServicesInterface.java:48)
    at com.adomain.acme.MLSManager.getDeviceRecords(MLSManager.java:42)
    at com.adomain.app.service.StatusManager.getDeviceRecords(StatusManager.java:22)
    at com.adomain.app.service.StatusServlet.processRequest(StatusServlet.java:44)
    at com.adomain.app.service.StatusServlet.doGet(StatusServlet.java:87)
    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:1523)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.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(DefaultProtocolChain.java:135)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
    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.java: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.java:309)
    at java.lang.Thread.run(Thread.java:619)
+1  A: 

That looks like a problem with conflicting classes loaded from multiple classloaders. Specifically, it looks like your application has its own internal copy of Xerces in it's lib directory, and this is clashing with Glassfish's own copy.

If that's true, remove the copy from your app, it's not needed.

skaffman
That was exactly it. Once it is excluded from the lib directory the issue goes away.
Generic Prodigy