This page last changed on Jun 18, 2013 by ali.

Hi,

I need to send mail?

Regards,

Ali Haydar


mailsensor.JPG (image/jpeg)
mailon.JPG (image/jpeg)
mailoff.JPG (image/jpeg)
mailstatus.JPG (image/jpeg)

If you're running on Linux system, it should be quite easy with the 'mail' command and hooking that to a script in the shell execution protocol.

Posted by juha at Jun 18, 2013 10:56

I have solved it with a rule that can send mail through a Gmail account.

To trigger the rule, I use a virtual sensor ("Send mail sensor") and three virtual commands ("Send mail ON", "Send mail OFF" and "Send mail status").

Other rules can send mail through the command, "execute.command ("Send mail ON");"
Or you can test it with a button connected to the "Send mail ON" command.

You also need to add the file "javax.mail-1.5.0.jar" in your
...\webapps\controller\WEB-INF\lib folder.
It can be downloaded here: http://www.oracle.com/technetwork/java/javamail/index.html

The rule looks like this:

package org.openremote.controller.model.event
global org.openremote.controller.statuscache.LevelFacade levels;
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
import org.openremote.controller.protocol.Event;

import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

rule "Send mail"

when
  
Switch ( source == "Send mail sensor", value == "on")

then

execute.command ("Send mail OFF");
 
        final String username = "your gmail address";
	final String password = "your gmail password";
	Properties props = new Properties();
	props.put("mail.smtp.host", "smtp.gmail.com"); 
	props.put("mail.smtp.socketFactory.port", "465");
	props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
	props.put("mail.smtp.auth", "true");
	props.put("mail.smtp.port", "465");

	Session session = Session.getInstance(props,
	  new javax.mail.Authenticator() {
		protected PasswordAuthentication getPasswordAuthentication() {
			return new PasswordAuthentication(username, password);
		}
	  });

	try {
		Message message = new MimeMessage(session);
		message.setFrom(new InternetAddress("the from mail address"));
		message.setRecipients(Message.RecipientType.TO,
			InternetAddress.parse("the to mail address"));
		message.setSubject("subject");
		message.setText("the message");

		Transport.send(message);

		System.out.println("Mail sent");

	} catch (MessagingException e) {
		throw new RuntimeException(e);
	}


end
Posted by kenta at Jun 19, 2013 08:53

Nice. Looks like you're picking up on your Java skills. What you've written is basically the implementation for the email facade discussed here: Emails and texts from rules

Posted by juha at Jun 19, 2013 10:07

Thanks to everyone,

Which command will create virtual sensors? I "Send mail OFF" command created the knx off, "Send mail sensor" command created as a sensor. But it did not work and gives this error.

ERROR 2013-06-21 01:39:51,865 : Rule definition 'modeler_rules.drl' could not be deployed. See errors below.
ERROR 2013-06-21 01:39:51,867 : [ERR 103] Line 23:0 rule 'rule_key' failed predicate: {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
ERROR 2013-06-21 01:39:51,869 : [ERR 101] Line 23:8 no viable alternative at input 'org' in rule package
ERROR 2013-06-21 01:39:51,870 : [ERR 101] Line 24:0 no viable alternative at input 'global' in rule package in rule event
ERROR 2013-06-21 01:39:51,875 : There was an error parsing the rule definition 'modeler_rules.drl' : Could not parse knowledge.
java.lang.IllegalArgumentException: Could not parse knowledge.
	at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilderImpl.java:58)
	at org.openremote.controller.statuscache.rules.RuleEngine.getValidKnowledgePackages(RuleEngine.java:532)
	at org.openremote.controller.statuscache.rules.RuleEngine.start(RuleEngine.java:253)
	at org.openremote.controller.statuscache.EventProcessorChain.start(EventProcessorChain.java:112)
	at org.openremote.controller.statuscache.StatusCache.start(StatusCache.java:120)
	at org.openremote.controller.deployer.Version20ModelBuilder.buildSensorModel(Version20ModelBuilder.java:641)
	at org.openremote.controller.deployer.Version20ModelBuilder.build(Version20ModelBuilder.java:539)
	at org.openremote.controller.deployer.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:148)
	at org.openremote.controller.service.Deployer.startup(Deployer.java:785)
	at org.openremote.controller.service.Deployer.softRestart(Deployer.java:393)
	at org.openremote.controller.service.Deployer$ControllerDefinitionWatch.run(Deployer.java:1249)
	at java.lang.Thread.run(Thread.java:619)
