通过https检索Apache CXF Web服务客户端的端口时出现NullPointerException

时间:2014-01-16 16:36:05

标签: java web-services apache cxf

我有一个Web服务,我使用Apache CXF中的wsdl2java工具生成的客户端调用。一切都运行良好,直到我们将Web服务移到https后面。现在,当我尝试获取端口时,我收到NullPointerException。

我很确定这不是服务器证书的问题,因为我可以获得Web服务的WSDL。

规格: Apache CXF 2.7.6 Glassfish 3.1.2.2

这是我的客户代码:

public final static QName BasicHttpEndpoint2 = new QName("http://tempuri.org/", "BasicHttpEndpoint2");

@WebEndpoint(name = "BasicHttpsEndpoint")
public IAppts getBasicHttpsEndpoint()
{
    return super.getPort(BasicHttpsEndpoint, IAppts.class);
}

这是StackTrace的一部分我得到了:

Caused by: java.lang.NullPointerException
        at java.io.Reader.<init>(Reader.java:78)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
        at com.sun.xml.wss.jaxws.impl.RMPolicyResolver.getResourceReader(RMPolicyResolver.java:114)
        at com.sun.xml.wss.jaxws.impl.RMPolicyResolver.unmarshalPolicy(RMPolicyResolver.java:107)
        at com.sun.xml.wss.jaxws.impl.RMPolicyResolver.getOperationLevelPolicy(RMPolicyResolver.java:98)
        at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.buildProtocolPolicy(SecurityTubeBase.java:1298)
        at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.collectPolicies(SecurityTubeBase.java:774)
        at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.<init>(SecurityTubeBase.java:274)
        at com.sun.xml.wss.jaxws.impl.SecurityClientTube.<init>(SecurityClientTube.java:152)
        at com.sun.xml.wss.provider.wsit.SecurityTubeFactory.__AW_createTube(SecurityTubeFactory.java:285)
        at com.sun.xml.wss.provider.wsit.SecurityTubeFactory.createTube(SecurityTubeFactory.java)
        at com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:84)
        at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.__AW_createClient(TubelineAssemblerFactoryImpl.java:130)
        at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.createClient(TubelineAssemblerFactoryImpl.java)
        at com.sun.xml.ws.client.Stub.createPipeline(Stub.java:314)
        at com.sun.xml.ws.client.Stub.<init>(Stub.java:286)
        at com.sun.xml.ws.client.Stub.<init>(Stub.java:230)
        at com.sun.xml.ws.client.Stub.<init>(Stub.java:245)
        at com.sun.xml.ws.client.sei.SEIStub.<init>(SEIStub.java:91)
        at com.sun.xml.ws.client.WSServiceDelegate.getStubHandler(WSServiceDelegate.java:725)
        at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:703)
        at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:387)
        at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:363)
        at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:345)
        at javax.xml.ws.Service.getPort(Service.java:134)
        at trs.webservice.utilities.Appts.getBasicHttpsEndpoint(Appts.java:99)

1 个答案:

答案 0 :(得分:0)

这不是在运行时使用CXF。 Glassfish(Metro)中内置的JAX-WS实现正在被使用。