views:

362

answers:

1

I am unable to create a Web Service Client in my NetBeans Web Application when xercesImpl.jar is included as a library.

Using NetBeans 6.9 and GlassFish 3.0.1:

1.) Create new Web Application
2.) Create a new Web Service
3.) Add a new operation to the created web service (just let it return null - the implementation isn't important)
4.) Deploy web service to GlassFish (works fine)
5.) Add xercesImpl.jar (I'm using version 2.9.1) as a library to the web service (I need xerces for a third-party library that I'm using)
6.) Stop Glassfish.
7.) Clean and Build the project.
8.) Run the project. Test that the Web Service still works (it does).
9.) Create a new Web Service Client. Point it at a WSDL (I'm using http://www.webservicex.com/CurrencyConvertor.asmx?wsdl just as a test).
10.) Stop Glassfish.
11.) Clean and Build the project.

Error message is shown:

C:\NetBeansProjects\WSTest\nbproject\jaxws-build.xml:43: Error starting wsimport: BUILD FAILED (total time: 1 second)

Line 43 is:

<wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/CurrencyConvertor" 
destdir="${build.generated.dir}/jax-wsCache/CurrencyConvertor" wsdl=
"${basedir}/${conf-dir}xml-resources/web-service-references/
CurrencyConvertor/wsdl/www.webservicex.com/CurrencyConvertor.asmx.wsdl"
catalog="catalog.xml" extension="true" verbose="true"
wsdlLocation="http://www.webservicex.com/CurrencyConvertor.asmx?wsdl" 
xnocompile="true" xendorsed="true">

12.) Restart NetBeans.
13.) Clean and Build the project. (The build now works)
14.) Run the project. GlassFish starts up fine except for this one-line error message:

SEVERE: Error in resolving the catalog

15.) Loading the Web Service Tester page produces the following exception in the GlassFish log:

WARNING: Servlet web service endpoint 'NewWebService' failure
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2085)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1018)
at org.glassfish.web.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1255)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<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.createEntityResolver(XmlUtil.java:270)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at org.glassfish.webservices.JAXWSServlet.registerEndpoint(JAXWSServlet.java:405)
at org.glassfish.webservices.JAXWSServlet.doInit(JAXWSServlet.java:264)
at org.glassfish.webservices.JAXWSServlet.init(JAXWSServlet.java:99)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1060)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:187)
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:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
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)

WARNING: StandardWrapperValve[NewWebService]: PWC1382: Allocate exception for servlet NewWebService
javax.servlet.ServletException
at org.glassfish.webservices.JAXWSServlet.doInit(JAXWSServlet.java:271)
at org.glassfish.webservices.JAXWSServlet.init(JAXWSServlet.java:99)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1060)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:187)
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:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
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)
Caused by: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2085)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1018)
at org.glassfish.web.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1255)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<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.createEntityResolver(XmlUtil.java:270)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at org.glassfish.webservices.JAXWSServlet.registerEndpoint(JAXWSServlet.java:405)
at org.glassfish.webservices.JAXWSServlet.doInit(JAXWSServlet.java:264)
... 26 more

Any ideas on what I can do to fix this? Note that it only happens after I create a new Web Service Client/Reference. Even if someone could suggest which project I should be creating a bug against (i.e. is it a NetBeans fault? A Glassfish fault? A JAX-WS fault? etc.), that would be good.

A: 

Well I've finally found a solution:

http://forums.java.net/jive/thread.jspa?threadID=59445

What I needed to do was to remove these files from the xercesImpl.jar file:

META-INF/services/javax.xml.parsers.DocumentBuilderFactory
META-INF/services/javax.xml.parsers.SAXParserFactory

When the modified JAR file is included in my project it no longer causes any issues.

If anyone has a neater solution, please let me know.

Catchwa