mhilbush
(Mark)
January 6, 2019, 1:38am
1
I got this really strange error when calling the sendMail action with an attachment. I’ve see my fair share of rule errors before, but this one is a real beauty.
2019-01-05 20:21:47.282 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule
'TestRuleOn': loader constraint violation: when resolving method
"javax.mail.BodyPart.setDataHandler(Ljavax/activation/DataHandler;)V" the class
loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) of the
current class, org/apache/commons/mail/MultiPartEmail, and the class
loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) for
the method's defining class, javax/mail/Part, have different Class objects for the
type javax/activation/DataHandler used in the signature
The statement looks like this, and has worked for a really, really long time.
sendMail("my@email.address", "Email subject", "Email body", "file:///path/to/image.jpg")
or
sendMail("my@email.address", "Email subject", "Email body", "http://my.host/path/to/image.jpg")
I’m on build 1484. Does anyone have any idea what would cause this?
Note: It works file when not attaching anything, for example
sendMail("my@email.address", "Email subject", "Email body")
1 Like
namraccr
(namraccr)
January 6, 2019, 1:44am
2
Possibly related, this thread says that the javax.activation package is deprecated and many of its methods are disabled by default in Java 9.
Are you, mayhap, using Java 9?
mhilbush
(Mark)
January 6, 2019, 1:46am
3
I’m on Java 8, and that has not changed in a long time.
yfaway
(YF)
January 6, 2019, 2:20am
4
Could it be a classpath issue, overlapping jars? I send mail with attachments in Jython (OH 2.4 final), and it works fine.
mhilbush
(Mark)
January 6, 2019, 2:24am
5
I dunno. Nothing has changed in my setup other than running a recent snapshot. I tried it on another system running build 1484 and I’m getting the same error.
Googling around, I found this, which suggests it’s a dependency issue.
yfaway
(YF)
January 6, 2019, 2:33am
6
Sounds like a snapshot bug then. I suppose you would only know for sure if it works again when you roll back to an older build.
mhilbush
(Mark)
January 6, 2019, 2:36am
7
Yeah, possibly, although it’s unclear what would’ve changed to cause this.
I’m gonna roll back to 1458 (which is a 2.4.0 build) to see what happens.
mhilbush
(Mark)
January 6, 2019, 2:43am
8
Yep, it works fine on 1458, so it appears to be a snapshot bug.
Thanks.
1 Like
mhilbush
(Mark)
January 6, 2019, 12:31pm
9
@vzorglub This really isn’t solved, since the issue remains in recent snapshot releases. Reverting to an old version is just a workaround.
vzorglub
(Vincent Regaud)
January 6, 2019, 12:36pm
10
Yes sorry, I read the Snapshot versions the wrong way around…
yves
(YvesHanoulle)
January 7, 2019, 7:26pm
11
I noticed this today too.
The older version gave other problems for me (which I don’t remember anymore)
Anyone have an idea what caused the snapshot problem. (I assume we need to know that before anyone can think of solving it)
mhilbush
(Mark)
January 7, 2019, 8:18pm
12
Here’s the issue, which contains the explanation of the problem.
opened 03:04AM - 06 Jan 19 UTC
closed 09:40PM - 16 Jan 19 UTC
bug
I'm seeing this error when calling the sendMail action with an attachment. The e… rror doesn't occur when calling the sendMail action without an attachment.
```
019-01-05 20:21:47.282 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule
'TestRuleOn': loader constraint violation: when resolving method
"javax.mail.BodyPart.setDataHandler(Ljavax/activation/DataHandler;)V" the class
loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) of the
current class, org/apache/commons/mail/MultiPartEmail, and the class
loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) for
the method's defining class, javax/mail/Part, have different Class objects for the
type javax/activation/DataHandler used in the signature
```
I'm seeing this on snapshot build 1484 (also 1489). I'm seeing the error on two separate systems. When I restore an earlier build (in this case 1458), the error doesn't occur.
The sendMail call in my rule is this
```
sendMail("my@email.address", "Email subject", "Email body", "file:///path/to/image.jpg")
```
or this
```
sendMail("my@email.address", "Email subject", "Email body", "http://my.host/path/to/image.jpg")
```
It didn't look like anything had changed with the sendMail action in the openhab1 repo (hence the reason for not opening the issue in that repo).
1 Like
yves
(YvesHanoulle)
January 17, 2019, 12:36am
14
As you can see on the github, this bug should be solved in the last snapshot.
2 Likes