Difference between Apache CXF Jetty endpoint and embedded Jetty container - cxf

I started building a web application and made it runnable with an embedded Jetty server. I then decided to try out Apache CXF (which I have never used before) to provide either a SOAP/XML or a REST/JSON interface (haven't decided which yet). Now I am slightly confused by the various posts / docs I have read.
I understand that CXF actually provides (using Jetty internally) its own endpoints that can be published. Is that correct? But it looks like it can also be bundled and deployed into existing web containers (eg Tomcat, and therefore I assume also Jetty) - is this also correct?
If both of these are correct, what are the pros / cons / gotchas of using the CXF Jetty endpoints out-of-the-box as opposed to using a separate container (especially if the separate container is also embedded Jetty)?

It really depends on your application and deployment strategy. Jetty is a lightweight, embedded application server that you can use to run your own web-server. If you choose Apache Tomcat or JBoss or any other application server your application will be likely packaged as a WAR and deployed. The difference is , in Jetty your application controls the container whereas with others its the other way around. Regardless of the choice of application server , CXF endpoints are designed to work with any container supporting JAX-RS or JAX-WS specifications.
Note: You don't need Jetty if you are going to deploy it on Tomcat or other containers.

Related

Deploy CXF jax-ws webservice on Websphere 8.5.5.12

I am trying to deploy a jax-ws webservice on Websphere 8.5.5.12. I am using CXF as my jax-ws engine. I have gone through the prerequisites and changed the class loader as well as desabled the JaxWs engine in websphere. I have set the property to disable Jax-WS engine in the manifest file of my war file.
My application is a Spring boot application. I am also using apache camel 2.20.1 and using the cxf end point to consume the messages.
As a spring boot application my application is working fine.
When I deploy on Websphere my application starts without any issues. But when it intercepts any incoming requests, it throws class not found exception for javax.servlet.WriteListener class. This class is part of the servlet api. It should have been part of the Websphere j2ee library.
Need to know what I did wrong. I don't want to take the shared library route. I have been suggested, that I need to move all my cxf dependencies, into a shared library and set my class loader for this library. I am not comfortable with this solution.
javax.servlet.WriteListener is a Servlet 3.1 / Java EE7 API.
WebSphere Application Server 8.5.5 implements Servlet 3.0 / Java EE6.
You should use either WebSphere Application Server 9.0.0.x or any recent WebSphere Liberty release (which has been versioned differently for quite some time).
(or, remove the 3.1 dependencies from your app if you must run it on WebSphere Application Server 8.5.5)

Monitoring Multiple Instances of camel web application in a single Dashboard

I have a camel web application for writing API's,which was deployed in multiple servers.I want a monitoring tool which can integrate these clustered instances and can monitor the Metrices of the application.I have looked into HawtIO but can it monitor all the server instances in a single Dashboard.
If you use Fabric8 (or JBoss Fuse in that sense) you can use Fabric to manage and monitor all your instances in one place. Fabric8 also uses Hawtio for this purpose.

Apache Camel - Backbone of IT infrastructure?

I have a bunch of web services. These services are written in different languages and expose a REST api. A front end web site accesses these services. The requests are proxied through a nginx server which does load balancing and connection management. This has been rock solid and very performant.
I'm contemplating replacing nginx with Apache Camel to take advantage of its powerful mediation and integration patterns. I have a few questions since I'm completely new to the Java ecosystem.
How performant is Apache Camel? Would the req/sec of a jetty end point be comparable to nginx?
Spring looks confusing. Can a standalone Camel application be deployed to something like AWS Elastic Beanstalk? If I want allow Camel to process more requests/sec, do I just add another Camel server in tandem?
Are there any pitfalls to using Apache Camel as the backbone to my entire IT infrastructure?
You have not mentioned what the major motivation is for changing the current architecture. Here are my comments:
How performant is Apache Camel? Would the req/sec of a jetty end point
be comparable to nginx?
I doubt if you will get the same req/sec performance from camel jetty as you do with nginx. Please dont take my word and try a load yourself with both the setup. I feel the message/exchange handling by camel will incur some cost that is missing form nginx. But both have different uses.
If I want allow Camel to process more requests/sec, do I just add
another Camel server in tandem.
This question is confusing. I assume your requests passed through one nginx. If you add multiple camel servers you need the sender to be available of the multiple camel servers or use some routing or load balancing mechanism in front of it that is aware of multiple camel instances.
Are there any pitfalls to using Apache Camel as the backbone to my
entire IT infrastructure?
This depends on what your problems are and how much of it is resolved by camel. Camel is an integration framework that supports multiple protocols. I see you only have web services which is supported by camel. But your current infrastructure already supports it.

Lightweight messaging on GAE

Does you have any experience with messaging on GAE? Is there a messaging framework that can successfully run on GAE? I know that Apache Camel provides some kind of components that can run on GAE but is it really usable? What about Spring Integration? Or any other tips?
Thank you.
You have some stuff (task queues) built into GAE for messaging. Start with that.
The problem with running stand alone integration soltuions (Camel, Spring Integration, ActiveMQ..) on GAE is that they need to open tcp listeners and start threads, which is not really an option in GAE. At least not the standard java way.
You can run Camel to some point if you want to leverage the Camel DSL and such things. But all of Camel will not work. Camel does not include a messaging solution either.
The other option is likely to use some external messaging source, such as a RabbitMQ or ActiveMQ hosted somewhere else. Like EC2 or some cloud service.

How to deploy GWT GAE applications on external server

I Have an GWT+GAE application with nosql database that runs fine in Google App Engine and in eclipse + gwt plugin with embedded jetty server on development environment.
Now in production environment, for many causes, i have to deploy this application on an external self managed server like Tomcat or JBoss.
I follow with no luck many tutorials and tips&tricks like:
https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT%27s
https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-java/LYySmvqdbO8
or Link1 Link2 Link3 Link4 Link5
When I deploy my application on an external server (i.e. tomcat or jetty) it starts correctly but when I do a call that uses database connection it gives this error:
Caused by: java.lang.NullPointerException: No API environment is registered for this thread.
at com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:86)
at com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppIdNamespace(DatastoreApiHelper.java:96)
at com.google.appengine.api.datastore.Query.<init>(Query.java:171)
at com.google.appengine.api.datastore.Query.<init>(Query.java:102)
at com.googlecode.objectify.impl.QueryImpl.<init>(QueryImpl.java:69)
at com.googlecode.objectify.impl.AsyncObjectifyImpl.query(AsyncObjectifyImpl.java:354)
at com.googlecode.objectify.impl.ObjectifyImpl.query(ObjectifyImpl.java:207)
at com.beoui.geocell.ObjectifyGeocellQueryEngine.query(ObjectifyGeocellQueryEngine.java:52)
at com.beoui.geocell.GeocellManager.proximitySearch(GeocellManager.java:381)
How can I deploy to external servers like Tomcat, JBOSS or Jetty?
Or it isn't possible at all?
My opinion is: whether the application runs correctly on eclipse embedded jetty, in some way is possible to configure an external jetty distribution to run the application
GAE comes with a set of services which are basically big external systems hidden behind an API. Local dev server is just a Jetty with an embedded database and an API layer mimicking the production GAE. You can not use the dev server for production purposes - it was not made for this and has no concurrency and reliability features of production system.
If you want to run GAE code somewhere else then production GAE service, take a look at AppScale or CapeDwarf.
Also, most links that you provided deal with running GWT app on Tomcat/Jetty, but you have problems with AppEngine. GWT and AppEngine are two separate technologies (which can work together, but it's not required).

Resources