我有一个问题:
我有一个使用Weka和Jena库的Java类(使用Dynamic Web Project)。 我想使用Tomcat7和Axis2将此类公开为Web服务。 我通过右键单击类并选择名为" Web Service"的选项菜单来创建Web服务。
当我部署我的Web服务时,我收到此错误:
org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null
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:178)
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.DeploymentEngine.loadServices(DeploymentEngine.java:142)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:283)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1189)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4935)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5262)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5257)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396)
... 24 more
Caused by: java.lang.NullPointerException
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:606)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchemaTypeforNameCommon(DefaultSchemaGenerator.java:1092)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchemaForType(DefaultSchemaGenerator.java:996)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.processMethods(DefaultSchemaGenerator.java:413)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:273)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:468)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:388)
... 24 more
[ERROR] The Prova service, which is not valid, caused The following error occurred during schema generation: null
org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null
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:178)
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.DeploymentEngine.loadServices(DeploymentEngine.java:142)
at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:283)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
at org.apache.axis2.webapp.AxisAdminServlet.init(AxisAdminServlet.java:60)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1189)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4935)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5262)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5257)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:396)
... 24 more
Caused by: java.lang.NullPointerException
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:606)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchemaTypeforNameCommon(DefaultSchemaGenerator.java:1092)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchemaForType(DefaultSchemaGenerator.java:996)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.processMethods(DefaultSchemaGenerator.java:413)
at org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator.generateSchema(DefaultSchemaGenerator.java:273)
at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:468)
at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:388)
... 24 more
[INFO] org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation: null
[INFO] Deploying Web service: version.aar - file:/C:/apache-tomcat-8.0.1-src/wtpwebapps/ProvaListMap/WEB-INF/services/version.aar
[WARN] No transportReceiver for org.apache.axis2.transport.http.AxisServletListener found. An instance for HTTP will be configured automatically. Please update your axis2.xml file!
我已经看到当我添加使用Weka Libs的方法时出现此错误:
public Instances Prova(SortedMap<String,String> map) throws Exception {
@SuppressWarnings("rawtypes")
Iterator it = map.entrySet().iterator();
int riga=0;
int colonna=0;
String[][] data = new String[map.size()][map.size()];
while (it.hasNext()) {
@SuppressWarnings("rawtypes")
Map.Entry entry = (Map.Entry)it.next();
data [riga][colonna]=entry.getKey().toString();
data [riga][colonna+1]=entry.getValue().toString();
riga=riga+1;
}
int numInstances = data[0].length;
//ArrayList<Attribute> atts = new ArrayList<Attribute>();
FastVector atts = new FastVector();
List<Instance> instances = new ArrayList<Instance>();
for(int dim = 0; dim < 2; dim++)
{
Attribute current = new Attribute("Attribute" + dim, (FastVector) null, dim);
if(dim == 0)
{
for(int obj = 0; obj < numInstances; obj++)
{
instances.add(new SparseInstance(2));
}
}
for(int obj = 0; obj < numInstances; obj++)
{
instances.get(obj).setValue(current, data[obj][dim]);
}
atts.addElement(current);
}
Instances newDataset = new Instances("Dataset", atts, instances.size());
for(Instance inst : instances){
newDataset.add(inst);
}
return newDataset;
}
为什么会出现此错误?在Java中,我没有这个错误。
答案 0 :(得分:3)
我最近在使用axis2 + TomCat 7时遇到了这种错误。
我迷路了,我不知道问题来自于我是否拥有所有正确的配置。
比我能够发现问题。问题来自我在非Web服务类上使用的方法名称。
我有一个用户类来存储一些用户数据,所有属性都有各自的getter和setter。然后,该类由Web服务类使用。
这是导致异常的方法:
public class User {
...
private boolean mIsYahoo;
...
public void setIsYahoo(boolean isYahoo) {
mIsYahoo = isYahoo;
}
...
}
org.apache.axis2.deployment.DeploymentException:在架构生成期间发生以下错误:null
只需更改方法名称即可解决问题:
public void setYahoo(boolean isYahoo) {
mIsYahoo = isYahoo;
}
我能够这样找到:
我从WebService中删除了所有方法并检查它 已成功部署。
然后我开始逐个重新插入WebMethods 每次重新部署,直到我发现此异常是在何时引起的 我插入了一个以用户对象作为参数的WebMethod。
我从User类中删除了所有方法并重新部署了 包含所有WebMethods的WebService包括使用的WebService 用户对象并选中已成功部署的对象。
然后我开始逐个重新插入User方法 重新部署WebService,直到我发现此异常为止 由上述方法引起的。
我假设某些名称解析更改了方法的名称 conflits。它起作用了!!!
我希望这些信息可能对未来可能面临这个问题的人有所帮助,因为我花了整整一夜的时间。