ATG- Issue in sending email through atg scenario - email

I have a requirement to send an email after registration of a new user my ATG application.
I have created a template jsp and created a scenario in ATG for that.
I also configured config/atg/scenario/IndividualEmilSender.properties with below key-value-
contextPathPrefix=/teststore
siteHttpServerName=localhost
siteHttpServerPort=8080
And /config/atg/userprofiling/email/TemplateEmailSender.properties as:-
$class=atg.userprofiling.email.TemplateEmailInfoImpl
mailingName=Your Mailing
contextPathPrefix=/teststore
messageSubject^=/atg/dynamo/service/SMTPEmail.defaultSubject
messageFrom^=/atg/dynamo/service/SMTPEmail.defaultFrom
contentProcessor=/atg/userprofiling/email/HtmlContentProcessor
fillFromTemplate=true
templateURL=/NewUserRegistered.jsp
loggingDebug=true
But getting following exception-
ERROR [ScenarioManager] Error while processing individual timer message InstanceTimerMessage[17000001,/TestStore/RegistrationScenario.sdl,NewMembers,3,in 1 mins]; rolling back the transaction java.lang.NullPointerException
at atg.scenario.action.SendEmail.createTemplateEmailInfo(SendEmail.java:193)
at atg.scenario.action.SendEmail.execute(SendEmail.java:526)
at atg.process.ProcessManagerService.executeAction(ProcessManagerService.java:14001)
at atg.process.ProcessManagerService.takeIndividualTransition(ProcessManagerService.java:13408)
at atg.process.ProcessManagerService.receiveIndividualTimerMessage(ProcessManagerService.java:12732)
at atg.process.ProcessManagerService.receiveMessage(ProcessManagerService.java:11416)
at atg.process.ProcessManagerService.receiveMessage(ProcessManagerService.java:11341)
at atg.dms.patchbay.ElementManager.deliverMessage(ElementManager.java:316)
at atg.dms.patchbay.InputPort.onMessage(InputPort.java:190)
at atg.dms.patchbay.InputDestination.onMessage(InputDestination.java:397)
at atg.dms.patchbay.InputDestinationConsumer.processMessageDelivery(InputDestinationConsumer.java:501)
at atg.dms.patchbay.InputDestinationConsumer.runXATransactions(InputDestinationConsumer.java:371)
at atg.dms.patchbay.InputDestinationConsumer.run(InputDestinationConsumer.java:245)
at java.lang.Thread.run(Thread.java:662)
10:34:32,527 INFO [ScenarioManager] DEBUG [message]: message ID:170000 failed a total of 1 times so far
10:34:32,543 ERROR [MessagingManager] An error occurred while MessageSink with nucleus name "/atg/scenario/ScenarioManager" was receiving a Message from input port "IndividualTimers": javax.jms.JMSException: CONTAINER:atg.process.ProcessException; SOURCE:java.lang.NullPointerException
10:34:32,558 INFO [ScenarioManager] DEBUG received message on port IndividualTimers message: jms-msg:ID:170000
10:34:32,558 INFO [ScenarioManager] DEBUG [message]: not processing message ID:170000 after 1 failed delivery attempts
Please help to resolve this!
Thanks!

You are getting a NullPointerException because your DefaultEmailInfo is not configured correctly.
Have a look at the chapter around Sending Targeted E-mail as well as the SendMail action in the documentation.
It is likely that you are missing one or more of the required configuration changes.

Related

Kogito Kafka messages - Message Trigger information is not complete TriggerMetaData

has someone has ever encounter this error when using Kogito (with quarkus) to send Kafka messages from a flow (bpmn2 file) throwing an "Intermediate Message" from the intermediate events?
[ERROR] com.package.xxxxxx.whenRunTestSupermarketSuccess Time elapsed: 0.006 s
<<< ERROR!
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateSources
threw an exception: org.kie.kogito.codegen.process.ProcessCodegenException: Error while elaborating
process id = "supermarketFlow", packageName = "com.package.xxxxxx": Message Trigger information is
not complete TriggerMetaData [name=cartCreated, type=ProduceMessage, dataType=String, modelRef=null, ownerId=1]
at org.kie.kogito.codegen.process.ProcessCodegen.internalGenerate(ProcessCodegen.java:325)
at org.kie.kogito.codegen.core.AbstractGenerator.generate(AbstractGenerator.java:69)
I can sense modelRef=null could be the issue but as far as I've seen in the official documentation, is not mention. I suppose I should give it a value on the bpmn file but I don't where.
I'm trying to send Kafka messages after running some logic, for the moment no one consuming the messages.
May be the issue is related to this thread?
BPMN 2.0, kogito, triggering signal or message from another process

Spring Integration: Imap, continuous remote service polling caused by attribute mail-filter-expression in imap-idle-channel-adapter

