---
title: "CXF  空指针异常"
author: "jayyunfei"
date: "2015-02-11T17:11:42Z"
tags: ["cxf"]
categories: ["编程语言"]
slug: "cxf"
draft: false
lastmod: "2015-07-13T22:59:43Z"
id: 2185178
url: "https://jayyunfei.iteye.com/blog/2185178"
---

java.lang.NullPointerException
        at org.apache.cxf.common.util.Compiler.useJava6Compiler(Compiler.java:189)
        at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:143)
        at org.apache.cxf.common.util.Compiler.compileFiles(Compiler.java:138)
        at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.compileJavaSrc(DynamicClientFactory.java:598)
        at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:367)
        at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:270)
        at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:263)
        at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:198)
        at main.java.demo.hw.client.Client.main(Client.java:43)



在调用
		JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
		Client client = dcf.createClient("http://localhost:8087/xxx?wsdl");
报错，空指针，是因为编译环境的jre需要是jdk下的jre。重新设置，OK空指针不见了。



"java.lang.ClassNotFoundException: com/sun/tools/ " is often occurs if you use JRE in your IDE intead of JDK. Make sure, you use JDK in IDE (e.g. eclipse)