Cannot find the right camel-cxf dependencies for v3.18.0, e.g. CxfHeaderFilterStrategy, CxfOperationException - apache-camel

My application has been using
org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy
org.apache.camel.spi.HeaderFilterStrategy.Direction
org.apache.camel.component.cxf.CxfOperationException
defined by camel-cxf. But my build fails when using Camel 3.18.0. What dependencies changes do I need for these classes in 3.18.0?

Copying from the Camel 3.18 upgrade guide:
https://camel.apache.org/manual/camel-3x-upgrade-guide-3_18.html#_camel_cxf
The camel-cxf JAR has been split up into SOAP vs REST and Spring and non Spring JARs.
camel-cxf-soap
camel-cxf-spring-soap
camel-cxf-rest
camel-cxf-spring-rest
camel-cxf-transport
camel-cxf-spring-transport
When using Spring Boot then you need to migrate from camel-cxf-starter to use SOAP or REST:
camel-cxf-soap-starter
camel-cxf-rest-starter

Related

Swagger UI configuration via Apache CXF's Swagger2Feature

I use the Swagger2Feature in Apache CXF to provide Swagger documentation for our API. Swagger UI is provided as a Maven dependency via WebJars.
I would like to configure some Swagger UI properties (as documented here), for example validatiorUrl. Is this possible to accomplish when using the combination of WebJars / CXF? I can't find a way to configure these settings "at runtime".
I'm using CXF 3.2.1 and Swagger UI 3.17.1.

Using blueprint as the Apache Camel DSL to describe routes in IBM Liberty

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.

Call remote ejb from camel route

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.

build configuration : Java backend (Spring + Maven) with JS project (Angular)

we would like to improve build configuration/integration of Java + JavaScript projects.
back-end : Java app, Spring framework, REST API + maven as build tool
front-end : HTML + CSS + JavaScript, (based on ng-boilerplate project template - it separates nicely all modules,services,directives,shared assets) and it's using few JavaScript tools like npm, Bower, Karma + Grunt
Workspace configuration is pretty simple - each project in separate directory :
/workspace
/JavaBackend
/JsFrontend
Problem is that developers are dealing with “Origin null is not allowed by Access-Control-Allow-Origin" messages in browsers as they run AJAX queries from front-end (from file://..../JSApp/build/index.hml) and Java App server is on localhost:8080. We could switch browser security off or modify headers to allow cross origin requests but we think it's not good way how to achieve that.
We don't want to have JS resources inside of Java project in /src/main/webapps/ as in production environment apps will be deployed on different machines and each app has it's own build server.
Do you have experience with similar project configuration ? What would you recommend to us ?
Meanwhile we will experiment with Tomcat 7 to check if it can e.g. serve external static resources (js stuff) out of context of java app
For development purposes, I would let Tomcat include the front-end folder in the server.xml by means of a <Context> tag. The folder can be arbitrary and even in another repository (e.g. /GitRepos/ApplicationGui/app).
...
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
<Context docBase="/workspace/JsFrontend" path="/"/>
<Context docBase="FlexibleOrders" path="/FlexibleOrders" reloadable="true" source="org.eclipse.jst.j2ee.server:FlexibleOrders"/>
</Host>
</Engine>
</Service>
</Server>
In production, I would recommend to make a Maven artefact out of the front-end. It can be then included via dependency in the backend like this:
<dependency>
<groupId>org.enterprise</groupId>
<artifactId>application-gui</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
See this blog for a complete configuration for production:
http://wiki.switajski.de/2016/01/24/how-to-create-maven-artifact-with-static-web-resources.html

Getting problems in adding cutom JAAS Login module in Servicemix

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.

Resources