I implemented a imap idle mail receiver with spring integration mail 4.2.6.
When, in the configuration of the receiver in the tag
<mail:imap-idle-channel-adapter mail-filter-expression="something" ... >
i use the attribute "mail-filter-expression" this causes continuous ( about every second) polling of the remote mail service with this repeated message:
10:29:21 INFO o.s.i.mail.ImapMailReceiver - attempting to receive mail from folder [INBOX]
If i remove the attribute "mail-filter-expression" this continuos polling disappears.
I don't know if this is the desired behavior of the framework.
My idea is to limit this comtinuos polling of the remote service, in fact i'm using the imap-idle-channel-adapter
this is my configuration of the receiver:
<mail:imap-idle-channel-adapter
id="mailAdapterMailInAccettazione"
store-uri="imaps://...the url of the remote service
channel="emailsInAccettazioneDaLeggere"
auto-startup="true"
should-delete-messages="false"
should-mark-messages-as-read="false"
java-mail-properties="javaMailProperties"
mail-filter-expression="subject matches '(?i).*somenthing: .*'" >
<mail:transactional synchronization-factory="syncFactoryAccettazione"/>
</mail:imap-idle-channel-adapter>
I want to cofigure the receiver in idle mode but using the mail-filter-expression attribute because i want to read only some emails.
UPDATE : after further investigation i discovered that the remote mail service doesn't support RECENT and USER flag:
This email server does not support RECENT or USER flags
So this is what was happening:
mail-filter-expression caused messages to get filtered, but no message was flagged as RECENT = false. This caused
continuous attempts to read the messages as all messages always appeared "
new"
.
I re implemented the flow not using the mail-filter-expression but filtering messages in subsequent channels

Moqui - Connecting to an IMAP server over an SSL connection?