INFO 2013-06-21 01:39:51,881 : Initialized event processor : Drools Rule Engine
INFO 2013-06-21 01:39:51,890 : Registered sensor : Switch Sensor (Name = '1.1.2/ Status H/', ID = '2589729')
INFO 2013-06-21 01:39:51,890 : Registered sensor : Switch Sensor (Name = '1.1.2/ Status G/', ID = '2589728')
INFO 2013-06-21 01:39:51,892 : Registered sensor : Switch Sensor (Name = 'Send mail sensor', ID = '2641902')
INFO 2013-06-21 01:39:51,893 : Registered sensor : Level Sensor (Name = '1.1.3/ Value A/ Status', ID = '2589737', Min: 0, Max: 100)
INFO 2013-06-21 01:39:51,894 : Registered sensor : Switch Sensor (Name = '1.1.2/ Status A/', ID = '2589725')
INFO 2013-06-21 01:39:51,895 : Registered sensor : Switch Sensor (Name = '1.1.2/ Status B/', ID = '2589726')
INFO 2013-06-21 01:39:51,897 : Registered sensor : Switch Sensor (Name = '1.1.2/ Status C/', ID = '2589727')
INFO 2013-06-21 01:39:51,899 : Startup complete.
Posted by ali at Jun 21, 2013 07:26

First you create three "In-memory Virtual Commands".
For example, like this:

Then, you bind a switch sensor to the status command.
Like this:

Good luck

Posted by kenta at Jun 24, 2013 11:50

Thanks!

Posted by kenta at Jun 24, 2013 12:35

Thank very much. It's working.

Posted by ali at Jun 27, 2013 06:49

works for me as well!! I would like to ask for some help on how to send different emails for different events with different text contents.

Thanks Kenneth.

Posted by stavroschar at Sep 06, 2013 20:10

Glad it works for you too.
I haven't tried it myself (with different text content for various events).

But, the easiest way is probably to have different "email rules" for different events.
If you have little knowledge of java you can replace "the message" with a string variable, which you set to different texts for different events.

A more elegant alternative is to use the new Email feature that Lawrie has written. There you can use a parameter in the message field.

Posted by kenta at Sep 09, 2013 08:46

Hi Kenneth

I am trying it out with the string variable as you said but i am not there yet. As for the email feature Lawrie has written i dont seem to find it in the profesional version of openremote.Do i need to do something to enable it or is it just not available yet to the pro version??

Kind regards,

Stavros

Posted by stavroschar at Sep 13, 2013 08:02

Sorry I don't know anything about if/when the Email feature is/will be implemented in the pro version.

I am a total newbie myself on Java, but I can try to give you some help.
What kind of parameter/event do you have to trigger the rule and set the different text contents?

Posted by kenta at Sep 14, 2013 07:36

Hi Stavros,

The email feature from Lawrie is not yet available in Pro. It's being made available to the community to test and give feedback.

For the time being, sending email from Pro needs to be accomplished with the code snippet Kenneth offered in the thread above.

– Juha

Posted by juha at Sep 14, 2013 10:02

Hi Kenneth,

I am using openremote to control my KNX home automation. The need is to be able to send diferent email messages when various knx sensors are trigered (openremote sensors connected to knx status objects) that will act as alarms.

I have declared a string variable to hold the text message of the email as follows:

