Problem with creating action

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

mikebac12
Posts: 9
Joined: Tue Feb 03, 2015 12:14 am

Problem with creating action

Post by mikebac12 »

Hi,

I have installed OpenEMM 2015RC2 on a fresh install of Centos 7. Most things seem to be working but I was trying to create a new form and action that would allow for an unsubscribe multi link in an email. I used the older directions at the following link...

https://forum.openemm.org/ftopic619.html

but when I copy and paste the following code into a new action and save it...

##unsubscribe script for more mailinglists

##set Company ID
#set($company = 1)

##Check the availability of the customer
#if($customerID != 0)
$BindingEntry.setCustomerID($customerID)

##define first mailinglist
$BindingEntry.setMailinglistID(1)

#if($BindingEntry.getUserBindingFromDB($company) == true)
#if($BindingEntry.getUserStatus() == 1)
$BindingEntry.setUserStatus(3)
$BindingEntry.setUserRemark("Opt-Out by Script")
$BindingEntry.updateBindingInDB($company)
#set($result="checked out from list A")
#else
#set($result="not active on list A")
#end
#else
#set($result="without binding to list A")
#end

##define second mailinglist
$BindingEntry.setMailinglistID(2)

#if($BindingEntry.getUserBindingFromDB($company) == true)
#if($BindingEntry.getUserStatus() == 1)
$BindingEntry.setUserStatus(3)
$BindingEntry.setUserRemark("Opt-Out by Script")
$BindingEntry.updateBindingInDB($company)
#set($result1="checked out from list B")
#else
#set($result1="not active on list B")
#end
#else
#set($result1="without binding to list B")
#end

#else
#set($result="not a customer of our mailings")
#set($result1="not a customer of our mailings")
#end

##necessary for a successful result
#set($scriptResult="1")

I get an error when trying to save that says " A general error occurred. Please check your input."

Any help would be greatly appreciated.

Thanks
Mike
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Problem with creating action

Post by maschoff »

Could you please have a look at Tomcat's log catalina.out in /home/openemm/logs/ and post its output here when you are trying to save the script?
OpenEMM Maintainer
mikebac12
Posts: 9
Joined: Tue Feb 03, 2015 12:14 am

Re: Problem with creating action

Post by mikebac12 »

Thanks much

2015-02-05 08:10:46,228: ERROR [http-8080-3] org.agnitas.web.EmmActionAction - execute
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [insert into actop_execute_script_tbl (action_operation_id, script) values (?, ?)]; Data truncation: Data too long for column 'script' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'script' at row 1
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:100)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:818)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:874)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:882)
at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.update(SimpleJdbcTemplate.java:251)
at org.agnitas.emm.core.action.dao.impl.ActionOperationExecuteScriptDaoImpl.processSaveOperation(ActionOperationExecuteScriptDaoImpl.java:17)
at org.agnitas.emm.core.action.dao.impl.ActionOperationExecuteScriptDaoImpl.processSaveOperation(ActionOperationExecuteScriptDaoImpl.java:7)
at org.agnitas.emm.core.action.dao.impl.AbstractActionOperationDaoImpl.saveOperation(AbstractActionOperationDaoImpl.java:27)
at org.agnitas.dao.impl.EmmActionOperationDaoImpl.saveOperation(EmmActionOperationDaoImpl.java:88)
at org.agnitas.emm.core.action.service.impl.EmmActionServiceImpl.saveEmmAction(EmmActionServiceImpl.java:115)
at org.agnitas.web.EmmActionAction.saveAction(EmmActionAction.java:319)
at org.agnitas.web.EmmActionAction.execute(EmmActionAction.java:179)
at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:113)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.agnitas.web.filter.Struts1SecurityFilter.doFilter(Struts1SecurityFilter.java:106)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:232)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.agnitas.web.filter.SerializeRequestFilter.doFilter(SerializeRequestFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.agnitas.web.filter.SessionHijackingPreventionFilter.doFilter(SessionHijackingPreventionFilter.java:137)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'script' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4185)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2815)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2458)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2375)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2359)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:824)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:818)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
... 56 more
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Problem with creating action

Post by maschoff »

Ok, your script is too long for field script (which can only 255 hold characters). We will provide a fix. Thanks for your notification!
OpenEMM Maintainer
mikebac12
Posts: 9
Joined: Tue Feb 03, 2015 12:14 am

Re: Problem with creating action

Post by mikebac12 »

Much appreciated
mdoerschmidt
Posts: 25
Joined: Fri Jan 04, 2013 8:55 am

Re: Problem with creating action

Post by mdoerschmidt »

Hi!

the bug is easy to fix: Just convert the type of the column to "longtext".

On MySQL shell execute this statement:
alter table actop_execute_script_tbl change column `script` `script` longtext not null;


Best regards,

Markus
mikebac12
Posts: 9
Joined: Tue Feb 03, 2015 12:14 am

Re: Problem with creating action

Post by mikebac12 »

Hi Markus,

Thanks for the suggestion.


With MariaDB I used ...

ALTER TABLE actop_execute_script_tbl MODIFY script LONGTEXT NOT NULL;

and that seems to have done the trick. I have also downloaded and installed HeidiSQL for Windows which allows me to manipulate the databases and data(very cool tool).

Appreciate the help and all the best,

Mike

P.S. Nice work to all who have worked on this product. Very cool.
maschoff
Site Admin
Posts: 2597
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: Problem with creating action

Post by maschoff »

Just curious: Which version of MariaDB do you use?
OpenEMM Maintainer
mikebac12
Posts: 9
Joined: Tue Feb 03, 2015 12:14 am

Re: Problem with creating action

Post by mikebac12 »

5.5.40

My understanding is that MariaDB has replaced MySQL.
Post Reply