I'm new to quarkus and what I'm trying to do is I've two JAX-RS application codebase .
I want to package code of both the app as single distribution package.
I want to package it as quarkus app.
To be more clear below is an example for the same .
App1 :(Can be Quarkus app or just JAX-RS war )
Contains Resources-> /rest/greetings
App2 :(Can be Quarkus app or just JAX-RS war )
Contains Resources-> /rest/hello
App3 :(Quarkus app which will be distributed)
Contains Resources-> /rest/greetings
/rest/hello
Uses App1 and App2 as jar or war dependancy
Basically I want to maintain separate codebase for two apps(you can say modules) and third app which is for packaging and distribution.
Idea behind this is to build app with configurable module like in future if I have 5 modules and I just want to build and deliver app with 3 module I can do it .
I'm using gradle as build tool.
Found a solution that worked for me,
Added org.jboss.jandex plugin to my App1 and App2 so it generated jandex index and added both the app as dependency to my App3 so quarkus was able to load these annotated classes on start-up.
Doc for more info here
Related
Since App Engine reached the end of life last August on the 30th, it's not possible anymore to deploy updates to the same application using the appengine (appcfg) command line.
I was using the appengine maven plugin which in turn was using appcfg to deploy my application.
I'm looking on how to migrate my application to Google Cloud SDK now but between the limitations I saw that Google Cloud SDK does not support EAR applications to be deployed.
Surprize surprize my applications does have an EAR structure.
Is there a workaround for this or should I completely change the structure of my application?
You don't have to change your application structure at all. It's only the deployment that it slightly altered.
Before, you used to create war artifacts and package them into a deployable ear.
Now you keep creating the same war artifacts but you must not package them into an ear. Instead, you deploy them all together using the gcloud command:
gcloud app deploy ./path_module1/WEB-INF/appengine-web.xml ./path_module2/WEB-INF/appengine-web.xml
path_moduleX are paths to the exploded artifacts (not path to your source code, of course)
as explained here https://cloud.google.com/appengine/docs/standard/java/configuration-files
I'm struggling to learn how I go about building, packaging, and deploying a Spring REST API locally so that I can interact with it? Ideally, I'd just like to GET and POST data as practice -- specifically integrating with DynamoDB.
I've cloned this DynamoDB project and built it using mvn package so that I have a jar file. I moved the jar file to the webapp directory of Apache and started the server, but I cannot interact with the API in any way. The project is structured as follows:
Once Apache is running with the jar in the webapp directory, I've tried accessing the API at:
http://localhost:8080/
http://localhost:8080/springbootapp (from server.contextPath=/springbootapp in application.properties)
Each gives a 404 error. And yes, DynamoDB is running locally. So what do I need to do differently? How can I deploy and access this API locally?
The project you have cloned is a spring boot project, hence you can use mvn spring-boot:run to run the application locally.You can also run it by running the com.baeldung.Application class as a java application from the IDE. For more details on how to run a spring boot app you can follow this link. Spring boot parent has a dependency on the embedded tomcat, which will run the application.
Additionally if you want to deploy the application as a war the spring boot documentation shows how to do it.
I've been using IntelliJ successfully for quite a while to develop App Engine projects that contain a single service (formerly 'module'), but am having difficulty setting up a project up that contains more than one service (a default front-end service plus one or more backend services).
I understand the multi-module EAR deployment folder structure, which is different from the single WAR structure, but I have not been able to figure out how to successfully launch the development server with this configuration to debug before I deploy.
Any help would be greatly appreciated.
My application is structured as a multi module Gradle project. I have a top level Gradle Build file and
three subprojects. One project contains the EAR project, and two projects are Goolge App Engine War projects.
I would propose that you start with trying to setup such a project. You will find a good example with a corresponding
project structure at Googles Github
https://github.com/GoogleCloudPlatform/appengine-modules-sample-java
You will deploy the ear to your locale dev server by running the ear gradle task appengineRun
You need to add the following entry to your ear gradle build file (keep the other entries)
appengine {
jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000']
}
Next step is to configure a Remote Debug configuration similar to this
https://stackoverflow.com/a/18692212/2062634
After you started your application you have to start your remote debug configuration which will attach the debugger.
I have an application which I am deploying on GlassFish. It has an EJB-tier with (JPA) Entites and EJBs to get access and write to the database and it has 3 (independent) web apps. Everything is built with Maven.
ServerApplication
|
+-ServerApplication-ear
+-ServerApplication-ejb
|
+-GrumpyCat (war)
+-HummingBird (war)
+-Koala (war)
All three war projects depend on the ejb project. When compiling/building the ear, it copies the war files to the ear project and then I can deploy the ear file on GlassFish.
This works fine, all 4 modules (the ejb, and the 3 war) get deployed without problems and I can access the 3 war projects like:
myServer.com/GrumpyCat
myServer.com/HummingBird
myServer.com/Koala
My problem is, that I can't deploy a single war project on its own. For example when I change something in the koala project, I would like to be able to build only the koala.war and deploy it on the server, without having to upload and deploy the complete ear file.
But when deploying, GlassFish tells me either :
there is already a project deployed on Koala (true, it was deployed together with the ear)
or (when I change the build-version) it doesn't "know" the ejbs and I get a number of ClassNotFound Exceptions.
Is there a way to deploy the modules of the application one by one?
Your second approach is the way to go if you really want to deploy them individually. However, you are seeing a ClassNotFound exception because the WARs are individual projects and as such don't have access to the EAR's class path.
To make that work, you have to add the public API of your application to your WAR's classpath. The public API consists of at least the EJB's remote interfaces of the EJBS that you would like to access from the WAR and any DTOs used in your API.
The easiest way is to create a separate package (such as com.example.api) and let a build tools such as ant or Maven bundle that api package together with your EJBs and your WARs, or you create a myapp-api.jar and include it in the respective class-paths.
Then you can remove the WARs from the EAR and deploy them as separate projects.
i'm setting up a new multi module project structure. for now there is an ejb and an ear module and i want to add a web module for a RESTful web service. what is the best approach?
the application looks like this (modules and their content):
app (pom): the parent pom
core (ejb): ejb, hibernate, DAOs, entities, business logic
ear (ear): the module that creates a deployable container
now i would like to add a restful webservice module.
looking at the jboss-as-7 quickstart applications from http://www.jboss.org/jbossas/downloads there is always a war module which just bootstraps the rest service while the beans with jax-rs annotations are part of the ejb project (in my case core:
app
ejb (containing services + beans with jax-rs annotations)
ear
war (just containing a web.xml)
my issue with this approach is that the ejb module contains the services and the rest resources. wouldn't it be better to keep them separate? or is this the way to go?
otherwise: which approach would be better?
app
core
ear
rest (war which contains the rest resource beans and the web.xml)
or
app
core
ear
rest
rest-resources (separate container for the rest resource beans)
rest-war (war which only contains the web.xml)
From a JEE6/JAX-RS point of view the only thing you need a WAR file for is to actually have something to hand off to the application server to deploy. It can literally contain no resources (except for the ones required to make it a valid archive) and your application will still work as long as your classes are made available somewhere on the classpath. So, its really up to you to bundle up these classes as you see fit.
The one thing you will need is a class that extends javax.ws.rs.core.Application. This class is used as a marker/bootstrap to indicate to the application server that there are REST resources available in the web archive that need to be loaded. In most shops I've seen this class placed in the WAR project itself.
If you are really looking for organizational tips, I would recommend you start off by grouping all the REST resource classes together in their own project. Add as dependencies, any projects that are required for the resource classes to work (for example your core and ear projects). Add all three (rest, ear, core) as dependencies for your war project.
Then refine the model as needed, as you work your way through implementation.
There is a really awesome JBoss Maven Archetype for this sort of project.
1) Go to eclipse with maven integration installed
2) New -> Project -> Maven Project
3) Click Next
4) In Filter type in ee6
5) Out of the options that appear, use Group ID: "org.jboss.spec.archetypes", and Artifact ID: "jboss-javaee6-webapp-archetype"
6) Out will come a beautifully structured web application project with EAR connecting to a EJB project and a WAR project.