私はこのようなオブジェクトを持つXMLの作成:次のコードでいつマーシャルこの手動は(KIE 6.5.0)
@XmlRootElement(name="com.Operation")
@XmlAccessorType(XmlAccessType.FIELD)
public class Operation implements java.io.Serializable
{
static final long serialVersionUID = 1L;
@org.kie.api.definition.type.Label("systemCode")
@XmlElement
private int systemCode;
[...]
を、うまく機能しそうです:
[...]
JAXBContext jaxbContext =
DroolsJaxbHelperProviderImpl.createDroolsJaxbContext(classNames, null);
Marshaller marshaller = jaxbContext.createMarshaller();
StringWriter xml = new StringWriter();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(object, System.out);
したがって、コンソール版画:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<com.Operation>
<systemCode>1</systemCode>
[...]
しかし、私は、コードを奨励KieServerClientを使用するとき、私はエラーを取得:
org.kie.server.client.KieServicesException: Error while serializing request data!
at org.kie.server.client.impl.AbstractKieServicesClientImpl.serialize(AbstractKieServicesClientImpl.java:514)
at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpPostRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:234)
at org.kie.server.client.impl.RuleServicesClientImpl.executeCommandsWithResults(RuleServicesClientImpl.java:72)
[...]
Caused by: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: class com.Operation ni ninguna de sus superclases se conocen en este contexto.
(ザ・スペイン語であるが、私はエラーが翻訳された非常に簡単です推測)
私はKieServerClientとJAXBに使用するコードのスニペット:
KieCommands commandsFactory = KieServices.Factory.get().getCommands();
List<Command<?>> cmds = new ArrayList<Command<?>>();
BatchExecutionCommand command = commandsFactory.newBatchExecution(cmds, SESSION_STATEFUL);
Command<?> insertObjectCommand = null;
insertObjectCommand = commandsFactory.newInsert(operation, operation.getClass().getName(), false, null);
cmds.add(insertObjectCommand);
[...]
KieServicesConfiguration config = KieServicesFactory.newRestConfiguration(KieServer.urlKieServer,
KieServer.name,
KieServer.password);
config.setMarshallingFormat(MarshallingFormat.JAXB);
KieServicesClient client = KieServicesFactory.newKieServicesClient(config);
RuleServicesClient rulesClient = client.getServicesClient(RuleServicesClient.class);
ServiceResponse<ExecutionResults> response = rulesClient.executeCommandsWithResults("instances/"+containerName, command);
何Iの任意のアイデア間違っていて、なぜマーシャルが働くのですか?
POJOを除いて、私は実際にこれらのプロジェクトを動作させるためにどのjarファイルが必要かを知りたいので、このプロジェクトはmavenの下にありません。mavenでは多くの依存関係が自動的に解決されます。私は必要です(私の.m2は私には分かりません)。 解決したら、プロジェクトをmavenに変換します。
参加するライブラリは以下のとおりです。
- droolsjbpm-integration-distribution-6.5.0.Final
- droolsjbpm-tools-distribution-6.5.0.Final
- HTTPClientの-4.5.3
- httpcore-4.4.6
- javax.ws.rs-API-2.0
- JAXB-XJC-2.3.0
- JMS-1。 1
- kie-remote-client-6.5.0.Final
- kie-remote-common-6.5.0.Final
- kie-remote-jaxb-6.5.0.Final
- KIE、サーバ - api-6.5.0.Final
- kie-server-client-6.5.0.Final
- optaplanner-core-6.5.0.Final
環境: - のJBoss Developer Studioの10.4 - Wildfly 10.1 - JDK 1.8
PS:私はREST経由でKieServerに接続することができましたが、落胆したコードが原因で、恐らくそれが原因です(私はnobody has ever answered meと思います)。この場合FIRING RULES USING KIE SERVER JAVA CLIENT API
キーがキエクライアントの設定オプションにクラスを追加しました:
github [link](https://github.com/eggsandbutter/kieservices)のサンプルプロジェクトがあります。 – Ruurd
KieServicesClientを使用して接続を設定する方法があります。バージョン7ではすべて同じですが、リモートライブラリの一部のコードはkie-server-client apiに移動されます。Workbenchはバージョン7の内部サーバなしで残されます。 – zhrist
コメントと確認をありがとう!私はすぐにバージョン7に切り替える必要があります。Droolsはこの昨年、非常に急速に進化しました。 – Ruurd