The spring boot app should send an email after the registration to the user.
When I test the registration with postman, I got this error message..
"message": "Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 1025;\n nested exception is:\n\tjavax.net.ssl.SSLHandshakeException: Remote host terminated the handshake. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 1025;\n nested exception is:\n\tjavax.net.ssl.SSLHandshakeException: Remote host terminated the handshake"
**
As mail server I use mailDev in a docker container. The container terminal logs these messages:
MailDev webapp running at http://0.0.0.0:80
MailDev SMTP Server running at 0.0.0.0:25
The Logs sound fine, but despite this I have no access to the web app of the mail-server (I use a MacBook). Is there maybe a fault at the mail server?
The app is running with this properties..
server:
error:
include-message: always
include-binding-errors: always
spring:
datasource:
password: password
url: jdbc:postgresql://localhost:5432/postgres
username: postgres
jpa:
hibernate:
ddl-auto: create-drop
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
show-sql: true
mail:
host: localhost
port: 1025
username: hello
password: hello
properties:
mail:
smtp:
auth: true
socketFactory:
class: javax.net.ssl.SSLSocketFactory
fallback: false
port: 1025
ssl:
enable: true
The project is public under my GitHub profile
https://github.com/farmerWhoCode/TrainingBooking
I find some hints here at stackoverflow, that point out wrong properties in my application.yml file. But nothing helps me to solve this problem.
Related
I am trying to send the mail from my spring boot application. The following are the smtp configurations I have added in application.yml
spring:
mail:
host: smtp.gmail.com
port: 587
username: ${username}
password: ${app-password}
properties:
mail:
transport:
protocol: smtp
smtp:
auth: true
starttls:
enable: true
But when I am trying to send the mail, I am getting the following exception
Mail server connection failed; nested exception is
javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate).
Failed messages: javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)"
Please help me with this. I have searched many blogs, my configurations seems to be fine. Let me know If I need to change or add something.
Thanks in advance!
This looks tls algorithm is part of your disabledAlgorithms list in jdk which is running in your system.
While link shared by Marc Stroebel might help you but if you want to set this programatically as well, then you can use below in your spring startup :
#SpringBootApplication
public class App {
public static void main(String[] args) {
java.security.Security.setProperty("jdk.tls.disabledAlgorithms", "");
..
..
}
}
This will allow all algorithms while app execution.
i try to connect a Eureka Server to a Eureka Client without success. All in a Container. Docker/Container Network is set to Host.
I tried hosting both on my Desktop: Works
I tried hosting both on my Raspberry pi: Works
But when i host the Server on my Raspberry Pi i can't connect the Service from my Desktop. I tried alot without success.
Sidenote: i can access Eureka Dashboard, and i have another Container running with a successful connection to a SQL database on my Desktop, i guess there shouldn't be a network problem.
Client
server:
port: 9001
spring:
application.name: USER-SERVICE
cloud:
inetutils:
preferred-networks:
- 192.168
eureka:
instance:
prefer-ip-address: true
hostname: 192.168.0.20
client:
fetch-registry: true
register-with-eureka: true
service-url:
defeaultZone: http://192.168.0.69:8761/eureka
Server
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://192.168.0.69:8761/eureka
instance:
hostname: 192.168.0.69
prefer-ip-address: true
192.168.0.20 is my desktop
192.168.0.69 is my raspberry pi
Is this even possible? I tried alot different Settings tho... And as i said both hosted local or on the raspberry works.
Thanks in advance
Error Message :
2021-08-15 00:40:24.177 INFO 16044 --- [ main] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
i was able to solve the probelem by adding ${eureka_url: } to the defaultZone. works perfect now.
eureka:
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: ${eureka_url:http://192.168.0.69:8761/eureka}
instance:
hostname: 192.168.0.69
prefer-ip-address: true
I am trying to send email using java Mail Api + Spring-boot Application.
The properties which are being used are :
mail:
host: smtp.gmail.com
port: 587
username: niranjan.numeroeins#gmail.com
password: msiyyyyyvzcbox # App password for less secure web app procured
protocol: smtp
tls: true
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.gmail.com
The above config works with my spring-boot+JavaMail Api nicely when i run jar directly using "java -jar myJar.jar". But once the application is deployed inside tomcat container it starts giving error as it would if you are trying to access Gmail server with less secure app like our web app code . Looks like some config issue on tomcat side(using tomcat-9)? Please help . Here is the log trace :
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is jav
ax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials j22sm1775206pjz.3 - gsmtp
Please note that you will get same error if you try sending the email with actual password and not App password https://support.google.com/accounts/answer/185833?hl=en
I am not able to open H2 console on the web browser.
My jhipster application is running on 8088 port. In server logs I am getting that H2 database is available on port 18088.
Tried below.
http://localhost:18088/h2-console
Getting Below response.
Below are the details in application-dev.yml.
devtools:
restart:
enabled: true
additional-exclude: .h2.server.properties
livereload:
enabled: false # we use Webpack dev server + BrowserSync for livereload
jackson:
serialization:
indent-output: true
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:h2:mem:jhipstersampleapplication;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: jhipsterSampleApplication
password:
hikari:
poolName: Hikari
auto-commit: false
h2:
console:
enabled: true
jpa:
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
database: H2
show-sql: true
properties:
hibernate.id.new_generator_mappings: true
hibernate.connection.provider_disables_autocommit: true
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: false
Please Help me out with this.
Adding slash solved my problem http://localhost:8080/h2-console to http://localhost:8080/h2-console/
There are 2 different ports:
HTTP port 8088 for h2 web console, it's served by your web app (same as your REST API)
TCP port 18088 that can be used by other applications using JDBC, it can't be used from a browser. This port is opened in DatabaseConfiguration.java in your project
Go to root of the app url (Access Url that you see in the application start)
then type "/h2-console" in the end.
localhost:8081/services//h2-console
Ensure you are accessing the correct port (8088 in your case), and that you do not change jhipster's setting for h2.console.enabled.
http://localhost:8088/h2-console should work.
I have my own smtp host. like, mail.xxx.com. and my application is host on Google Cloud Server. now when i send mail then it's give this type of error.
DEBUG SMTP:
useEhlo true, useAuth trueDEBUG SMTP: trying to connect to host "mail.xxx.com", port 587, isSSL falseorg.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException:
Could not connect to SMTP host: mail.xxx.com, port: 587;
nested exception is: java.net.ConnectException: Connection refused (Connection refused).
Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: mail.xxx.com, port: 587;
Mail Configuration Properties ::
mail.config.smtp.host=mail.xxx.com
mail.config.smtp.port=587
mail.config.smtp.username=noreply#xxx.com
mail.config.smtp.password=xxx
mail.config.smtp.auth=true
mail.config.smtp.starttls.enable=true
If anyone face this type of error and got the solution then please guide me.