Maven构建错误'由于安全限制而无法创建JAXBContext'

时间:2016-08-20 23:42:36

标签: java maven-2

我在Java 6上有maven项目并将其切换到Java 7。 我正在使用maven 2.2.1和Java 1.7.0_80来构建项目 我看到构建错误'由于安全限制,无法创建JAXBContext'。 我在网上进行了研究,并了解到可以通过升级pom文件中的jaxws-tools插件依赖版本来修复它。

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
…
                <dependency>
                                <groupId>com.sun.xml.ws</groupId>
                                <artifactId>jaxws-tools</artifactId>
                                <version>**2.2.10**</version><--before 2.1.1
                </dependency>

首先,我在本地计算机上应用了更改,并清除了错误。 然后我决定在存储库服务器上构建,错误仍然存​​在。

更详细的构建失败错误消息...

> Note:     ap round: 2 [INFO]
> ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO]
> ------------------------------------------------------------------------ [INFO] Failed to execute wsgen
> 
> Embedded error: Unable to create JAXBContext due to the security
> restriction 1 counts of IllegalAnnotationExceptions [INFO]
> ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException:
> Failed to execute wsgen   at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
>   at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
>   at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
>   at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>   at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>   at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)   at
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)  at
> org.apache.maven.cli.MavenCli.main(MavenCli.java:362)     at
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:606)     at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>   at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)  at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>   at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused
> by: org.apache.maven.plugin.MojoExecutionException: Failed to execute
> wsgen     at
> org.codehaus.mojo.jaxws.AbstractWsGenMojo.execute(AbstractWsGenMojo.java:96)
>   at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>   at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>   ... 17 more Caused by: javax.xml.ws.WebServiceException: Unable to
> create JAXBContext due to the security restriction    at
> com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:131)
>   at
> com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:63)
>   at
> com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:224)
>   at
> com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:199)
>   at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:102)     at
> com.sun.tools.ws.WsGen.doMain(WsGen.java:55)  at
> org.codehaus.mojo.jaxws.AbstractWsGenMojo.execute(AbstractWsGenMojo.java:91)
>   ... 19 more Caused by: java.security.PrivilegedActionException:
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
> IllegalAnnotationExceptions java.lang.StackTraceElement does not have
> a no-arg default constructor.     this problem is related to the
> following location:       at java.lang.StackTraceElement      at public
> java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()         at
> java.lang.Throwable       at private java.lang.Throwable[]
> com.shsolutions.pd.ws.jaxws.PdsWsExceptionBean.suppressed         at
> com.shsolutions.pd.ws.jaxws.PdsWsExceptionBean
> 
>   at java.security.AccessController.doPrivileged(Native Method)   at
> com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:124)
>   ... 25 more Caused by:
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
> IllegalAnnotationExceptions java.lang.StackTraceElement does not have
> a no-arg default constructor.     this problem is related to the
> following location:       at java.lang.StackTraceElement      at public
> java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace()         at
> java.lang.Throwable       at private java.lang.Throwable[]
> com.shsolutions.pd.ws.jaxws.PdsWsExceptionBean.suppressed         at
> com.shsolutions.pd.ws.jaxws.PdsWsExceptionBean
> 
>   at
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
>   at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:422)
>   at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.&lt;init&gt;(JAXBContextImpl.java:270)
>   at
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:103)
>   at
> com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:89)
>   at
> com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:126)
>   at
> com.sun.xml.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:125)
>   ... 27 more

0 个答案:

没有答案