Closed sunmingtao closed 3 years ago
The exception is thrown on the line "new MimeMessage(session)" (at Email.java 1901)
javax.activation.DataSource is on the classpath
[msun@hammer dl-indexer-service]$ jar tf /apps/dl-indexer-service/ROOT/WEB-INF/lib/activation-1.1.jar | grep javax/activation/DataSource.class
javax/activation/DataSource.class
I have put the following code to locate the jar from which the classes are loaded.
CodeSource src = MimeMessage.class.getProtectionDomain().getCodeSource();
if (src != null){
URL jar = src.getLocation();
System.out.println("MimeMessage class locates at " + jar.toString());
}
src = DataSource.class.getProtectionDomain().getCodeSource();
if (src != null)
URL jar = src.getLocation();
System.out.println("DataSource class locates at " + jar.toString());
}
Surprisingly, the MimeMessage class is loaded from the jar in jetty container rather than the application lib folder (WEB-INF/lib)
10:50:00.044 java[3176]: MimeMessage class locates at *file:/var/cache/jvmctl/container/jetty-9.4.21.v20190926/lib/mail/javax.mail.glassfish-1.4.1.v201005082020.jar*
10:50:00.044 java[3176]: DataSource class locates at *file:/apps/dl-indexer-service/ROOT/WEB-INF/lib/activation-1.1.jar*
The jar containing MimeMessage is on the classpath as well (A maven dependency)
[msun@hammer dl-indexer-service]$ find /apps/dl-indexer-service/ROOT/WEB-INF/lib/ -name "javax.mail*jar"
/apps/dl-indexer-service/ROOT/WEB-INF/lib/javax.mail-api-1.6.2.jar
[msun@hammer dl-indexer-service]$ jar tf /apps/dl-indexer-service/ROOT/WEB-INF/lib/javax.mail-api-1.6.2.jar | grep MimeMessage.class
javax/mail/internet/MimeMessage.class
These observations bring a lot of questions.
Here is the answer to all the questions and it provides a neat solution as well.
https://github.com/eclipse/jetty.docker/issues/10
Jetty libraries do take precedence over the jar on class path, which is super counter-intuitive.
DLC Indexer fails to send error email notification in Dev/UAT, potentially Prod.
However, it works locally
See below log: