[jboss-jira] [JBoss JIRA] (JBRULES-3520) CamelServerApp.class missing, camel-client.xml wrong for Drools and jBPM integration camel server war on Tomcat

Damon Horrell (JIRA) issues at jboss.org
Fri Apr 11 21:58:13 EDT 2014


    [ https://issues.jboss.org/browse/JBRULES-3520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12961320#comment-12961320 ] 

Damon Horrell commented on JBRULES-3520:
----------------------------------------

This isn't working in Drools 6.0.1 either.

In this case CamelServerApp.java needs a small modification to work because the package name of the Message class is wrong.  And the camel-client.xml is also different.

The steps to make it work are:

1. Download drools-camel-server-example-6.0.1.Final.war
2. Compile CamelServerApp.java (below) and add to war at path WEB-INF\classes\org\drools\server
3. Add camel-client.xml (below) to the war at path WEB-INF\classes
4. Deploy to Tomcat and browse to http://localhost:8080/drools-camel-server-example-6.0.1.Final/test.jsp

CamelServerApp.java:
----------------------
/*
 * Copyright 2010 JBoss Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.drools.server;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.camel.CamelContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class CamelServerApp {

	public static void main(String[] args) {
		String msg = "Hello World";

		System.out.println("Sending Message:\n" + msg);

		CamelServerApp test = new CamelServerApp();
		String response = test.send(msg);

		System.out.println();
		System.out.println();

		System.out.println("Received Response:\n" + response);
	}

	public String send(String msg) {
		ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext("classpath:/camel-client.xml");
		String batch = "";
		batch += "<batch-execution lookup=\"ksession1\">\n";
		batch += "  <insert out-identifier=\"message\">\n";
		batch += "      <org.drools.server.Message>\n";
		batch += "         <text>" + msg + "</text>\n";
		batch += "      </org.drools.server.Message>\n";
		batch += "   </insert>\n";
		batch += "</batch-execution>\n";

		CamelServerApp test = new CamelServerApp();
		String response = test.execute(batch, (CamelContext) springContext.getBean("camel"));

		return response;
	}

	public String execute(String msg, CamelContext camelContext) {

		String response = camelContext.createProducerTemplate().requestBody("direct://kservice/rest", msg, String.class);

		return response;
	}

	public String execute(SOAPMessage soapMessage, CamelContext camelContext) throws SOAPException, IOException {
		Object object = camelContext.createProducerTemplate().requestBody("direct://kservice/soap", soapMessage);
		OutputStream out = new ByteArrayOutputStream();
		SOAPMessage soapResponse = (SOAPMessage) object;
		soapResponse.writeTo(out);
		return out.toString();
	}
}
-------------------
camel-client.xml:
-------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf"
	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
	<bean id="kiePolicy" class="org.kie.camel.component.KiePolicy" />
	<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
		<route>
			<from uri="direct://kservice/rest" />
			<policy ref="kiePolicy">
				<to uri="cxfrs://http://localhost:8080/drools-camel-server-example-6.0.1.Final/kservice/rest" />
			</policy>
		</route>
	</camelContext>
</beans>

                
> CamelServerApp.class missing, camel-client.xml wrong for Drools and jBPM integration camel server war on Tomcat
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-3520
>                 URL: https://issues.jboss.org/browse/JBRULES-3520
>             Project: JBRULES
>          Issue Type: Release
>      Security Level: Public(Everyone can see) 
>          Components: drools-camel
>    Affects Versions: 5.4.0.CR1, 5.4.0.Final
>         Environment: Tomcat 6.x
>            Reporter: Ryley Gahagan
>            Assignee: Geoffrey De Smet
>            Priority: Minor
>             Fix For: 5.4.0.CR1, 5.4.0.Final
>
>   Original Estimate: 2 hours
>  Remaining Estimate: 2 hours
>
> The CamelServerApp.class file is missing from the war. Also, the camel-client.xml has, as default:
> <to uri="cxfrs://http://localhost:8080/drools-server/kservice/rest"/>
> <to uri="cxfrs://http://localhost:8080/drools-server/kservice/soap"/>
> Which Tomcat deploys out of the box as
> <to uri="cxfrs://http://localhost:8080/drools-camel-server-5.4.0.Final/kservice/rest"/>
> <to uri="cxfrs://http://localhost:8080/drools-camel-server-5.4.0.Final/kservice/soap"/>
> (...5.4.0.CR1 for that dist)
> Has existed for awhile, apparently. Documentation indicates test.jsp working out of the box.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list