はじめに
http://blogs.yahoo.co.jp/dk521123/36056462.htmlで行った「Axis2 と Eclipse を使って、 新規にWebサービスを構築する」際にトラブルがあったので 解決策を記録しておく
[1] エラー「NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver」が表示
* Axis2でWebサービスを構築し、Tomcatを起動すると以下「エラー内容」が表示されてしまう
エラー内容
5 10, 2016 10:21:33 午後 org.apache.catalina.core.ApplicationContext log 重大: StandardWrapper.Throwable java.lang.NoClassDefFoundError: org/apache/ws/commons/schema/resolver/URIResolver at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:149) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) at org.apache.axis2.deployment.RepositoryListener.init(RepositoryListener.java:264) at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:66) at org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListener.java:61) at org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:152) at org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfiguration(WarBasedAxisConfigurator.java:233) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471) at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4996) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) ... 24 more 5 10, 2016 10:21:33 午後 org.apache.catalina.core.StandardContext loadOnStartup 重大: Servlet [AxisAdminServlet] in web application [/SampleWeb] threw load() exception java.lang.ClassNotFoundException: org.apache.ws.commons.schema.resolver.URIResolver at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:128) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:149) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) at org.apache.axis2.deployment.RepositoryListener.init(RepositoryListener.java:264) at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:66) at org.apache.axis2.deployment.RepositoryListener.<init>(RepositoryListener.java:61) at org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:152) at org.apache.axis2.deployment.WarBasedAxisConfigurator.getAxisConfiguration(WarBasedAxisConfigurator.java:233) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471) at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4996) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:744) 5 10, 2016 10:21:33 午後 org.apache.coyote.AbstractProtocol start
原因
* XmlSchema.jar がなかったため
解決策
以下のJARをTomcatは以下のlibに追加する * XmlSchema.jar(今回は「xmlschema-core-2.2.1.jar」)https://ws.apache.org/xmlschema/
[2] エラー「NoClassDefFoundError: javax/ws/rs/Produces」が表示
エラー内容
[INFO] The SampleWebMain service, which is not valid, caused java.lang.NoClassDefFoundError: javax/ws/rs/Produces at org.apache.axis2.jaxrs.JAXRSUtils.getClassModel(JAXRSUtils.java:53) at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:298) at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:469) at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396) at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:109) at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:232) at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:154) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:149) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:164) at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377) at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254) at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:136) at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:289) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:620) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:471) at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4996) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.ClassNotFoundException: javax.ws.rs.Produces at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139) ... 30 more [INFO] org.apache.axis2.deployment.DeploymentException: java.lang.NoClassDefFoundError: javax/ws/rs/Produces
原因
* jersey.jar がなかったため * なお、余談だが、jersey(ジャージ)については、以下の関連記事でも扱ったhttp://blogs.yahoo.co.jp/dk521123/32824085.html
解決策
以下のJARをTomcatは以下のlibに追加する * jersey.jar(今回は「jersey-bundle-1.19.1.jar」)https://jersey.java.net/download.html
参考文献
http://stackoverflow.com/questions/20244129/error-in-tomcat-in-creation-of-web-service[3] レスポンスエラー「The ServiceClass object does not implement the required method in the following form: OMElement ping(OMElement e)」が表示
* リクエストした後のレスポンスが以下のメッセージで返ってくる
エラー内容
The ServiceClass object does not implement the required method in the following form: OMElement ping(OMElement e)
解決策
* services.xmlを、以下「修正後」のように修正する修正前
<messageReceivers> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" ... /> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" ... /> </messageReceivers>修正後
<messageReceivers> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" ... /> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" ... /> </messageReceivers>
参考文献
http://stackoverflow.com/questions/35720181/the-serviceclass-object-does-not-implement-the-required-method-in-the-followinghttp://axis.apache.org/axis2/java/core/release-notes/1.7.0.html
関連記事
Axis2 と Eclipse を使って、 新規にWebサービスを構築する
http://blogs.yahoo.co.jp/dk521123/36056462.htmlAxis2関連のトラブル
Axis2で作成したWebサービスをAntでビルドした際に文字化けするhttp://blogs.yahoo.co.jp/dk521123/32052862.html
「Unable to generate WSDL 1.1 for this service. ・・・」が表示されてしまう
http://blogs.yahoo.co.jp/dk521123/34505334.html
「AxisFault: Connection has been shutdown: javax.net.ssl.SSLHandshakeException」が表示
http://blogs.yahoo.co.jp/dk521123/33014445.html
Axis2で表示される警告表示に対する対応
http://blogs.yahoo.co.jp/dk521123/34112421.html
Axis2を実行時に、エラーが表示され、実行できない
http://blogs.yahoo.co.jp/dk521123/32932322.html
Axis2 で Parse のエラーが発生した場合
http://blogs.yahoo.co.jp/dk521123/32191150.html
WSDLから Webサービス/クライアントを作成時に発生したトラブル
http://blogs.yahoo.co.jp/dk521123/32009389.html