Deploying spring boot executable jar on jboss but not as a war ,so that other applications can invoke as an api - spring-boot

I want to deploy an executable jar file on to jboss server, so that other application written in c/c++ can invoke it through workflow by passing the arguments to the executable jar file.
I have googled and found examples where war is deployed by making it restful webservice, but I could not find any such example where an executable jar file is deployed on jboss.
Appreciate your help
Regards,
Kiran Kumar

You can not deploy the spring boot executable jar file in Jboss. You need tweak your application to some extent for it to work on JBoss.
1. Add jboss-web.xml file src/main/webapp/WEB-INF folder, provide application context there.
<jboss-web>
<context-root>YOUR_APP_ROOT</context-root>
</jboss-web>
Set below spring property in your yml/props file.
server.servlet-path = /*

Related

Start spring boot jar file as part of tomcat start

There is a way I can start the spring boot jar file as part of tomcat start(catalina.bat start).
I have a spring cloud api gateway which does not support war file deployment.
In a bare metal box, I have installed the tomcat, and as part of deployment I have converted all microservice into war file and able to deploy it into tomcat/webapp folder and up and running.
As spring cloud api gateway does not support war file, I kept this application with embed tomcat.
Now I need this jar file as well get started along with the tomcat [catalina.bat start].
In tomcat I have seen there is something shared.loader option in catalina.properties file.
I have kept the jar file in below path as shown below and when I try to start it, jar file is not getting picked up.
Need to know if there is a way to start the spring boot application [jar file] as part of tomcat [catalina.bat start] start.

Use of spring-boot-maven-plugin

While creating a spring boot project I define property in pom.xml as <packaging>war</packaging> with which I can create a war and thereafter deploy the war into server maybe tomcat or WAS.
But I came across a plugin named spring-boot-maven-plugin whose documentation states that it's use is to package executable jar or war archives and run an application in-place.
My query is why do we need this at all ?
If my packaging can tell me what to create and then can deploy it to run, what is the used of this plugin.
I am trying to understand a new project so wanted to be sure that every line makes sense
The maven plugin will create an "executable" archive. In the case of the war packaging, you would be able to execute your app with java -jar my-app.war. If you intend to deploy your Spring Boot application in an existing Servlet container, then this plugin is, indeed, not necessary.
The maven plugin does more things like running your app from the shell or creating build information.
Check the documentation
The Spring Boot Maven Plugin provides Spring Boot support in Apache Maven, letting you package executable jar or war archives and run an application “in-place”.
Refer this - https://www.javaguides.net/2019/02/use-of-spring-boot-maven-plugin-with.html

Spring Boot - will the executable jar be exploded in after deployment?

From the documentation of Spring Boot, I can see the directory of the executable jar will be the working directory when you start the Spring Boot application. I would like to understand, whether there are configurations/flags to explode/unpack the jar on deployment, so that I can find access the contents of the executable jar in the file system ?
There are not flags to explode the jar automatically but you can extract it yourself using the jar command. This reference may be helpful http://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html in understanding the structure and what you can do.

Is it possible with Spring Boot to serve up JSPs with a stand alone JAR packaging

I try to build Spring Boot with JSP to jar packaging. I build project and it works fine when I run it with this commands
$ mvn package
$ java -jar target/mymodule-0.0.1-SNAPSHOT.jar
but when I go to target directory ($cd target) and try
$java -jar mymodule-0.0.1-SNAPSHOT.jar
the application runs fine but when I open browser and try to open the page I get error "There was an unexpected error (type=Not Found, status=404).
/WEB-INF/jsp/index.jsp"
I found this question, but when I try it I met the same problem
Is it possible with Spring Boot to serve up JSPs with a JAR packaging
My questions is Why it works when I try
$ java -jar target/mymodule-0.0.1-SNAPSHOT.jar
and doesn't work when I try
$cd target
$java -jar mymodule-0.0.1-SNAPSHOT.jar
How can I solve it?
EDIT
There is not WEB-INF directory into jar or target directory and when I put it there it doesn't help
If you are using embedded Tomcat, Spring Boot doesn't support using JSPs in an executable jar:
With Tomcat it should work if you use war packaging, i.e. an executable war will work, and will also be deployable to a standard container (not limited to, but including Tomcat). An executable jar will not work because of a hard coded file pattern in Tomcat.
It works when you try java -jar target/mymodule-0.0.1-SNAPSHOT.jar because the JSPs are available on the filesystem from src/main/webapp which Spring Boot configures as a document root for convenience during development. When you move into the target directory, the src/main/webapp folder is no longer available so the JSPs stop working.

How do I deploy ejb jar in TomEE

M exploring openejb 4 beta with TomEE, could anyone explain how I deploy ejb jar on TomEE? I'm using it for testing purposes. Also, is it possible to configure tomee in eclipse and debug through ejbs??
Thanks in advance.
There are several scenarios for using EJB through the TOMEE(included OpenEJB), if you have an EAR file (consists of JARs and WAR) for deployment you need first active the APP folder in installed(means copied) TOMEE folder then you just drop your EAR file into APP folder and TOMEE unpack it and will be deployed properly.

Resources