springboot
Failed to bind properties under 'spring.data.mongodb.password' to char[]:
Reason: java.lang.IllegalStateException: either 'jasypt.encryptor.password', one of ['jasypt.encryptor.private-key-string', 'jasypt.encryptor.private-key-location'] for asymmetric encryption, or one of ['jasypt.encryptor.gcm-secret-key-string', 'jasypt.encryptor.gcm-secret-key-location', 'jasypt.encryptor.gcm-secret-key-password'] for AES/GCM encryption must be provided for Password-based or Asymmetric encryption
this issue resolved only after
manullay giving pass to application.proprties
Action:
The systemd service setup is very simple as well. Firstly, we create a script named your-app.service using the following example and put it in /etc/systemd/system directory:
[Unit]
Description=A Spring Boot application
After=syslog.target
[Service]
User=root
ExecStart=/path/to/your-app.jar SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
Remember to modify Description, User and ExecStart fields to match your application. You should be able to execute the aforementioned standard service commands at this point as well.
As opposed to the System V init approach described in the previous section, the process ID file and console log file should be configured explicitly using appropriate fields in the service script. An exhaustive list of options may be found here.
vi /etc/systemd/system/springbootapp.service
[Unit]
Description=A Spring Boot application
After=syslog.target
[Service]
User=root
ExecStart=/usr/bin/java -jar /home/vms.krishit/web/vms.krishit.com/public_html/VMSApplication/VMS/target/VMS-0.0.1-SNAPSHOT.jar SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
systemctl start springbootapp.service
systemctl status springbootapp.service
systemctl enable springbootapp.service
Created symlink /etc/systemd/system/multi-user.target.wants/springbootapp.service → /etc/systemd/system/springbootapp.service.
root@server2:/home/vms.krishit/web/vms.krishit.com/public_html/VMSApplication/VMS/target# systemctl status springbootapp.service
Failed to execute command: Exec format error
add shebang to the script
#!/bin/bash
or
Your spring-start.sh is executed by bash you need to explicit your ExecStart in springboot.service file like this : ExecStart=/bin/bash /home/ubuntu/spring-start.sh
Build jar and run spring boot from cmd
- In
pom.xml
add tag <packaging>jar</packaging>
. - you can
build
the maven project
using command mvn package
or maven install
. It will create the .jar
file inside target
folder. - run command from location where
.jar
is present - java -jar jarName.jar
Now you can access your system
----------------------
on 17 oct 2022
getting 404 after uploading some files in
/home/vms.krishit/web/vms.krishit.com/public_html/VMSApplication/VMS/src/main/java/com/example/VMS_App/vmsController
had ro rebuild jar file specfied in springbootapp.service
/usr/bin/java -jar /home/vms.krishit/web/vms.krishit.com/public_html/VMSApplication/VMS/target/VMS-0.0.1-SNAPSHOT.jar SuccessExitStatus=143
SockJsClient is disconnected
enable spring boot error log
/usr/bin/java -jar /home/vms.krishit/web/vms.krishit.com/public_html/VMSApplication/VMS/target/VMS-0.0.1-SNAPSHOT.jar > /var/log/springboot/error.log 2>&1
2022-12-08 15:17:35.388 ERROR 2101 --- [io-8080-exec-10] o.s.w.s.s.s.DefaultHandshakeHandler : "Handshake failed due to invalid Upgrade header: null"
I finally managed to find the error. The order of statements in the apache.conf
does matter! The working conf file looks like so:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName app.myapp.biz
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://127.0.0.1:8096/
ProxyPassReverse / http://127.0.0.1:8096/
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:8096/$1" [P,L]
SetEnv mongo_username aUser
SetEnv mongo_password aPassword
</VirtualHost>
Comments
Post a Comment