我创建了一个Spring Web服务,它使用以下代码从XSD文件集合创建动态WSDL:
Resource[] schema = {
new ClassPathResource(
"schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/coreschemas/NarrativeBlock.xsd"),
new ClassPathResource(
"schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/coreschemas/datatypes-base.xsd"),
new ClassPathResource(
"schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/coreschemas/infrastructureRoot.xsd"),
new ClassPathResource(
"schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201305UV02.xsd"),
new ClassPathResource(
"schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201306UV02.xsd"),
new ClassPathResource(
"schema/service/XCPD.SupportMaterials.v9/schema/IHE/XCPD_PLQ.xsd"),
new ClassPathResource(
"schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/XCPD_PRPA.xsd") };
CommonsXsdSchemaCollection collection = new CommonsXsdSchemaCollection(
schema);
collection.setInline(true);
return collection;
Run Code Online (Sandbox Code Playgroud)
用于创建动态WSDL的XSD文件包括使用include语句的其他各种模式文件,如下所示:
<xs:include schemaLocation="../coreschemas/voc.xsd"/>
<xs:include schemaLocation="../coreschemas/datatypes.xsd"/>
Run Code Online (Sandbox Code Playgroud)
当我在Tomcat 8容器中运行代码时,我收到以下异常:
Caused by: java.lang.IllegalArgumentException: The resource path [/../coreschemas/infrastructureRoot.xsd] has been normalized to [null] which is not valid
Run Code Online (Sandbox Code Playgroud)
Spring的URI解析器在路径前面加上"/",即使被引用的文件是相对路径(不是绝对路径),并且在导入模式时失败.
应该注意的是,这个应用程序在Tomcat 7上运行正常.当尝试将其迁移到Tomcat 8时,问题就出现了.
Tomcat 8确实改变了现在加载Web资源的方式. 来自Java CodeRanch的更多信息 ......
任何方式长话短说,有没有办法强制Spring URI解析器应该正确处理相关文件?如果我查看解析器Spring使用的"collectionBaseURI"属性(ClasspathUriResolver),则此值为null.有没有办法设置这个基本URI?
编辑我可以通过将所有相对路径转换为模式的绝对路径来解决此问题...但是我不想在数百个文件中应用此修复.
我是Ruby的新手(来自Java背景)并且可以从Git存储库访问RoR项目.我能够通过自制软件安装rbenv和Postgres构建Ruby,使用正确的标志安装"pg"gem.我在项目上做了"捆绑安装"的任何方式,当我去启动服务器时,它创建了一个捆绑包......任何帮助都将是绝对值得赞赏的!
$ rails s
/Users//Projects/The /vendor/bundle/gems/pg-0.14.1/lib/pg.rb:4:in require': cannot load such file -- pg_ext (LoadError)
from /Users//Projects/The Usic/vendor/bundle/gems/pg-0.14.1/lib/pg.rb:4:in <top (required)>'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in block (2 levels) in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in each'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in block in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in each'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in require'
from /Users//.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler.rb:132:in require'
Run Code Online (Sandbox Code Playgroud)