CXF3.0.4客户端调用Web service来获取服务的三种方式
服务端的代码请看我的另一篇文章:点击打开链接
首先必须要有一个可用的WSDL服务地址,这个地址有我们需要调用的方法,将地址复制到浏览器地址栏,看测试能否通过。
方式一:
配置CXF环境变量,用wsdl2java工具自动产生代码。项目结构目录如下:
其中com.yq.webservice下面的所有的java类都是wsdl2java工具自动产生的。
<span style="font-size:18px;"><span style="white-space:pre"> </span>JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean(); factoryBean.getInInterceptors().add(new LoggingInInterceptor()); factoryBean.getOutInterceptors().add(new LoggingOutInterceptor()); factoryBean.setServiceClass(HelloWorldDao.class); factoryBean.setAddress("http://localhost:8080/WebServiceTest/webservice/helloworld?wsdl"); HelloWorldDao impl = (HelloWorldDao) factoryBean.create(); impl.sayHello("zhengmo");</span>
其中:
<span style="font-size:18px;">http://localhost:8080/WebServiceTest/webservice/helloworld?wsdl是服务端提供的web service的端口地址。</span>
<span style="font-size: 18px;">上面的代码就是WebServiceClient.java中main方法里面的代码。 </span>
<strong><span style="font-size:32px;">方式二:</span></strong>
<span style="font-size:24px;">任然需要先用wsdl2java工具生成相应的java代码。</span>
<span style="font-size:24px;"> HelloWorldDaoService factory = new HelloWorldDaoService(); HelloWorldDao helloWorldDao = factory.getHelloWorldDaoPort(); helloWorldDao.sayHello("zhengmo"); </span>
<strong><span style="font-size:32px;">方式三:</span></strong>
<span style="font-size:24px;">最后一种方式不需要使用wsdl2java工具在客户端产生代码。</span>
<span style="font-size:24px;"> JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); String wsUrl = "http://localhost:8080/WebServiceTest/webservice/helloworld?wsdl"; Client client = dcf.createClient(wsUrl); String method = "sayHello";//webservice的方法名 Object[] result = null; try { result = client.invoke(method, "zhengmo");//调用webservice } catch (Exception e) { e.printStackTrace(); } </span>
<span style="font-size:24px;">最后一种方式在eclipse中运行的时候报错:</span>
<div class="line number3 index2 alt2" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background-image: none !important; background-attachment: initial !important; background-color: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;">Exception in thread </code><code class="java string" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: blue !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background-image: none !important; background-attachment: initial !important; background-color: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;">"main"</code> <code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background-image: none !important; background-attachment: initial !important; background-color: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;">java.lang.NullPointerException</code></span></div><div class="line number4 index3 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.common.util.Compiler.useJava6Compiler(Compiler.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">190</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number5 index4 alt2" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">144</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number6 index5 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">139</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number7 index6 alt2" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.compileJavaSrc(DynamicClientFactory.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">610</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number8 index7 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">369</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number9 index8 alt2" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">240</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number10 index9 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">233</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number11 index10 alt2" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"><code class="java spaces" style="color: rgb(199, 37, 78); white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;"> </code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:</code><code class="java value" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: rgb(0, 153, 0) !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">188</code><code class="java plain" style="white-space: nowrap; list-style: none; box-sizing: content-box !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; padding: 0px !important; color: black !important; border-radius: 0px !important; margin: 0px !important; border: 0px !important; outline: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; background: none !important;">)</code></span></div><div class="line number12 index11 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:24px;"> </span></div><div class="line number12 index11 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;">发现useJava6Compiler方法里面有这么一句“JavaCompiler compiler=ToolProvider.getSystemJavaCompil</span></div><div class="line number12 index11 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;"> </span></div><div class="line number12 index11 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="font-size:18px;">er();”空指</span><span style="line-height: 15.3999996185303px;font-size:18px;">针的异常就是来自这里。产生的原因是没有</span><span style="line-height: 15.3999996185303px;font-size:18px;">获得编译环境,也就是JRE设置的问题,需要在eclipse</span></div><div class="line number12 index11 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="line-height: 15.3999996185303px;"><span style="font-size:18px;"> </span></span></div><div class="line number12 index11 alt1" style="list-style: none; line-height: 15.3999996185303px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; color: rgb(51, 51, 51); box-sizing: content-box !important; margin: 0px !important; padding: 0px 1em !important; border: 0px !important; border-image-source: initial !important; border-image-slice: initial !important; border-image-width: initial !important; border-image-outset: initial !important; border-image-repeat: initial !important; outline: 0px !important; border-radius: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; min-height: inherit !important; white-space: pre !important; background-image: none !important; background-attachment: initial !important; background-size: initial !important; background-origin: initial !important; background-clip: initial !important; background-position: initial !important; background-repeat: initial !important;"><span style="line-height: 15.3999996185303px;"><span style="font-size:18px;">里面把jre设置为jdk下的jre。</span></span></div>
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。