I am trying to poll an email server in Moqui 1.5.4. I am using org.moqui.impl.EmailServices.poll#EmailServer from the 'tools' application.
The email server is set up as follows:
<moqui.basic.email.EmailServer emailServerId="testEmail" mailUsername="test.account#xxxxxxx.ie" mailPassword="xxxxxxxx" smtpHost="" smtpPort="" smtpSsl="" storeHost="Webmail8.xxxxxxxxxxx.ie" storePort="993" storeProtocol="imap" storeDelete="N" />
All entries, passwords have been tested on Outlook and connect no problem to the server.
I get a javax.mail.AuthenticationFailedException.
Additional Information:
In initial tests I received the following error message, so I removed the 'static' modifier from the indicated line in the code. (I was not sure yet if it was an issue or if I may be doing something wrong.)
--- 98330 [ndlerThread[15]] WARN moqui.impl.context.TransactionFacadeImpl
Transaction rollback. The rollback was originally caused by: startup failed:
classpath_//org/moqui/impl/pollEmailServer_groovy: 28: Modifier 'static' not allowed here.
# line 28, column 1.
final static Logger logger = LoggerFactory.getLogger("org.moqui.impl.pollEmailServer")
Some things I tried to see if I could resolve the problem include:
setting storeProtocol="imaps"
including the smtp details in the EmailServer entry (note I only need to poll, not send mail).
adding the following line to pollEmailServer.groovy (having looked at the com.sun.mail.imap package).
sessionProperties.put("mail.imap.ssl.enable", true)
Full Authentication failed error message is:
Error running service [org.moqui.impl.EmailServices.poll#EmailServer] (Throwable)
javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:306)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at pollEmailServer_groovy.run(pollEmailServer_groovy:47)
at org.moqui.impl.context.runner.GroovyScriptRunner.run(GroovyScriptRunner.groovy:50)
at org.moqui.impl.context.ResourceFacadeImpl.script(ResourceFacadeImpl.groovy:337)
at org.moqui.impl.service.runner.ScriptServiceRunner.runService(ScriptServiceRunner.groovy:49)
at org.moqui.impl.service.ServiceCallSyncImpl.callSingle(ServiceCallSyncImpl.groovy:260)
at org.moqui.impl.service.ServiceCallSyncImpl.call(ServiceCallSyncImpl.groovy:137)
at ServiceRun_xml_transition_run_actions.run(ServiceRun_xml_transition_run_actions:10)
at org.moqui.impl.actions.XmlAction.run(XmlAction.groovy:99)
at org.moqui.impl.screen.ScreenDefinition$TransitionItem.run(ScreenDefinition.groovy:659)
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:223)
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217)
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217)
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217)
at org.moqui.impl.screen.ScreenRenderImpl.recursiveRunTransition(ScreenRenderImpl.groovy:217)
at org.moqui.impl.screen.ScreenRenderImpl.internalRender(ScreenRenderImpl.groovy:301)
at org.moqui.impl.screen.ScreenRenderImpl.render(ScreenRenderImpl.groovy:164)
at org.moqui.impl.webapp.MoquiServlet.doScreenRequest(MoquiServlet.groovy:71)
at org.moqui.impl.webapp.MoquiServlet.doPost(MoquiServlet.groovy:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at net.winstone.core.ServletCotion.execute(ServletConfiguration.java:270)
at net.winstone.core.SimpleRequestDispatcher.forward(SimpleRequestDispatcher.java:290)
at net.winstone.core.listener.RequestHandlerThread.processRequest(RequestHandlerThread.java:212)
at net.winstone.core.listener.RequestHandlerThread.run(RequestHandlerThread.java:143)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at net.winstone.util.BoundedExecutorService$1.run(BoundedExecutorService.java:81)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Addendum: Processing the messages once polled with Email ECA Rules.
I can see when I turn on logger info in EmailEcaRule.groovy that the condition in my Email ECA keeps evaluating to 'false'. But it shouldn't be?
======== EMECA Process Received Email conditionPassed? false My condition: TestEmail fields:
(Note that I inserted "My condition: ${fields.subject}" into the logger info to double check my condition expression was as it should be.)
My emeca is:
<emecas xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/email-eca-1.5.xsd">
<emeca rule-name="Process Received Email">
<condition><expression>fields.subject == 'TestEmail'</expression></condition>
<actions>
<service-call name="org.moqui.impl.EmailServices.save#EcaEmailMessage" />
</actions>
</emeca>
</emecas>
I have tested and re-tested this. I don't know why it is evaluating to false. Please let me know if any additional information is required.
Still no luck in solving this. I must be doing something stupid. I commented out if (conditionPassed) {} in the EmailEcaRule.groovy to bypass my condition in the Email ECA rule and just run the action, but now it gets hung up with a "Cannot invoke method get() on null object" error in org.moqui.impl.EmailServices.save#EcaEmailMessage, presumably on headers.get('message-id'). But I can see in the log information that the message Id is in the headers information, and successfully converted to lower case.
There were a few issues with this. First is that Moqui was using an old version of JavaMail (now updated to 1.5.4). Another was how the password was passed through, and more generally there was lots of room for improvement in how the script for poll#EmailServer service was using the JavaMail API.
There are various changes in place as of commit #bf0f872. I was able to connect successfully using storeProtocol=imaps, storePort=993, etc.
To answer your question: without these code changes I don't think connection via SSL would be possible. In other words, this ended up being more of a bug report than a question.

Cometd in wildfly8.1.0 no response

I'm trying to deploy a project which utilizes Cometd2.9.1 in Wildfly8.1.0.
The project worked in glassfish4.0, however it won't work in wildfly. It can be deployed with no problem, but it stuck after I visit http://localhost:8080/Cometd3/ (Yes, the project name is Cometd3 while I ended up with cometd2.9.1)
It's weird because there is no error or exception message even I enabled debug log.
Because my log is too long to post here and I have completely no idea what is the problem, please download my log file here.
Please note that the log is just stop at
2014-09-17 14:57:09,893 FINE [javax.enterprise.resource.webcontainer.jsf.application] (default task-4) servletPath /faces
2014-09-17 14:57:09,900 FINE [javax.enterprise.resource.webcontainer.jsf.application] (default task-5) servletPath /faces
2014-09-17 14:57:09,907 FINE [javax.enterprise.resource.webcontainer.jsf.application] (default task-6) servletPath /faces
2014-09-17 14:58:44,505 DEBUG [org.jboss.ejb.client.txn] (Periodic Recovery) Send recover request for transaction origin node identifier 1 to EJB receiver with node name 972909-a43sv
And there are no other log after those messages.
What's more,when I say it is stuck, I mean not only the server side stuck, but also the browser, which means the browser is totally white and keep loading page when I open it.
Any thoughts? Thanks!
I can answer only from the CometD side of things.
The logs shows some server-side CometD activity (a LocalSession called echo handshakes), but after that it's like there are no requests to the server, so that CometD has nothing to do and just sits idle.
From your description of the problem looks more like a server problem than a CometD problem.
CometD typically runs very well in Jetty; I would try to deploy your application in Jetty and see how it goes.

"Failed to parse extension packet in Presence packet" error, causing disconnects, with Smack

I've implemented a chat client that stays online forever and sends messages to different XMPP users. This client is connected to ejabberd server and is implemented in java using Smack.
After exactly 1 minute, the client goes offline and then comes back online in almost 15 seconds. The log that appears on client's console, follows:
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen...erd.cloudservicesplatform.biz/cspb2\' id=\'t5f8L-12\' type=\'result\'/>... #1:1264
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Failed to parse extension packet in Presence packet.
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen
...<query xmlns=\'jabber:iq:version\'/>\n</iq>... #6:6
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Failed to parse extension packet in Presence packet.
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen
...=\'cspbox107#dev-ejabberd.cloudservicesplatform.biz\'/></query></iq>... #6:292
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:279)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
Failed to parse extension packet in Presence packet.
Smack until 3.3.0 throw an exception when a malformed presence stanza was received. This behavior was changed with SMACK-390.
You should:
update to the latest Smack Version (i.e. 3.4.1 at the time of writing)
inform the developer of the library/program where the malformed stanza originates from about the bug
Edit: After having a close look at the logs and since you didn't mention the used Smack version, it seems also likely that you simply received a malformed stanza which causes the disconnect (This would be a non-recoverable error, even on Smack 3.4.1).