Package org.apache.camel

Examples of org.apache.camel.NoSuchBeanException


        try {
            return type.cast(answer);
        } catch (Throwable e) {
            String msg = "Found bean: " + name + " in JNDI Context: " + context
                    + " of type: " + answer.getClass().getName() + " expected type was: " + type;
            throw new NoSuchBeanException(name, msg, e);
        }
    }
View Full Code Here


    @Override
    protected Object lookupBean() throws NoSuchBeanException {
        try {
            return registry.lookup(getName());
        } catch (NotBoundException e) {
            throw new NoSuchBeanException(getName(), e);
        } catch (AccessException e) {
            throw new RuntimeCamelException(e);
        } catch (RemoteException e) {
            throw new RuntimeCamelException(e);
        }
View Full Code Here

        try {
            return type.cast(answer);
        } catch (Throwable e) {
            String msg = "Found bean: " + name + " in BlueprintContainer: " + blueprintContainer
                    + " of type: " + answer.getClass().getName() + " expected type was: " + type;
            throw new NoSuchBeanException(name, msg, e);
        }
    }
View Full Code Here

        try {
            context.start();
            fail("Should have thrown exception");
        } catch (FailedToCreateRouteException e) {
            assertEquals("b", e.getRouteId());
            NoSuchBeanException cause = assertIsInstanceOf(NoSuchBeanException.class, e.getCause());
            assertEquals("bar", cause.getName());
        }
    }
View Full Code Here

        try {
            context.start();
            fail("Should have thrown exception");
        } catch (FailedToCreateRouteException e) {
            assertEquals("b", e.getRouteId());
            NoSuchBeanException cause = assertIsInstanceOf(NoSuchBeanException.class, e.getCause());
            assertEquals("bar", cause.getName());
        }
    }
View Full Code Here

     * @throws NoSuchBeanException if no bean could be found in the registry
     */
    public static Object lookupMandatoryBean(Exchange exchange, String name) throws NoSuchBeanException {
        Object value = lookupBean(exchange, name);
        if (value == null) {
            throw new NoSuchBeanException(name);
        }
        return value;
    }
View Full Code Here

     * @throws NoSuchBeanException if no bean could be found in the registry
     */
    public static <T> T lookupMandatoryBean(Exchange exchange, String name, Class<T> type) {
        T value = lookupBean(exchange, name, type);
        if (value == null) {
            throw new NoSuchBeanException(name);
        }
        return value;
    }
View Full Code Here

        try {
            template.sendBody("ref:xxx", "Hello World");
            fail("Should have thrown an exception");
        } catch (ResolveEndpointFailedException e) {
            assertEquals("Failed to resolve endpoint: ref://xxx due to: No bean could be found in the registry for: xxx of type: org.apache.camel.Endpoint", e.getMessage());
            NoSuchBeanException cause = assertIsInstanceOf(NoSuchBeanException.class, e.getCause());
            assertEquals("xxx", cause.getName());
        }
    }
View Full Code Here

                        // camel-spring is missing on the classpath
                        throw new RuntimeCamelException("Cannot create a transacted policy as camel-spring.jar is not on the classpath!");
                    }
                } else {
                    if (maps.isEmpty()) {
                        throw new NoSuchBeanException(null, "PlatformTransactionManager");
                    } else {
                        throw new IllegalArgumentException("Found " + maps.size() + " PlatformTransactionManager in registry. "
                                + "Cannot determine which one to use. Please configure a TransactionTemplate on the transacted policy.");
                    }
                }
View Full Code Here

            } catch (Throwable e) {
                // do not double wrap the exception
                if (e instanceof NoSuchBeanException) {
                    ex = (NoSuchBeanException)e;
                } else {
                    ex = new NoSuchBeanException(name, "Cannot lookup: " + name + " from registry: " + registry
                        + " with expected type: " + type + " due: " + e.getMessage(), e);
                }
            }
            if (answer != null) {
                return answer;
View Full Code Here

TOP

Related Classes of org.apache.camel.NoSuchBeanException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.