Apache CXF installation options into Tomcat - cxf

I want to be able to use Apache CXF with Tomcat. I have copied CXF's jar files into WEB-INF/lib and then I am able deploy my WAR file into Tomcat. That WAR file works fine in Tomcat, but that WAR file is then not usable in IBM WebSphere Liberty JEE server. I want to build my WAR files, such that they are write ones run any were.
The CXF app server configuration guide has no mention about Tomcat; the Metro project suggest that it's own jar file be copied into Tomcat's endorsed folder. Can the same be done for CXF? What is the best practice?

Best practice for a Tomcat deployment is to package the CXF jar files in the WAR file. It should also work as part of Tomcat's lib folder but I don't know many deployments using that.
Maybe you should take a look at Apache Tomee to have a combination with Tomcat and CXF?

Related

Migration from tomcat to wildfly

I am migrating my web application from tomcat to wildfly. I was able to deploy the app using a temporary workaround of placing the configurations inside the WEB-INF/web.xml (). But I wanted it outside my war file. Is there any equivalent for catalina/conf/localhost/myapplicationconfig.xml in wildfly. Any suggestions please. I tried naming subsytem configuration and also placing it in modules but it didn't work for me

Deploy a Spring app (JAR) for browser

I have no knowledge about deployment, production server, web server, etc. But I have a web application and my boss wants to deploy it in order to access it by web browser.
So, my application was generated by Spring Initializr.
It's using Spring (Boot, Security, Web, Data JPA), with web service REST (#RestController), HTML templates and AngularJS.
With mvn clean package, I generated a JAR file of this application. It is working on my desk. But, how can I deploy it?
I believe that my company has an OVH hosting. Can I install JBOSS or Tomcat on it, and upload my JAR on OVH?
You can deploy your application on Tomcat but you need to have a war instead of a jar to run it on an existing application server.
You can read the following documentation to create the war : http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging
Once done, you just have to upload it on the server in the webapps directory of your tomcat server.

JBoss modules cxf jar updating?

I'm using JBOSS EAP 6.2 for deploying the restful web service. The restful web service is using apache cxf, it is taking from jboss eap. Currently its using the jar cxf-api-2.7.7.redhat-1.jar . Is there any way that can I update this jar in the jboss modules also modules.xml.
I have upgraded jars on the server in the past by replacing the .jar file and updating the module.xml file with the new jar file name. Though not CXF (Make sure you stop the server first)
cxf is in %JBOSS_HOME%\modules\system\layers\base\org\apache\cxf

Not able to start the bundle in servicemix

I have a bundle up and running in Servicemix. I went to my company's repository and downloaded the corresponding JAR to my local machine. I extracted that JAR and found out that this JAR had only one folder META-INF.
Inside this folder, there is a Manifest.mf file and my resources such as Spring configuration file and Camel Context file.
there I got my first question: where are the source files of this JAR i.e. JAVA classes and all. Only thing I saw there was manifest file, pom.xml, another pom properties file and couple of other configuration files for spring and camel.
this led to my next step. I had a local copy of this project in my workspace as well. I build this project locally and found the JAR in target directory of the project.
Now following steps might seem silly but anyway I did little experiment. I extracted this JAR which I found in target and extracted it to see the content. I believed it was a bundle because I used maven-bundle-plugin and there is no way you could tell by looking at a JAR that its just a JAR or an OSGI bundle. ok so I extracted the JAR and guess what this time it did have the compiled java classes.
this is not the end, I did something silly again. I removed the compiled classes from this JAR and made it exactly same as which I copied from my Company's central repository. Now I used a JDK's JAR creation utility to create a JAR.
Now I have two JARS:
one which I downloaded from company's central repo.
another one which I created myself. it has exactly same content as the other one. I even used the same manifest.mf while creating this JAR. (Since I knew Manifest is the backbone of an oSGI Bundle).
I secure copied this bundle in my server's home directory. and finally, I installed this Bundle/JAR in Servicemix using :
install file:path_to_JAR/JAR_FILE_NAME.
it got installed successfully. but when I tried to start this bundle. it could not start. by using display-exception, I saw the exception : it wasnt able to load the beans and could not
initialize the Application Context followed by a more specific exception "ClassNotFound" exception. I understand that it wasnt able to find the classes defined in my application context. BUT WHYYYYYYYYYY?
I did exactly same steps and I checked it multiple times. if mine could not start, why the earlier one is up and running.
It might sound silly for others who have worked in OSGI environment, But now I am starting to re consider especially ServiceMix.
Thanks for any suggestion.
This is nothing about OSGi, it's more something about your application.
As I don't know your project I just can do some assumptions.
First the jar you got from the Company Repository is most likely an "older" version and not the same as your local sources. With Servicemix it's quite possible to just have blueprint or spring xmls in your bundle cause those are valid resources a Camel-Blueprint/Spring extender are able to pick up. Those XMLs are interpreted and if those only make use of standard Camel Components there is no reason to have a single Class inside your bundle.
Now back to your newly created Bundle, obviously you have some new "Code" in your camel-xml which requires not only standard Camel classes but also some Processes you created on your own, now those classes need to stay in the Bundle!
Best just deploy the newly created Bundle with all it's classes. You should rather check what has changed in the camel xml files.

Apache Camel route as a Windows Service

I have a Apache Camel route that is exported as a runnable jar file from eclipse. I use a simple bat file to run this route...
C:\PROGRA~1\Java\jre6\bin\java -jar C:\dev\_exports\mdt\cpnnectors_v1.jar
How can I run this as a window service instead with the output from the console to a log file?
I think there are some general windows tools you can use to turn Java apps into services. And I vaugely recall something added to the JDK6 or 7 to support that natively. Anyway try to google a bit.
Tanuki has been around for a long time and they offer such a tool
http://wrapper.tanukisoftware.com/doc/english/download.jsp
I know it is a bit of a late answer but I have managed to deploy my Camel Routes to Apache Karaf and Karaf comes with a service wrapper for both for windows and a deamon wrapper for linux. Basically I know have my Camel routes deployed to Karaf and it is running as a service on windows with really minor hassle.
Karaf is easy to install and the help file also show you how to install the wrapper.

Resources