final String textmesage = "alarm boiler";

and then modified the part where the email text message is specified to use the string variable as follows:

message.setText(textmesage);

When the string variable is assigned within the rule, then it works ok, but when i try to assign it outside the rule then it doesnt work.

The idea is to have diferent rules cheking diferent status sensor and when a sensor is activated, then set the text message variable to the required text mesage, and then execute the command, "execute.command ("Send mail ON");"

Any help would be greatly appreciated

Regards,

Stavros

Posted by stavroschar at Sep 17, 2013 11:34

Hi Stavros

You can try this (it works for me).

Declare the variable outside the rules, like this:

declare Email_Text_Message
    email_text: String
end

In your different cheking rules, insert this line to set the various text messages.
insert (new Email_Text_Message (" The text message '));
instead of
execute.command ("Send mail ON");

Let the Email rule look like this:
The rule will trigger when the text message is set.

rule "Send Email"

when
$em_message : Email_Text_Message()
then
        final String username = "your gmail address";
	final String password = "your gmail password";
	Properties props = new Properties();
	props.put("mail.smtp.host", "smtp.gmail.com"); 
	props.put("mail.smtp.socketFactory.port", "465");
	props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
	props.put("mail.smtp.auth", "true");
	props.put("mail.smtp.port", "465");

	Session session = Session.getInstance(props,
	  new javax.mail.Authenticator() {
		protected PasswordAuthentication getPasswordAuthentication() {
			return new PasswordAuthentication(username, password);
		}
	  });

	try {
		Message message = new MimeMessage(session);
		message.setFrom(new InternetAddress("the from mail address"));
		message.setRecipients(Message.RecipientType.TO,
			InternetAddress.parse("the to mail address"));
		message.setSubject("subject");
                message.setText($em_message.getEmail_text());

		Transport.send(message);

		System.out.println("Mail sent");

	} catch (MessagingException e) {
		throw new RuntimeException(e);
	}
end

Good luck

Posted by kenta at Sep 18, 2013 10:05

Hi Kenneth,

I works perfectly!!! Great work !! Thank you very much for your help with this. kindly appreciated!!!

Regards,

Stavros

Posted by stavroschar at Sep 18, 2013 15:18

Glad to be able to help you.

Posted by kenta at Sep 19, 2013 11:47

Hi Kenneth, hi Juha,

As i received your help many times i feel like giving something back (I am not sure if something like this was posted in the past)

With Kenneth's valuable help i have managed to use the code for sending emails, to send mobile SMS mesages which i find it a nice feature for openremote users. It is not something special, just subscribed to an internet based company which provides email to SMS services with relativly good prices (5 Euros for about 400 sms mesages for Cyprus). Kenneth's email code generates the emails send to this company along with the telephone number and the text content and the SMS is send to your mobile phone. There are many email to SMS providers available but if anyone is interested i can provide you with more info on the one i used. It is like having a GSM interface without any expensive hardware.

Kind Regards,

Stavros

Posted by stavroschar at Sep 20, 2013 06:49

Hi Kenneth, hi Juha,

As i received your help many times i feel like giving something back (I am not sure if something like this was posted in the past)

With Kenneth's valuable help i have managed to use the code for sending emails, to send mobile SMS mesages which i find it a nice feature for openremote users. It is not something special, just subscribed to an internet based company which provides email to SMS services with relativly good prices (5 Euros for about 400 sms mesages for Cyprus). Kenneth's email code generates the emails send to this company along with the telephone number and the text content and the SMS is send to your mobile phone. There are many email to SMS providers available but if anyone is interested i can provide you with more info on the one i used. It is like having a GSM interface without any expensive hardware.

Kind Regards,

Stavros

Posted by stavroschar at Sep 20, 2013 06:49

Hi Stavros.

Excuse the late reply.

I'm definitely interested in getting more information about how you have solved your SMS service and I am convinced that I am not alone.

I think it is great when users share their different ways of using OR.

Posted by kenta at Sep 28, 2013 07:15

Hi Kenneth,

The idea is very simple,

I setup an acount with the following email to sms service provider:

http://www.liveall.eu/en

( There are many similar providers, i just chose this randomly)

You will be given a username and password.

Then you will need to buy some gredits (the good thing about this provider is that there are no time limits as to when you need to use your gredits.(at least for now)

Then the way to send sms messages from any email acound is described here:

http://www.liveall.eu/en/node/67

So i did some minor modifications to your main code as follows:

message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("mail2sms@liveall.eu")); <--------add the providers email adress
message.setSubject("sms"); <--------the subject needs to be set to "sms"

And then the rule which modifies the email mesage for each event is modified as follows:

rule "FIRE ALARM" when

Event( source == "FIRE", value == "on")

then

insert (new Email_Text_Message ("username: your liveall username\n"+ <--------your username from liveall.eu acount
"password: your liveall password\n"+ <--------your password from liveall.eu acount
"sender: knx smart home\n"+ <--------the name you want to show up as the sender when you receive your sms mesage
"To: 35799111111\n"+ <--------the telephone number that the sms will be delivered to including the country code without the double zeros
"Message: FIRE ALARM")); <--------the contents of your sms mesage

end

Note : the \n"+ is needed to change lines otherwise it will not work.

I hope someone may find this usefull and once again i would like to thank you Kenneth for your help in this.

Kind regards,

Stavros

Posted by stavroschar at Sep 30, 2013 13:02

Hi Stavros,

Thanks for sharing. Sending SMS is indeed a fairly common request. We've been looking at this for some of the commercial offerings with another service providers but it is quite useful to know about the alternatives that are out there and your experiences with them.

– Juha

Posted by juha at Sep 30, 2013 13:06

Hi

I try this code to implement mail sending but I have following errors :

--------------------------------------------------------------------

  DEPLOYING NEW CONTROLLER RUNTIME...

--------------------------------------------------------------------

ERROR 2015-02-24 20:13:17,316 : Error in rule definition 'modeler_rules.drl' : wrong class format
java.lang.RuntimeException: wrong class format
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:260)
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:204)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:317)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619)
	at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:107)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createFields(BinaryTypeBinding.java:355)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:326)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619)
	at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:107)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
	at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.resolve(ParameterizedTypeBinding.java:851)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:100)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.superclass(BinaryTypeBinding.java:1062)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getExactMethod(BinaryTypeBinding.java:787)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:893)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getMethod(Scope.java:2234)
	at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:401)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:913)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:447)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:189)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:406)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1131)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1219)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:528)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
	at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
	at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
	at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
	at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
	at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
	at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
	at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:266)
	at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:458)
	at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
	at org.openremote.controller.statuscache.rules.RuleEngine.getValidKnowledgePackages(RuleEngine.java:498)
	at org.openremote.controller.statuscache.rules.RuleEngine.start(RuleEngine.java:253)
	at org.openremote.controller.statuscache.EventProcessorChain.start(EventProcessorChain.java:112)
	at org.openremote.controller.statuscache.StatusCache.start(StatusCache.java:120)
	at org.openremote.controller.deployer.Version20ModelBuilder.buildSensorModel(Version20ModelBuilder.java:659)
	at org.openremote.controller.deployer.Version20ModelBuilder.build(Version20ModelBuilder.java:557)
	at org.openremote.controller.deployer.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:154)
	at org.openremote.controller.service.Deployer.startup(Deployer.java:872)
	at org.openremote.controller.service.Deployer.softRestart(Deployer.java:454)
	at org.openremote.controller.service.Deployer$ControllerDefinitionWatch.run(Deployer.java:1411)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:254)
	... 58 more
