gpt4 book ai didi

java - apache cxf wsdl2java 无法生成类型->访问被拒绝

转载 作者:行者123 更新时间:2023-12-02 00:11:11 25 4
gpt4 key购买 nike

自 2013 年以来我一直在努力解决这个问题......我使用的是 Windows 7。

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java (generate-sources) on project service-data-model-provider: Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java failed: Failed to generate types. a:\Misc\WsMock\service-data-model-provider\src\main\java\schema\eo\common\system\messageheader\v1\MessageContextType.java (Access is denied) -> [Help 1]

它是完全随机的,并且发生在所有 cxf 版本和不同的 java 版本上。目前我使用的是 jdk 1.8.45 和 cxf 3.1.2

可以通过设置始终解决该问题

但是构建总是成功的,即使会发生一些错误,这些错误在日志中显示为[警告]..所以我不能使用类似的东西。

这是我的cfg

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<defaultOptions>
<extraargs>
<extraarg>-validate</extraarg>
<extraarg>-exsh</extraarg>
<extraarg>true</extraarg>
</extraargs>
</defaultOptions>
<wsdlRoot>..\..\..</wsdlRoot>
<includes>
<include>mds/apps/services/**/*.wsdl</include>
</includes>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>

另一个有帮助但不能完全解决问题的方法是禁用 WindowsHardDrive 驱动程序中的 WriteToCache 设置。

这表明系统太慢,CXF\Java 正在尝试在文件完全写入磁盘之前使用该文件。使用 SSD 时,此问题仅偶尔发生。

我们的数据模型非常庞大(很多 XSD)并且硬盘驱动器经过加密,因此一切都如此缓慢。

有什么想法可以调整 java 来处理这个问题吗?或者可能是 CXF 问题?

完整堆栈跟踪

[ERROR] Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java (generate-sources) on project service-data-model-provider: Execution generate-sources of goal org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java failed: Fai led to generate types. a:\Misc\WsMock\service-data-model-provider\src\main\java\co\schema\common\fault\creati onfault\v1\ObjectFactory.java (Access is denied) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-codegen-plugin:3.1.2:w sdl2java (generate-sources) on project service-data-model-provider: Execution generate-sources of goal org.apache.cx f:cxf-codegen-plugin:3.1.2:wsdl2java failed: Failed to generate types. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder. java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-sources of goal org.apache.cxf:cxf-codeg en-plugin:3.1.2:wsdl2java failed: Failed to generate types. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: org.apache.cxf.tools.common.ToolException: Failed to generate types. at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.generate(JAXBDataBinding.java:839) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:730) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:270) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:415) at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103) at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113) at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86) at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.generate(WSDL2JavaMojo.java:415) at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute(AbstractCodegenMoho.java:260) at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:512) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more Caused by: java.io.FileNotFoundException: a:\Misc\WsMock\service-data-model-provider\src\main\java\uk\co\schema\ common\fault\creationfault\v1\ObjectFactory.java (Access is denied) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(FileOutputStream.java:270) at java.io.FileOutputStream.(FileOutputStream.java:213) at java.io.FileOutputStream.(FileOutputStream.java:162) at org.sonatype.plexus.build.incremental.DefaultBuildContext.newFileOutputStream(DefaultBuildContext.java:54) at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo$1.createOutputStream(WSDL2JavaMojo.java:411) at org.apache.cxf.tools.wsdlto.databinding.jaxb.TypesCodeWriter.openBinary(TypesCodeWriter.java:72) at com.sun.codemodel.CodeWriter.openSource(CodeWriter.java:100) at com.sun.codemodel.JPackage.createJavaSourceFileWriter(JPackage.java:490) at com.sun.codemodel.JPackage.build(JPackage.java:441) at com.sun.codemodel.JCodeModel.build(JCodeModel.java:311) at com.sun.codemodel.JCodeModel.build(JCodeModel.java:301) at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.generate(JAXBDataBinding.java:827) ... 32 more [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

干杯Prem

最佳答案

(将 @Prem 的评论移至此答案并添加更多详细信息)

添加<fork>always</fork>修复了问题。

示例配置:

     <plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-source</id>
<phase>generate-sources</phase>
<configuration>
<fork>always</fork>
</configuration>
...
<!-- Rest of the configuration -->

文档 - maven-cxf-codegen - other config

关于java - apache cxf wsdl2java 无法生成类型->访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32398639/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com