首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >spring java邮件问题

spring java邮件问题
EN

Stack Overflow用户
提问于 2018-10-24 01:28:41
回答 1查看 432关注 0票数 0

我在将我的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

在查看了用于从appengine发送邮件的google文档后,它们似乎没有配置任何邮件属性。我尝试将3 spring.mail.*保留为空,但我收到了相同的问题。

非常感谢您的帮助

EN

回答 1

Stack Overflow用户

发布于 2018-10-24 05:22:36

尝试将端口配置从

spring.mail.port=25

spring.mail.properties.mail.smtp.port=25
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52954728

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档