I would like to create a command in Karaf to suspend all Camel routes that are currently Started. Similarly, I will have another script to resume all suspended routes.
My thought was to do something like:
each (camel:route-list | grep Started) { camel:route-suspend $route }
My first problem is that camel:route-list does not return values
Any help would be greatly appreciated.
The current Camel Karaf commands cannot do this. I logged a ticket to see if we can improve this in a future Apache Camel release.
https://issues.apache.org/jira/browse/CAMEL-7857
So the answer is: this is not possible with the script above. You would need to write your own Camel commands and install in Karaf that can do that.
Related
I'm using the Camel SMTP component to send email messages from a Camel route, and it works fine, but I get two warning messages every time I send a mail.
expected resource not found: /META-INF/javamail.default.providers
expected resource not found: /META-INF/javamail.default.address.map
Is there a way of stopping this? I've tried putting blank resource files in the META-INF folder of the route's jar file, but that doesn't appear to have any effect. Apparently JavaMail tries to find these files in various places on the classpath, and default files should be in the JavaMail jar file, but for some reason, this isn't being picked up in the OSGi environment from which I'm running these routes.
The OSGi (Karaf) console lists bundles
JavaMail API v1.6.1
camel-mail 2.21.2
Can anyone tell me what I am missing here?
Thanks!
I tried a few solutions given at https://javaee.github.io/javamail/docs/api/index.html?javax/mail/Session.html. I use eclipse photon 4.8.0. The only thing what worked is to place an empty file named javamail.default.address.map into the folder src/main/java/META-INF. Alternative you can place it into the folder src/main/resources/META-INF, when you change the exclusion-pattern in eclipse-project to (none). Now everything works fine without the annoying warning.
My goal is to get Camel running under IBM Liberty application server using OSGi and be able to describe the DSL (Domain Specific Language) routes in Blueprint. I am making progress and now have a Liberty environment with Camel installed and configured as OSGi bundles. When I write a Java DSL Camel app as an OSGi bundle, all works exactly as I might hope.
My last step is to be able to describe my camel routes in Blueprint. To that end I create a new OSGi bundle and defined a blueprint.xml that looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camelBlueprint="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint-2.14.1.xsd">
<camelBlueprint:camelContext>
<camelBlueprint:route>
<camelBlueprint:from uri="file:c:/temp/in"/>
<camelBlueprint:to uri="file:c:/temp/out"/>
</camelBlueprint:route>
</camelBlueprint:camelContext>
</blueprint>
When I attempt to deploy this OSGi bundle, the IBM Liberty OSGi framework fails to deploy the application with the following errors:
[3/2/15 0:42:38:796 CST] 00000035 com.ibm.ws.app.manager.esa.internal.DeploySubsystemAction
A CWWKZ0403E: A management exception was generated when trying to install the application Camel1 into an OSGi framework. The error text from the OSGi framework is:
Resource does not exist: org.apache.aries.subsystem.core.archive.SubsystemContentRequirement:
namespace=osgi.identity, attributes={}, directives={filter=(&(osgi.identity=OSGITest1)(type=osgi.bundle)(version>=1.0.0))}, resource=org.apache.aries.subsystem.core.internal.SubsystemResource#7bc2d3bc
Unfortunately this is where I am now stumped and stuck. I believe that IBM Liberty uses Equinox as the OSGi platform and not Karaf but reading the Camel Blueprint docs I seem to understand that Apache Aries is required (which Liberty supplies and uses) and that Karaf isn't a dependency.
My MANIFEST.MF for my test bundle is:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: OSGITest1
Bundle-SymbolicName: OSGITest1
Bundle-Version: 1.0.0.qualifier
Bundle-Blueprint: OSGI-INF/blueprint/*.xml
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: kolban.osgitest
Import-Package: org.apache.camel;version="2.14.1",
org.apache.camel.blueprint;version="2.14.1"
this message can occur if the resolver can't see the bundle, or there's something wrong with the bundle (typically with the Blueprint). If the bundle resolves ok when you remove the blueprint, then you need to look at what might be wrong in the blueprint. If this is the case, I would suspect you don't have the Camel blueprint namespace handler enabled in the runtime.
I hope this helps.
Regards, Graham.
With a newly scaffolded app generated from "yo jhipster" and started with "mvn spring-boot:run" and "grunt server" I am able to load the app and do operations like login, view metrics, see sessions, settings, logs, and audits. However, whenever I view the "User Tracker" page I don't see anything?
I believe this section is supposed to demonstrate Atmosphere websocket / AngularJS integration? Looking at the browser console logs, I see the following:
Websocket failed. Downgrading to Comet and resending atmosphere.js:2866
GET http://0.0.0.0:9000/websocket/activity?X-Atmosphere-tracking-id=0&X-Atmosph…true&X-Cache-Date=0application%2Fjson&X-atmo-protocol=true&_=1393276976964 404 (Not Found)
It appears that a websocket connection is attempted but eventually times out and the fallback long polling doesn't work? I'm using the latest Chrome (also tried on latest versions of Firefox and Safari as well).
Am I missing something simple?
-- Update 1 --
Deploying it as a WAR to Tomcat 7.0.50 shows data back from Atmosphere in the User Tracker page but it continuously loops trying to get a WebSocket connection (HTTP status code 101: switching protocols) so the user data appears and disappears periodically. I saw an error in Chrome like this:
No suspended connection available. Make sure atmosphere.subscribe has been called and request.onOpen invoked before invoking this method
The Tomcat logs show the following:
[WARN] org.atmosphere.cpr.DefaultAnnotationProcessor - Unable to detect annotations. Application may fail to deploy.
-- Update 2 --
Deploying it as a WAR to Jetty 8.1.14.v20131031 (Jetty 9.1.1.v20140108 throws errors) and testing it with Chrome 32.0.1700.107 appears to work for the fallback transport of long-polling. The initial connection to WebSockets, however, fails because Atmosphere for some reason thinks the servlet container is Tomcat? In the server logs, it throws the following issue:
java.lang.ClassCastException: org.eclipse.jetty.server.Request cannot be cast to org.apache.catalina.connector.RequestFacade
at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:141)
at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.service(Tomcat7Servlet30SupportWithWebSocket.java:62)
Thanks again for all your help -- definitely making progress :)
-- Update 3 --
To summarize everything:
Currently "mvn spring-boot:run" and "grunt server" don't work together for Websockets or long-polling
If you deploy the JHipster WAR (mvn package) to Jetty 8.1.14.v20131031 then it works but you need to remove the following dependency from your JHipster pom.xml or else Atmosphere will not provide WebSocket support:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
Argh. False alarm -- I had it running using streaming, not websockets, so WebSockets still has the error from update2
No you're not missing anything :-)
If you use the Java server directly it should work: you need to connect to the application with another browser (or another tab) and you will see working.
However, with "grunt server", there is a bug: the Grunt proxy just does not support Websocket, so it doesn't work... There is one strange thing, thus, it's that the fallback transport does not work.
I'm filling this as a bug.
-- update 1 --
Concerning your update, it looks there's another Atmosphere bug:
http://atmosphere-framework.2306103.n4.nabble.com/Log-warning-that-Atmosphere-is-unable-to-detect-annotations-td4658159.html
It seems that Atmopshere can't find its annotation inside a WAR, can you try the same thing in development mode ("mvn spring-boot:run")? That would means it's an issue with WARs in Tomcat
I'd like to create osgi bundle which listen for soap messages and route them to remote ejb. I have servicemix 4.x as a bundle environment, glassfish 4 as a ejb container and camel as routing engine. Is it possible to connect to each other?
Yes, there cxf and ejb components and you should be able to define your route like this:
from("cxf:...")
// ...
.to(ejb:...")
;
Please refer to: Apache Camel Components - CXF and EJB.
I am using Servicemix 4.2 for my osgi based webservice application.
My webservice application is exposed using the CXF stack provided with the Servicemix.
Now we have to integrate the application with a separately developed Authentication api. The third party api is using JAAS as the mean to authenticate.
I embedded the third party jars in my application bundle. I exported the LoginModule implementation class using export-package instruction.
When I tried to use the third party provided jaas module, it gave error
Cannot create Login Context.No LoginModules configured for LoginModule
The third party jaas provider finds the location of jaas.config file using the system property
java.security.auth.login.config
The content of jaas.config file is as follows
LoginModule {
com.altair.aaservice.windowsauthn.hwec.WindowsAuthentication required;
};
After doing googling, I found that servicemix out of box provides two System bundles for jaas
Apache Felix Karaf :: JAAS Modules (1.4.0)
Apache Felix Karaf :: JAAS Config (1.4.0)
And you need to modify etc/users.properties file and some other things to implement jaas. But as we need to integrate with a third party jaas provider, i can not look into these ways. Also most of the documentation provided with servicemix insist you to use the servicemix way to implement jaas hence I did not get much success in finding any solution.
I manually uninstalled the two system bundles, after that I got following error
javax.security.auth.login.LoginException: unable to find LoginModule class: com.altair.aaservice.windowsauthn.hwec.WindowsAuthentication not found from bundle [org.apache.cxf.bundle]
As my webservice is CXF based, it may be looking in this bundle.
Is there any convenient way to integrate servicemix with custom jaas implementation. Please tell if there is any.
There is an example of writing a custom JAAS LoginModule here.