ERROR [Controller Definition File Watcher for Default Deployer]: Error in rule definition 'modeler_rules.drl' : wrong class format
java.lang.RuntimeException: wrong class format
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:260)
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:204)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:317)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619)
	at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:107)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFromTypeSignature(LookupEnvironment.java:1188)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createFields(BinaryTypeBinding.java:355)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:326)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:619)
	at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:295)
	at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:107)
	at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)
	at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.resolve(ParameterizedTypeBinding.java:851)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:100)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.superclass(BinaryTypeBinding.java:1062)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getExactMethod(BinaryTypeBinding.java:787)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:893)
	at org.eclipse.jdt.internal.compiler.lookup.Scope.getMethod(Scope.java:2234)
	at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:401)
	at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:913)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:447)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:189)
	at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:406)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1131)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1219)
	at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:528)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:759)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
	at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
	at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
	at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
	at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
	at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
	at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
	at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:266)
	at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:458)
	at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
	at org.openremote.controller.statuscache.rules.RuleEngine.getValidKnowledgePackages(RuleEngine.java:498)
	at org.openremote.controller.statuscache.rules.RuleEngine.start(RuleEngine.java:253)
	at org.openremote.controller.statuscache.EventProcessorChain.start(EventProcessorChain.java:112)
	at org.openremote.controller.statuscache.StatusCache.start(StatusCache.java:120)
	at org.openremote.controller.deployer.Version20ModelBuilder.buildSensorModel(Version20ModelBuilder.java:659)
	at org.openremote.controller.deployer.Version20ModelBuilder.build(Version20ModelBuilder.java:557)
	at org.openremote.controller.deployer.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:154)
	at org.openremote.controller.service.Deployer.startup(Deployer.java:872)
	at org.openremote.controller.service.Deployer.softRestart(Deployer.java:454)
	at org.openremote.controller.service.Deployer$ControllerDefinitionWatch.run(Deployer.java:1411)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
	at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:254)
	... 58 more
