Deploying scala and java springboot project on ubuntu server - java

My question is about deploying a project written in scala and java with springboot as backend. First I tried to build it with IDEA as .war file and put it under
my-tomcat-dir/webapps/
on my Ubuntu 18.04 server. When I run it with
sh my-tomcat-dir/bin/catalina.sh run
it just seems well, however it didn't respond to any request from my frontend application and there is no any errors log in my terminal screen. So I tried to build the project on my Ubuntu server. First I upload my project files to the server and run
sbt assembly
in the project directory, later I run
sbt package
and got a .war file. Again I put the file under
my-tomcat-dir/webapps/
and it just got the same result as before. How can I get this project built and run well under this situation? Any further information please inform me to provide, thanks!

Related

How to migrate Java project from Eclipse to VS Code?

I'm trying to migrate a Java project from Eclipse to VS Code, the project consist of a front and a backend, and both are supposed to run on a Wildfly Server at localhost. I want to have hot code reload when a .xhtml or .java file is modified, without having to manually compile a .war file and publish it to the server.
I'm using the Red Hat Server Connector plugin, but on the Wildfly server there is only and option for deploying a war file or a folder.
Is there a way to configure Maven to compile directly to wildfly\standalone\deployments? or some tutorial about how can I configure VS Code for Java.
Have you tried the Tomcat for Java extension?
You can have a look at this video, at the 8:13 you can see the Hot Code Replace button.

Deploy java web application to Tomcat with Visual Studio Code

I'm trying to deploy a java web application to Tomcat using Visual Studio Code and I'm having some issues that I'd like to share.
After installing the extension Tomcat for Java, I've tried to deploy a Maven Java Web project. To do so, I've clicked over project's folder and selected "Run on Tomcat Server" option. The result is an error with this message: The folder is not a valid web app to run on Tomcat Server.
Then, I've realized that maybe I should create a war file before running it on Tomcat. Therefore, I've executed mvn clean package command and afterwards execute "Run on Tomcat Server" option over the war file. Doing this the project has been deployed correctly.
However, compared to Eclipse's way to work with Tomcat, it seems to me a bit tedious. Particularly if I'm working with static files, like css or js, because every time I modify a file I should execute mvn clean package and "Run on Tomcat Server". Whereas, in Eclipse, these files are deployed automatically on Tomcat without restarting.
I wonder if there is another way to work with VS Code and Tomcat for Java.
Thanks!
If you use Spring, there is an easy way.
The Spring Initializr extension comes with an embedded Tomcat installation, and hot reloading works out of the box.
Rely on the following guide to install it:
https://code.visualstudio.com/docs/java/java-spring-boot

how can i deploy the jar file in remote server

In my local machine, i just running the java application in eclipse and working perfectly.
But in my staging machine, i have a spring boot application and running in the centos server, which i am accessing by putty
when i tried running the command
> mvn clean package -DskipTests
after the above step, what the next step, i need to do
Actually i did was,
nohup java -jar target/cs.jar &
so that, jar was created in the target folder. Then when i tried to hit the endpoint from the postman its not working
As you said there might be some internet issue on the Staging Server. Maven may try to get dependencies from internet, but since it is not able to get to internet it is hanging.
Can you try to use following command on your linux server
$wget http://www.google.com
if it works correctly then you know that internet is there on that machine. Your maven should work then .
If not then, I would suggest build the whole thing on your local and transfer the build files to the server. In the server you can just execute
$ java -jar target/myproject-0.0.1-SNAPSHOT.jar
I am assuming that you can package the whole application in a jar file.
To move the jar file from windows machine to server machine you can use winscp tool.

How to deploy Java project to Tomcat

I have downloaded a sample extjs+mysql+spring web project (link) with a java backend that I'd like to set up locally on my machine. I have installed Tomcat server, and MySQL DB but it's my first time ever with a java-based web application and I have troubles setting it up. Does it require any modifications ? I thought that .jsp files should be included there, but I can only see .java sources. Do I need to build it before it's ready for deployment ? Any help appreciated.
This is an Eclipse project so you'd need to run it from within Eclipse.
Download Eclipse
Open the project in it
Define a Tomcat container in your Servers tab
Drag and drop the project onto the newly defined Tomcat
Run it
if your are using eclipse IDE for development, create a project in eclipse,
run as "run on server" , and set the running server (eg TOMCAT 7).
and thats it,,
make sure, you correctly setup spring project in IDE with all needed jar files .

build not working in linux with netbeans project

I have written a java web application(deployed on glassfish server) to deploy on to Tomcat server. I copied the project file along with build.xml to a linux system and tried
[packwolf src]$ ant
Buildfile: build.xml
BUILD FAILED
/home/packwolf/Application/src/build.xml:12: The following error occurred while executing this line:
/home/packwolf/Application/src/nbproject/build-impl.xml:22: Class org.apache.tools.ant.taskdefs.condition.Not doesn't support the nested "antversion" element.
The web application is supposed to be portable, but it isn't. Any ideas to fix this?
You need to check your ant version. It might not be the same as on your other box.

Categories