IllegalStateException: Could not load specified mime type mapping file [org/springframework/mail/javamail/mime.types]

IllegalStateException: Could not load specified mime type mapping file [org/springframework/mail/javamail/mime.types]



I am using Springframework's JavaMailSenderImpl class to send email from my Java program and it works fine in my local but in the production environment I am getting below exception intermittently


java.io.FileNotFoundException: class path resource
[org/springframework/mail/javamail/mime.types]
cannot be opened because it does not exist



I researched and checked the stack trace and found out this exception is being thrown from org.springframework.mail.javamail.ConfigurableMimeFileTypeMap class's createFileTypeMap method : Source Code of ConfigurableMimeFileTypeMap


org.springframework.mail.javamail.ConfigurableMimeFileTypeMap



Stack Trace :


java.lang.IllegalStateException: Could not load specified MIME type mapping file: class path resource [org/springframework/mail/javamail/mime.types]
at org.springframework.mail.javamail.ConfigurableMimeFileTypeMap.getFileTypeMap(ConfigurableMimeFileTypeMap.java:122) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.mail.javamail.ConfigurableMimeFileTypeMap.afterPropertiesSet(ConfigurableMimeFileTypeMap.java:106) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.mail.javamail.MimeMessageHelper.getDefaultFileTypeMap(MimeMessageHelper.java:455) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.mail.javamail.MimeMessageHelper.<init>(MimeMessageHelper.java:292) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.mail.javamail.MimeMessageHelper.<init>(MimeMessageHelper.java:247) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.mail.javamail.MimeMessageHelper.<init>(MimeMessageHelper.java:226) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_91]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_91]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_91]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/mail/javamail/mime.types] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) ~[spring-core-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.mail.javamail.ConfigurableMimeFileTypeMap.createFileTypeMap(ConfigurableMimeFileTypeMap.java:145) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.mail.javamail.ConfigurableMimeFileTypeMap.getFileTypeMap(ConfigurableMimeFileTypeMap.java:119) ~[spring-context-support-4.0.9.RELEASE.jar:4.0.9.RELEASE]
... 20 common frames omitted
2018-09-07T10:00:20.463+0000 INFO : logg



Can someone please help me how to resolve this issue or just point me to the right direction to proceed.






Do you have 'spring-context-support' dependency in your maven/gradle file

– Yogi
Sep 11 '18 at 7:45






@yogi Yes it's present, could you please tell me the role of this dependency with this problem.

– Neeraj Jain
Sep 11 '18 at 9:55






Class which you have mentioned is present in spring-context-support jar.So you need dependency to add this jar into runtime libs.

– Yogi
Sep 13 '18 at 7:37





0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