INFO 2015-02-24 20:13:17,347 : Initialized event processor : Drools Rule Engine
INFO 2015-02-24 20:13:17,375 : Initialized event processor : RRD4J Data Logger
INFO 2015-02-24 20:13:17,375 : Initialized event processor : EmonCMS Data Logger
....

The environment is : NAS Synology with Java SE Embedded 1.8.0_33 and JavaMail 1.5.2

It seems that the error appear with the command : "props.put("mail.smtp.host", "smtp.gmail.com"); "

an idea ?

Thanks

Posted by gman0105 at Feb 24, 2015 19:51

Our drools version does not support java8.

Posted by mredeker at Feb 25, 2015 08:52

Our drools version does not support java8

According to Juha Lindfors some two years ago, that would be a simple fix. On a separate discussion IIRC from Eric that the Controller still has to be compiled for Java6.
Wouldn't it be possible to distribute two versions?

Posted by pz1 at Feb 25, 2015 09:53

That is, if at me now the installed on Synology DS-214Play: Java SE Embedded 1.8.0_33 and OpenRemote 2.1.1 (free), send an e-mail will not work? And the rules do not work? Need to downgrade version Java to 1.6.0, for work these functions?
With this version Java will work? (ejre-1_6_0_38-fcs-b05-linux-i586-headless-13_nov_2012.tar.gz)

I tried http://www.openremote.org/display/forums/Emails%2C+Text-to-Speech%2C+Serial+Port ,but could not find the appropriate settings in the webapps/controller/WEB-INF/classes/config.properties
This is only for the Pro version?

Posted by aleksey_z at Feb 25, 2015 16:14

Thanks !

I have downgraded Java to 1.6.0_38.

I will test again...

Posted by gman0105 at Feb 25, 2015 20:12

Hi ,
Please need help regarding the subject "send email via openremote" i need a tuto please .

Posted by aissahmd at Apr 26, 2015 22:33

I have made this then what .please help am not very familiar with rules.please help

Posted by aissahmd at Apr 26, 2015 22:35
Document generated by Confluence on Jun 05, 2016 09:41