весенний выпуск почты java - PullRequest
0 голосов
/ 23 октября 2018

У меня проблема с развертыванием приложения Springboot в Google Appengine.Я использую org.springframework.mail.javamail.JavaMailSender для отключения электронной почты, однако при запуске возникает ошибка:

[INFO] GCLOUD: openjdk version "1.8.0_181"
[INFO] GCLOUD: OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1~deb9u1-b13)
[INFO] GCLOUD: OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
[INFO] GCLOUD: 
[INFO] GCLOUD: I1023 12:32:46.939707    36 jni_logger.cc:31] Initializing ClassPathLookup, default classpath: true, extra classpath: []
[INFO] GCLOUD: I1023 12:32:46.997542    36 jni_logger.cc:31] Total size of indexed resources database: 2342 bytes
[INFO] GCLOUD: I1023 12:32:47.006989    36 jvm_internals.cc:130] ClassPathLookup constructor time: 78541 microseconds
[INFO] GCLOUD: I1023 12:32:47.023756    36 yaml_data_visibility_config_reader.cc:37] debugger-blacklist.yaml was not found.  Using default settings.
[INFO] GCLOUD: I1023 12:32:48.841431    36 jni_logger.cc:31] Debuggee gcp:214870199000:397810ae113a433c registered: {"debuggee":{"id":"gcp:214870199000:397810ae113a433c","project":"214870199000","uniquifier":"DA39A3EE5E6B4B0D3255BFEF95601890AFD80709","description":"test1-bulk-disbursement-processor-20181023t140959-413470553712603031","agentVersion":"google.com/java-gcp/@2","labels":{"module":"bulk-disbursement-processor","minorversion":"413470553712603031","version":"20181023t140959"}}}, agent version: 2.19
[INFO] GCLOUD: I1023 12:32:48.845562    36 jvmti_agent.cc:435] Attaching Java debuglet
[INFO] GCLOUD: I1023 12:32:48.894860    36 rate_limit.cc:143] CPU count: 1
[INFO] GCLOUD: I1023 12:32:48.907263    36 debugger.cc:105] Initializing Java debuglet
[INFO] GCLOUD: I1023 12:32:48.927527    36 debugger.cc:114] Debugger::Initialize initialization time: 20 ms
[INFO] GCLOUD: 
[INFO] GCLOUD:   .   ____          _            __ _ _
[INFO] GCLOUD:  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
[INFO] GCLOUD: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
[INFO] GCLOUD:  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
[INFO] GCLOUD:   '  |____| .__|_| |_|_| |_\__, | / / / /
[INFO] GCLOUD:  =========|_|==============|___/=/_/_/_/
[INFO] GCLOUD:  :: Spring Boot ::        (v2.0.6.RELEASE)
[INFO] GCLOUD: 
[INFO] GCLOUD: 2018-10-23 12:32:50.805  INFO 1 --- [           main] c.c.b.BulkDisbursementApplication        : Starting BulkDisbursementApplication on fa244bd33453 with PID 1 (/app.jar started by root in /)
[INFO] GCLOUD: 2018-10-23 12:32:50.821  INFO 1 --- [           main] c.c.b.BulkDisbursementApplication        : No active profile set, falling back to default profiles: default
[INFO] GCLOUD: 2018-10-23 12:32:51.064  INFO 1 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@617c74e5: startup date [Tue Oct 23 12:32:51 UTC 2018]; root of context hierarchy
[INFO] GCLOUD: 2018-10-23 12:32:53.747  INFO 1 --- [           main] o.s.i.config.IntegrationRegistrar        : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
[INFO] GCLOUD: 2018-10-23 12:32:56.701  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
[INFO] GCLOUD: 2018-10-23 12:32:56.756  INFO 1 --- [           main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
[INFO] GCLOUD: 2018-10-23 12:32:57.548  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b2ca70a8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[INFO] GCLOUD: 2018-10-23 12:32:57.893  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration$$EnhancerBySpringCGLIB$$1dbc2bd7] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[INFO] GCLOUD: 2018-10-23 12:32:58.191  WARN 1 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'emailService': Unsatisfied dependency expressed through field 'postman'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.mail.javamail.JavaMailSender' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
[INFO] GCLOUD: 2018-10-23 12:32:58.217  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 
[INFO] GCLOUD: 
[INFO] GCLOUD: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[INFO] GCLOUD: 2018-10-23 12:32:58.923 ERROR 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
[INFO] GCLOUD: 
[INFO] GCLOUD: ***************************
[INFO] GCLOUD: APPLICATION FAILED TO START
[INFO] GCLOUD: ***************************
[INFO] GCLOUD: 
[INFO] GCLOUD: Description:
[INFO] GCLOUD: 
[INFO] GCLOUD: Field postman in com.notification.EmailService required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found.
[INFO] GCLOUD: 
[INFO] GCLOUD: The injection point has the following annotations:
[INFO] GCLOUD:  - @org.springframework.beans.factory.annotation.Autowired(required=true)
[INFO] GCLOUD: 
[INFO] GCLOUD: 
[INFO] GCLOUD: Action:
[INFO] GCLOUD: 
[INFO] GCLOUD: Consider defining a bean of type 'org.springframework.mail.javamail.JavaMailSender' in your configuration.
[INFO] GCLOUD: 
[INFO] GCLOUD: I1023 12:32:58.954308    25 jvmti_agent.cc:225] Java VM termination
[INFO] GCLOUD: I1023 12:32:59.045907    36 jvmti_agent_thread.cc:103] Agent thread exited: CloudDebugger_main_worker_thread
[INFO] GCLOUD: I1023 12:32:59.074007    25 worker.cc:116] Debugger threads terminated
[INFO] GCLOUD: I1023 12:32:59.074228    25 jvmti_agent.cc:239] JvmtiAgent::JvmtiOnVMDeath cleanup time: 119847 microseconds
[INFO] GCLOUD: 

У меня есть spring.mail.* набор свойств:

spring.mail.host=localhost
spring.mail.port=25
spring.mail.protocol=smtp
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=3000
spring.mail.properties.mail.smtp.writetimeout=5000
logging.level.org.springframework.mail=debug

Посмотрев документы Google для отправки писем из appengine, они, похоже, не настроили никаких свойств почты.Я попытался оставить 3 spring.mail. * Пустыми, но я получаю ту же проблему.

Любая помощь, высоко ценится

1 Ответ

0 голосов
/ 24 октября 2018

Попробуйте изменить настройки порта с

spring.mail.port=25

на

spring.mail.properties.mail.smtp.port=25
...