Camel: org.apache.camel.ResolveEndpointFailedException: No component found with scheme - apache-camel

I have a custom Camel component packaged in a separate jar. As advised here:
http://camel.apache.org/how-do-i-add-a-component.html
I created a file a META-INF/services/org/apache/camel/component/aq (aq is the component scheme name) containing:
class=<full class name>
Everything works When I run a test program standalone. However, when I try deploying it into a container (servicemix, karaf) it cannot resolve the component scheme name:
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route7: Route(route7)[[From[aq:oprDequeuer]] -> [WireTap[properties:... because of Failed to resolve endpoint: aq://queue1 due to: No component found with scheme: aq
Also, when I register the component explicitly:
CamelContext context = getContext();
context.addComponent("aq", new AQComponent(context));
it works fine, including ServiceMix.

Make sure that file in META-INF is included in the JAR.
If that file is missing then the component cannot be auto discovered, and that is your problem. As you build a component for OSGi, then maybe the felix bundle plugin somehow does not include that file.
I suggest to double check this, and look inside the built JAR if the file is included.

Related

Target class [App\\Http\\EnsureFrontendRequestsAreStateful] does not exist

I am using Laravel Sanctum to authenticate a react SPA with a laravel API backend.
While I am trying to access routes which does not need authentication, I am getting this error:
"Target class [App\Http\EnsureFrontendRequestsAreStateful] does not exist."
What should I do to guard only some routes, while leaving others open.
You are probably missing the import in the app/Http/Kernel.php file.
// app/Http/Kernel.php
<?php
namespace App\Http;
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
This can usually be solved with: composer dump-autoload
You can read more about what the command does here
composer dump-autoload won’t download a thing. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php). Ideal for when you have a new class inside your project.

JavaMail not working in OSGI(ServiceMix/Karaf)

I created a Karaf Instance on a Service Mix(7.0.1) and deployed my bundles into it.
The camel route is starting up properly, but always fails when it should send an email.
With the following exception:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
I tried several solutions i found from different sources around the web, but cannot actually fix it.
I tried commenting javax.activation out in the jre.properties file of the instance, as well as using a bundle that contains java mail and the osgi friendly version of the activation bundle in the same feature.
Could openJDK be an issue here?
Note: Everything works perfectly fine on a windows/oraclejdk environment, the exception only occurs in a linux/openjdk environment.
My issue stemed from a class loader problem after all and i fixed it by bundling javax.mail/mail/1.4.7 and org.apache.servicemix.specs.activation-api-1.1/2.8.0 in the same bundle.
I also needed to remove every occurence of javax.activation from the jre.properties and config.properties file of the child instance.
I am not sure why it ran per default on a different environment, as in theory the same classloader problems should have occured too, but that might be connected to different JREs being in use.

Vespa Tutorial – HTTP API use-case fails to activate with IllegalArgumentException

I'm currently following the Vespa tutorials, and ran into an issue with the HTTP API use-case. Everything works fine from the mvn install package to the vespa-deploy prepare target/application.zip.
The call to vespa-deploy activate returns normally, but the application then never gets available on localhost:8080. Looking at /opt/vespa/logs/vespa/vespa.log (in the VM) one finds the following stack trace:
Container.com.yahoo.jdisc.core.StandaloneMain error Unexpected:
exception=
java.lang.IllegalArgumentException: Could not create a component with id 'com.mydomain.demo.DemoComponent'.
Tried to load class directly, since no bundle was found for spec: sample-app-http-api-searcher.
If a bundle with the same name is installed, there is a either a version mismatch or the installed bundle's version contains a qualifier string.
at com.yahoo.osgi.OsgiImpl.resolveFromClassPath(OsgiImpl.java:48)
...
This occurred using a fresh Docker image with a clean clone of the sample-apps git repository. Preparing and activating the basic sample as well as the other http example did work seamlessly.
I checked the sources and the xml files for obvious problems but don't have any clue about what is failing and where.
target/application.zip contains
application/components/http-api-using-searcher-1.0.1-deploy.jar
application/hosts.xml
application/searchdefinitions/basic.sd
application/services.xml
And the jar itself does contain a com/mydomain/demo/DemoComponent.class file (among other things).
Potentially related issue on the github tracker: https://github.com/vespa-engine/vespa/issues/3479 I'll be posting a link to this question there as well, but I still think it's worth a SO question, at least to get some action behind the vespa tag :)
The bundle id in the application's services.xml file was wrong. Please pull the application from git and try again now. See also PR: https://github.com/vespa-engine/sample-apps/pull/18
Brief explanation: The bundle id given in the bundle="<id>" declaration in services.xml must match the 'Bundle-SymbolicName' in the bundle's manifest. When the bundle has been built with the Vespa bundle-plugin, the symbolic name is by default the same as the project's artifactId. Hence, in most cases you just have to verify that the bundle id matches the artifactId.

How do I configure Flow in a newly created React JS app?

After creating a new React app with create-react-app, there is no .flowconfig file. If I flow at command line, I get:
Could not find a .flowconfig in . or any of its parent directories.
See "flow init --help" for more info
If I do a flow init, it'll create a .flowconfig file, but with no default configuration:
[ignore]
[include]
[libs]
[options]
This seems to be all that I need to do to get flow working. In contrast, a newly created React Native app has a .flowconfig file with a lot of "default" configuration.
Is there a recommended default configuration for a React JS environment?
I don’t know much about React Native, but indeed this should be all that’s necessary to get Flow working with an app generated by Create React App. Of course you’ll also need to add // #flow to the files in which you want Flow to be enabled.
See also “Adding Flow” in the User Guide.

JBoss Fuse - Relative paths for bundles

I have a camel project, where I use a java bean reference.
Inside this .java I'm reading a file which path is "src/main/resources/basic.xml"
I build the osgi-bundle with apache felix and I write the instruction:
<Include-Resource>src/main/resources</Include-Resource>
The bundle builds fine, and I also test with another maven plugin (mvn camel:run)
and everything works fine =)
Then I deploy it on my osgi container (Karaf) adding all dependencies for this OSGI, but it fails
cause is not finding basic.xml
FileNotFound /home/user/jboss-fuse-xx/instances/testCOntainer/src/main/resources/basic.xml
If I change the path on my .java like "basic.xml" the result is:
FileNotFound /home/user/jboss-fuse-xx/instances/testCOntainer/basic.xml
So the relative path is the container root path, where I deploy this bundle.
The easy way to resolve this, is to put the basic.xml in this path, I know :P, but ¿is there another way?
Is there an apache felix instruction that fix this??? so the bundle can resolve this path, no matter where is deployed
I've worked with the Import-package instruction before and works fine, but only when I 'call' this resource on a camel route, not in a java class.
Thanks for all the answers !!

Resources