执行罐子时,我收到此错误:
const instances = [
{
"Instances":"1",
"riskdesc":"Low",
"alert":"X-Content-Type-Options Header Missing",
"OtherInformation":"T",
"Method":"GET"
},
{
"Instances":"1",
"riskdesc":"High",
"alert":"Cookie No HttpOnly Flag",
"OtherInformation":"T",
"Method":"GET"
},
{
"Instances":"1",
"riskdesc":"Low",
"alert":"X-Content-Type-Options Header Missing",
"OtherInformation":"T",
"Method":"GET"
}
]
const unique = instances.reduce((acc, curr) => (acc.some((i) => i.alert === curr.alert)) ? acc : acc.concat([curr]), [])
在生成的服务类中,我具有:
java.lang.NullPointerException
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:85)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:218)
at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:161)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
at javax.xml.ws.Service.<init>(Service.java:77)
at it.finanze.dogane.domest.otello.accesspoint.wsdl.Otello_Service.<init>(Otello_Service.java:44)
at it.sknt.truckonesender.App.main(App.java:70)
公共类Otello_Service扩展了服务{
@WebServiceClient(name = "Otello",
wsdlLocation = "classpath:Otello.wsdl",
targetNamespace = "http://accessPoint.otello.domest.dogane.finanze.it/wsdl/")
我的POM文件中有:
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://accessPoint.otello.domest.dogane.finanze.it/wsdl/", "Otello");
public final static QName Otello = new QName("http://accessPoint.otello.domest.dogane.finanze.it/wsdl/", "Otello");
static {
URL url = Otello_Service.class.getClassLoader().getResource("Otello.wsdl");
if (url == null) {
java.util.logging.Logger.getLogger(Otello_Service.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "classpath:Otello.wsdl");
}
WSDL_LOCATION = url;
} .....
这些是添加到项目中的cxf软件包
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.2.6</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>classpath:Otello.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
如果我从netbeans执行程序,一切都很好。
wdsl文件位于src / main / resources下。 wsdl实现是自动生成的,并放置在target / generation-sources / cxf
下有人可以帮助我吗?
答案 0 :(得分:0)
在<wsdlOption>
标签之间添加这两个标签:
<wsdl>src/main/resources/Otello.wsdl</wsdl>
<wsdlLocation>classpath:Otello.wsdl</wsdlLocation>
在<wsdl>
标记中,您需要提供相对于项目目录的路径。