Deployment of Switchyard application fails with java.lang.NoClassDefFoundError: org/switchyard/component/bean/ReferenceInvoker

Solution Unverified - Updated -

Issue

We are using ReferenceInvoker for bean invocation, as we need to enrich the context. The code is similar to this modified sample from the Switchyard quickstarts:

import org.switchyard.component.bean.Reference;
import org.switchyard.component.bean.ReferenceInvocation;
import org.switchyard.component.bean.ReferenceInvoker;
import org.switchyard.component.bean.Service;

@Service(OrderService.class)
public class OrderServiceBean implements OrderService {

    @Inject 
    @Reference("InventoryService")
    private ReferenceInvoker service;  // USE ReferenceInvoker

    @Override
    public OrderAck submitOrder(Order order) {
        // Create an order ack
        OrderAck orderAck = new OrderAck().setOrderId(order.getOrderId());
        // Check the inventory
        try {
            ReferenceInvocation invoker = service.newInvocation("lookupItem").invoke(order.getItemId());
            Item orderItem = (Item)invoker.getMessage().getContent();

When this Switchyard application is deployed inside an *.ear archive, the deployment fails with the following error:

12:45:58,134 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.subunit."switchyard-quickstart-ear-deployment-assembly-1.1.1-p11-redhat-1.ear"."switchyard-quickstart-ear-deployment-order-service-1.1.1-p11-redhat-1.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.subunit."switchyard-quickstart-ear-deployment-assembly-1.1.1-p11-redhat-1.ear"."switchyard-quickstart-ear-deployment-order-service-1.1.1-p11-redhat-1.jar".SwitchYardService: com.google.common.collect.ComputationException: org.jboss.weld.exceptions.WeldException: by java.lang.NoClassDefFoundError: org/switchyard/component/bean/ReferenceInvoker
    at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:84)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: com.google.common.collect.ComputationException: org.jboss.weld.exceptions.WeldException: by java.lang.NoClassDefFoundError: org/switchyard/component/bean/ReferenceInvoker

Deploying the same code as plain *.jar works without issues. How can this be resolved?

Environment

  • Red Hat JBoss Fuse Service Works
    • 6.0.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content