Maven can be nice, but sometimes you can end up with one jar loading before another and that causes unpredictable results at run-time.

An example exception:

Exception in thread "Thread-24" java.lang.NoSuchMethodError: 
	at  com.sun.mail.smtp.SMTPTransport.openServer(
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(
	at javax.mail.Service.connect(
	at javax.mail.Service.connect(

How to find the offending jar file:

     Class cls = SocketFetcher.class;
     ProtectionDomain pDomain = cls.getProtectionDomain();
     CodeSource cSource = pDomain.getCodeSource();
     URL loc = cSource.getLocation();

How to fix it:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s