javac cannot find symbol constructor Service

半世苍凉 提交于 2019-11-30 13:28:07

From your description this sounds similar to the problem described in this post.

To get around this issue, You can simply copy jaxb-api.jar, jaxws-api.jar to JDK's JRE's /lib/endorsed

Note that "endorsing" means placing the relevant JAR files (jaxb-api.jar, jaxws-api.jar in this case) in %JAVA_HOME%\jre\lib\endorsed (note the jre in the path). Do not create the endorsed directory directly under the JDK's lib directory.

or... if you prefer not to touch your JDK install, use these env vars is using wsimport and wsgen (where JAXWS_HOME points to JAX-WS 2.1 installation):

WSIMPORT_OPTS=-Djava.endorsed.dirs=%JAXWS_HOME%/lib
WSGEN_OPTS=-Djava.endorsed.dirs=%JAXWS_HOME%/lib

or... If you use ant tasks, you can pass -Djava.endorsed.dirs=%JAXWS_HOME%/lib as jvmarg while calling wsimport and wsgen ant tasks (for this to work, you need to set fork="true" attribute of wsimport and wsgen ant tasks).

Credit goes to Rama Pulavarthi.

Endorsing the 2.2 version of the jaxws-api jar should work. You could also pass the "-fe jaxws21" flag to the CXF wsdl2java command to make it generate 2.1 compatible code instead.

Adding webservices-api-2.2.jar alone in %JAVA_HOME%\jre\lib\endorsed has resolved issue for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!