Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessExternalSchema issue #1

Open
mmower opened this issue Jul 21, 2015 · 6 comments
Open

accessExternalSchema issue #1

mmower opened this issue Jul 21, 2015 · 6 comments

Comments

@mmower
Copy link

mmower commented Jul 21, 2015

Hi.

First of all, many thanks for your plugin. When I realised I need to consume a SOAP web service I groaned somewhat and was glad to find there is some support out there. The WSDL file I am trying to consume is:

http://v3.core.com.productserve.com/ProductServeService.wsdl

so I tried what appeared to be the easiest approach and just specify:

:wsimport {:wsdl-list ["http://v3.core.com.productserve.com/ProductServeService.wsdl"]}

and try lein-wsimport where I ran into the following exception:

Caused by: org.xml.sax.SAXParseException; systemId: jar:file:/Users/matt/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.2.6-b31/jaxb-xjc-2.2.6-b31.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4162)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaFatalError(XSDHandler.java:4141)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2168)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:2078)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:1008)
    at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:620)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:617)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:575)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:541)
    at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:255)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:638)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:670)
    at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:77)
    ... 41 more

The best information I can figure out about this problem is that it's related to the JAXP option javax.xml.accessExternalSchema. I've tried specifying in :jvm-opts:

:jvm-opts ["-Djavax.xml.accessExternalSchema=all"]

and confirmed that this seems to work using (System/getProperty) but the error persists.

I'm in a little over my depth and any help you could offer would be most appreciated.

Kind regards,

matt

@klauern
Copy link
Owner

klauern commented Jul 22, 2015

I saw this as well, but was able to follow this stackoverflow answer to resolve it on my own JDK. Let me know if you still have issues with that.

@klauern
Copy link
Owner

klauern commented Jul 22, 2015

As a note, it seems like this is a newer issue on JDK8, which is a bit older than when I released version 1.0.0.

@klauern
Copy link
Owner

klauern commented Jul 22, 2015

Oh goodness, I misread your request. Are you saying that even after adding the option, it still persists? I will have to look at what is going on to see how to pass JVM options in, as I probably didn't anticipate needing to at that time.

@mmower
Copy link
Author

mmower commented Jul 26, 2015

Hi. Sorry the comment notification got filtered so only just realised you replied... thanks for looking into Yes, what seems to be happening is that even though I am passing the option I still get the error. That said I wasn't passing it via the jaxp.properties file but rather as a JVM option. That was mainly because I have no idea where my JDK was located and passing a JVM option seemed easier. I will try the other way, should it matter how the option gets passed though?

@klauern
Copy link
Owner

klauern commented Jul 27, 2015

I don't think it does, but I have to look at how Leiningen lets you pass JVM flags through, as it seems the call to WsImport.doMain is not exactly the same as the command-line version. From my POV, it seems that Leiningen will already have spun up a JVM instance, so the option to adjust that flag would have to be done internally somewhere, and I'm not sure if it's as simple as setting some System.setProperty() call or something else.

I know that I tested it myself on a couple versions, and it seems that this is an issue with JDK8, so I didn't notice it right away. I did set that jaxp.properties file on my local system and ran the wsimport command to test it, but I haven't gotten around to running some tests against the plugin. I will see if I can spare a bit of time this week to try it out.

@dkmarley
Copy link

I solved this on JDK8 by using the JAVA_TOOL_OPTIONS environment variable:

export JAVA_TOOL_OPTIONS="-Djavax.xml.accessExternalSchema=all"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants