1

我正在使用axis2 部署一个java Web 服务。

我已经创建了 Web 服务的演示,但我的 java Web 服务中没有包含外部 jar,而且效果很好。但是当我尝试使用一些外部库创建java的Web服务时,同样的事情不起作用..为什么会发生这种情况?

虽然部署该 Web 服务我得到了这个异常

This Web axisService has deployment faults
Error: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: edu.cmu.sphinx.demo.transcriber.TranscribeSimpleGrammar
 at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:150)
 at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:82)
 at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
 at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813)
 at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
 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.RepositoryListener.startListener(RepositoryListener.java:371)
 at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:73)
 at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:94)
 at org.apache.axis2.deployment.scheduler.Scheduler$SchedulerTimerTask.run(Scheduler.java:93)
 at java.util.TimerThread.mainLoop(Timer.java:512)
 at java.util.TimerThread.run(Timer.java:462)
Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: edu.cmu.sphinx.demo.transcriber.TranscribeSimpleGrammar
 at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:432)
 at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:101)
 at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:143)
 ... 12 more
Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: edu.cmu.sphinx.demo.transcriber.TranscribeSimpleGrammar
 at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396)
 ... 14 more
Caused by: org.apache.axis2.AxisFault: edu.cmu.sphinx.demo.transcriber.TranscribeSimpleGrammar
 at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
 at org.apache.axis2.util.Utils.getServiceClass(Utils.java:804)
 at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:430)
 at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:388)
 ... 14 more
Caused by: java.lang.ClassNotFoundException: edu.cmu.sphinx.demo.transcriber.TranscribeSimpleGrammar
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:169)
 at org.apache.axis2.util.Loader.loadClass(Loader.java:261)
 at org.apache.axis2.util.Loader.loadClass(Loader.java:229)
 at org.apache.axis2.util.Utils.getServiceClass(Utils.java:801)
 ... 16 more 

我认为在创建 .aar 文件时我需要进行一些更改?如果是,那么更改应该是什么?

在下图中,我包含三个库作为外部库 sphinx4.jar jsapi.jar wsj...jar

在此处输入图像描述

4

2 回答 2

3

我已经通过在项目中添加 lib 文件夹并在构建路径中包含 jar 解决了这个问题。

只需将你想要的所有 jar 复制到 lib 文件夹中,然后右键单击 jar -> 转到构建路径 -> 添加到构建路径

就是这样,你就会成功。

于 2012-09-15T11:50:20.497 回答
1

感谢 Bhavik Kama 的回答。我遇到了同样的问题,从博客中得到了 ides,我的回答是 jar 文件应该复制到文件夹 webserviceproject\webcontent\web-inf\lib 中。

于 2014-07-23T02:28:05.460 回答