错误soapResponse异常SpringBusFactory

时间:2019-02-22 17:16:17

标签: java web-services soap jbpm

我正在尝试使用Java使用Soap Web服务,它仅与Eclipse IDE一起使用,但是在导入JBPM项目时却不起作用。我得到的错误是:

  

无法确定BusFactory实现类名称:java.lang.ClassCastException:类org.apache.cxf.bus.spring.SpringBusFactory

它与Eclipse完美配合

enter image description here 我的源代码:

import java.io.*;
import java.util.Iterator;
import javax.xml.soap.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.*;
import org.xml.sax.InputSource;
public class metodos {
 public metodos() {
    super();
 }

public String getInfo() {
    String retorno = "";
    System.out.println("methodGetInfo ");
    try {
        System.out.println("methodGetInfo newInstance");
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        System.out.println("methodGetInfo createConnection");
        SOAPConnection soapConnection = soapConnectionFactory.createConnection();
        System.out.println("methodGetInfo MessageFactory newInstance");
        MessageFactory messageFactory = MessageFactory.newInstance();
        System.out.println("methodGetInfo createMessage");
        javax.xml.soap.SOAPMessage soapRequest = messageFactory.createMessage();
        System.out.println("methodGetInfo getSOAPPart");
        SOAPPart soapPart = soapRequest.getSOAPPart();
        System.out.println("methodGetInfo getEnvelope");
        SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
        soapEnvelope.addNamespaceDeclaration("end", endPoint);
        SOAPBody soapBody = soapEnvelope.getBody();
        soapBody.addChildElement("getInfo", "end");
        soapRequest.saveChanges();

        System.out.println("methodGetInfo soapConnection call");
        SOAPMessage soapResponse = soapConnection.call(soapRequest, url);
        System.out.println("methodGetInfo transformerFactory");
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        System.out.println("methodGetInfo newTransformer");
        Transformer transformer = transformerFactory.newTransformer();
        System.out.println("methodGetInfo getSOAPPart");
        Source sourceContent = soapResponse.getSOAPPart().getContent();

        System.out.println("methodGetInfo StringWriter");
        StringWriter writer = new StringWriter();
        System.out.println("methodGetInfo StreamResult");
        StreamResult result = new StreamResult(writer);
        System.out.println("methodGetInfo transformer.transform");
        transformer.transform(sourceContent, result);

当我使用JBPM时,出现此错误:

JPBMERROR

该错误是由以下行引起的:

  

SOAPMessage soapResponse = soapConnection.call(soapRequest,url);

我没有在Java中使用任何外部库。

Java编译器级别:1.8

JBPM版本:7.17.0最终版

1 个答案:

答案 0 :(得分:0)

似乎有两种不同版本的apache cxf,一种来自EAP模块,另一种版本与jbpm application war / lib文件夹不同。您必须禁用其中一个jar才能解决此冲突。