异常:Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.

 客户端代码

package com.test;

import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService
public class Demo2 {

	
	public void test(){
		System.out.println("test");
		
	}
	
	public static void main(String[] args) {
		 Endpoint.publish("http://localhost:9999/Service/hello",new Demo2());
	        System.out.println("zzz");
	}
	
}

 异常

严重: Cannot find any registered HttpDestinationFactory from the Bus.
Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
	at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:136)
	at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
	at com.test.Demo2.main(Demo2.java:16)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:197)
	at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
	at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460)
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338)
	... 4 more
Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.
	at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:269)
	at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:135)
	at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:84)
	at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:63)
	at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:182)
	... 7 more

解决办法:添加依赖至pom.xml

	<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http-jetty</artifactId>
			<version>3.1.6</version>
	</dependency>

运行成功 

十月 11, 2018 8:55:54 上午 org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://test.com/}Demo2Service from class com.test.Demo2
十月 11, 2018 8:55:54 上午 org.apache.cxf.endpoint.ServerImpl initDestination
信息: Setting the server's publish address to be http://localhost:9999/Service/hello
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
zzz

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值