DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Microsoft Azure Service Fabric
  • Keep Your Application Secrets Secret
  • Android Cloud Apps with Azure
  • Creating Application using Spring Roo and Deploying on Google App Engine

Trending

  • Breaking Down Silos: The Importance of Collaboration in Solution Architecture
  • Understanding Europe's Cyber Resilience Act and What It Means for You
  • How TIBCO Is Evolving Its Platform To Embrace Developers and Simplify Cloud Integration
  • Auditing Spring Boot Using JPA, Hibernate, and Spring Data JPA
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Moving Camel Application Between OSGi and JavaEE Containers in Fuse

Moving Camel Application Between OSGi and JavaEE Containers in Fuse

Here's a method for moving applications from OSGi to JavaEE containers and vice versa.

Christina Lin user avatar by
Christina Lin
CORE ·
Jan. 02, 16 · Tutorial
Like (9)
Save
Tweet
Share
6.93K Views

Join the DZone community and get the full member experience.

Join For Free

Now that JBoss Fuse supports both OSGi Karaf and JavaEE JBoss EAP container. When should you use each? Is there any best practice for which container to use? It depends .... Situations vary between cases. Here are my point of view, you many like it or disagree, but I am happy to hear more of your thoughts.

I think it is BEST if you stick with Karaf containers if possible, for now. It is more lightweight, which means you can deploy applications much quicker and scale faster horizontally with applications distributed everywhere. OSGi manages the lifecycle of the services and allows you to dynamically deploy and undeploy services without affecting the others services in the same container. That is very important in for mission critical services. So if you can choose, go with Karaf.

I also think that an enterprise should not be restricted to using a single kind of container. Different container frameworks exist for a reason. Especially if you are providing a web application with EJB, JARs, and complex application glue to serve as the core business for the web application. Maybe it's a legacy application that has everything done in the Application server. Or it simply has too many non-OSGi compatible libraries to work with. Then I would go for the JBoss EAP scenario.

So how do you move from OSGi to JavaEE containers or vice versa? Moving a bundle from OSGi to JavaEE is dead simple. But please note, use the Spring framework instead of Blueprint if you are using OSGi, I would first convert it to Spring then work with it.

In this case, I will be using a WAR application, since most people use this format in JavaEE and it is supported in Karaf as well.

So there are few ground rules if you want to switch back and forth between the containers:

  • Use Spring Framework
  • Make sure your Camel route is placed under META-INF under webapp and named *-camel-context.xml

  • Set your plugins to generate the metadata needed for OSGi containers.
    • Add maven-bundle-plugin        
       <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.7</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <supportedProjectTypes>
            <supportedProjectType>jar</supportedProjectType>
            <supportedProjectType>bundle</supportedProjectType>
            <supportedProjectType>war</supportedProjectType>
          </supportedProjectTypes>
          <instructions>
            <Bundle-SymbolicName>camel-blueprint</Bundle-SymbolicName>
            <Private-Package>com.redhat.springtest</Private-Package>
            <Import-Package>*</Import-Package>
          </instructions>
        </configuration>
       </plugin>

By sticking with these rules, it will allow you to create a project that can deploy on both containers.

In the JBoss Fuse Karaf Container,

  • Install with Profile or using an OSGi command
    • war:mvn:com.redhat/springtest/1.0.0-SNAPSHOT/war?Web-ContextPath=springtest
  • Make sure to have feature-fabric-web profile in your container


Running JBoss EAP Container with Fuse application.

  • Deploy and install by
    • Drag and dropping the WAR file under the deployment folder
    • Using Console/CLI deployment
  • Make sure the Fuse subsystem is installed and activated. 
  • Remember to disable ContextLoaderListener in web.xml

Here is a video showing how to move an application between containers.

application Container Spring Framework

Published at DZone with permission of Christina Lin, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Microsoft Azure Service Fabric
  • Keep Your Application Secrets Secret
  • Android Cloud Apps with Azure
  • Creating Application using Spring Roo and Deploying on Google App Engine

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: